Feature API accepts whitespace and control characters as user_id, and has no length limit
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 66/100
Direzione di ricerca
Inizia con l'handler GET /features/{user_id} e il modello di richiesta POST /features/batch, che dichiara min_length=1, poi segui l'id dentro user_key(). Riproduci i casi di whitespace con i comandi curl nell'issue. Fatto significa che gli id composti solo da whitespace vengono gestiti allo stesso modo su entrambe le route (strip and reject, oppure strip and accept, come decide il maintainer) e che gli id oltre 255 caratteri vengono limitati, con i test di #39 aggiornati di conseguenza.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Follow-up from #39 (the new tests pin current behaviour; this is the part that looks like a bug).
What happens
GET /features/{user_id} declares the parameter as str and passes it straight to user_key() → HGETALL. Nothing trims or validates it, so:
| request | result |
|---|---|
GET /features/%20 |
404, no features for user ' ' — a space is treated as a real key |
GET /features/%09 |
404, tab is a real key |
GET /features/%0A |
404, newline is a real key |
GET /features/<1024 chars> |
404 — no length limit anywhere |
POST /features/batch with "" |
422 (min_length=1) |
POST /features/batch with " " |
200, then a normal miss |
So the two endpoints disagree about what an empty id is, and on the path route a caller can create distinct Redis keys such as eddy:user: and eddy:user:\t simply by requesting them with a write-side call later (or by any producer that copies the id through).
Why it matters
- Two users, or one user and one script, can be split across keys that differ only by invisible characters — silent cache misses and duplicated features.
- No upper bound on the id length means one request can write an arbitrarily long key.
Reproduction
# after the service is up
curl -s -o /dev/null -w '%{http_code}\n' 'http://localhost:8000/features/%20'
curl -s -o /dev/null -w '%{http_code}\n' -X POST 'http://localhost:8000/features/batch' \
-H 'content-type: application/json' -d '{"user_ids": [" "]}'
Expected instead: strip or reject ids that are empty after .strip(), and cap the length (e.g. 255) consistently on both routes.
The tests added in #39 assert today's behaviour deliberately, so they will need updating once this is fixed.
- Lingua principale
- Python
- Stelle
- 2
- Fork
- 4
- Merge medio
- 6h 43m
- PR unite (30g)
- 2
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di midhunsomu/Feature_Store
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
midhunsomu/Feature_Store#14 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
midhunsomu/Feature_Store#12 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
midhunsomu/Feature_Store#11 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
midhunsomu/Feature_Store#10 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di midhunsomu/Feature_Store
Issue simili
-
eegprep-lean: set channel types from the Zarr group's channel_typeForse già presa @claude l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
sccn/eegprep#668 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Upgrade Django to 5.2.18Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
blacklanternsecurity/bbot#3679 ·
I maintainer di solito rispondono entro 2 giorni
-
Link Checker ReportApertaBot Type: Bug Type: Documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
speakeasy-api/speakeasy#2159 ·
I maintainer di solito rispondono entro 1 giorno