http.cookiejar.domain_match() matches an interior substring instead of a suffix
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
domain_match(A, B) is documented to return True when A has the form NB, i.e. A ends with B (RFC 2965, section 1: "x.y.com domain-matches .Y.com but not Y.com"). It computes i = A.rfind(B) and only rejects i == -1 or i == 0, so a B that appears as an interior substring of A also matches:
>>> from http.cookiejar import domain_match
>>> domain_match("www.acme.com.evil.org", ".acme.com")
True
www.acme.com.evil.org does not end with .acme.com, so this should be False. The sibling helper user_domain_match() already uses A.endswith(B). This feeds the RFC 2965 (version > 0) cookie domain checks in set_ok_domain/return_ok_domain and is_third_party().
Linked PRs
- gh-150523
Guida per i contributori
Apri 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.
Direzione di ricerca
Inizia con http.cookiejar.domain_match() e confrontane il comportamento con quello dell’helper correlato user_domain_match() e con la regola documentata di RFC 2965. Verifica che l’esempio segnalato non corrisponda più a una sottostringa interna e controlla i percorsi correlati set_ok_domain, return_ok_domain e is_third_party(); il PR collegato gh-150523 indica che il lavoro è già in corso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- security
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 30/100