Test that a string before the nesting does not hide it from the token's depth scan

Aperta Adatta ai principianti
#126 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
django, python
Ambito
security, testing

Direzione di ricerca

Inizia con i test di _shallow in tests/test_caller_backends.py e leggi il test esistente test_many_sibling_arrays_are_not_nesting. Aggiungi i casi forniti con stringhe prima dell’annidamento e parametrizza il test degli array fratelli con "[]" e "{}". Esegui i test mirati e conferma che i nuovi casi passano e rilevano entrambi i mutanti dello stato di escape.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Non-blocking item from the approving review of #123. _shallow's tests (tests/test_caller_backends.py) put every string inside the deepest bracket, so they only check one direction: a string's brackets are not taken as nesting. Nothing checks that a string before the nesting does not hide it from the scan. Two mutants survive (dropping escaped = True on a backslash, and never resetting escaped), and either one brings back the SIGSEGV on a 1 MB thread.

Add (checked by the reviewer to pass at 3c39337 and to kill both mutants):

@pytest.mark.spec("HTTP-7")
@pytest.mark.parametrize("before", ['"\\""', '"\\\\"', '"\\\\\\""'])
def test_a_string_before_the_nesting_does_not_hide_it(before: str) -> None:
    head = text(header())[:-1] + ',"y":' + before + ',"x":' + "[" * 64 + "]" * 64 + "}"
    assert check(bearer(signed(raw_head=head)), IDENTITY, KEYS, NOW) == (None, None)

and parametrize test_many_sibling_arrays_are_not_nesting over "[]" and "{}".

Lingua principale
Python
Stelle
1
Fork
0
Merge medio
5h 30m
PR unite (30g)
85

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stack314/django-neolith

Tutte le issue di stack314/django-neolith

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.