`encrypt_data.json` file failing to pass http_ece/tests/test_ece.py::TestNode::test_(en|de)crypt
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 38/100
- Tipo de issue
- Bug
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Pouca atividade
- Stack de tecnologia
- python
- Domínio
- security, testing-qa
Direção de pesquisa
Start with python/http_ece/tests/test_ece.py, especially TestNode.test_encrypt and TestNode.test_decrypt around the reported failures, and inspect how encrypted_data.json is loaded. Compare the test vector with the AES-GCM encryption and decryption inputs, then rerun the failing tests; done means both tests pass with the shared vector.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
While updating things for https://github.com/web-push-libs/encrypted-content-encoding/pull/89 I tried running all of the tests by copying the encrypted_data.json file to the python/http_ece directory. The tests are failing with:
TestNode.test_decrypt
key = b'\xfe?\xb5\x06\x99tI\xdb\xe7\x8da\xb4g\x86\xb02', nonce = b'\x13\x90\xf2B\xae \x8a!\xe0F7\xe9', counter = 0
content = b'\xba\xab\'\xd1t}+\xff\xe1\xb7\x1f\xaa6\xd0k\x84\x03\xf0c#r\xae\xe8wF\xb9b\x0b&w4`\xfd~\xd1\xa2\xb0\xaf\xfa=\xfe\x83\...F\xe9,\x7fI\xc9r\x06\x8bp\x9f\x19$\x85\xff\x01\xac\x1e\xc6\xa6\x03\x14\x15\xbf\xc1\xf1\x8a\xd8vA\xbe\xf3{\xbd\xf0\x00>'
def decrypt_record(key, nonce, counter, content):
decryptor = Cipher(
algorithms.AES(key),
modes.GCM(iv(nonce, counter), tag=content[-TAG_LENGTH:]),
backend=default_backend(),
).decryptor()
> return decryptor.update(content[:-TAG_LENGTH]) + decryptor.finalize()
^^^^^^^^^^^^^^^^^^^^
E cryptography.exceptions.InvalidTag
venv/lib/python3.14/site-packages/http_ece/__init__.py:231: InvalidTag
During handling of the above exception, another exception occurred:
...
content = b'\xba\xab\'\xd1t}+\xff\xe1\xb7\x1f\xaa6\xd0k\x84\x03\xf0c#r\xae\xe8wF\xb9b\x0b&w4`\xfd~\xd1\xa2\xb0\xaf\xfa=\xfe\x83\...F\xe9,\x7fI\xc9r\x06\x8bp\x9f\x19$\x85\xff\x01\xac\x1e\xc6\xa6\x03\x14\x15\xbf\xc1\xf1\x8a\xd8vA\xbe\xf3{\xbd\xf0\x00>'
salt = b')\x95\xc7\x8a\xbe\xf1W\x15\x102L!\x7f\xe2\x17\x9f', key = None
private_key = <cryptography.hazmat.bindings._rust.openssl.ec.ECPrivateKey object at 0x7a24e95cebb0>
dh = b'\x04"x\x07\xb8\xd18\x10h\xeeNnD G\xea\xee/\xa0\xef\x8fNf\xe5X\xbd\xd5\x99%\xb2\x02\xef\x0c\xc3\\@A\xd2c\xe3\x1fG&_\xd4\xfc\x1bf\xa7\x84\x1a\xc9\xd9X\xb7\xd3\xfa)I\x18\x84\xb1\x98`\x91'
auth_secret = None
keyid = b"\xc6\xa1\x90m\r\xabP\xbe\x99&\xdb\xb1>\xfa>\xdb\xf4\x94\xa3\x03~\xbc\x91k5f\xcb0\x13\x83\x93\xb2\xfc\xad\x15\xe4\x05...f\xad+ c\xab\xf5'F\xe1\xe2G\x8a\x85\x07\xf5\xb7]\xde\xd82\x03\xa6\x0cIR4L@\xc4\xdb%\x9e1\x1frc\x0eskL\xf5\x8e'\xc4\xca"
keylabel = 'P-256', rs = 4155227212, version = 'aes128gcm'
...
try:
for i in list(range(0, len(content), chunk)):
data = decrypt_record(key_, nonce_, counter, content[i : i + chunk])
if version == "aes128gcm":
last = (i + chunk) >= len(content)
result += unpad(data, last)
else:
result += unpad_legacy(data)
counter += 1
except InvalidTag as ex:
> raise ECEException(f"Decryption error: {ex!r}")
E http_ece.ECEException: Decryption error: InvalidTag()
venv/lib/python3.14/site-packages/http_ece/__init__.py:307: ECEException
and
TestNode.test_encrypt
> assert b64d(data[outp]) == result
E AssertionError: assert b')\x95\xc7\x...\xbd\xf0\x00>' == b'\x16Y\xbe<\...1\xe6\xf2\x9b'
E
E At index 0 diff: b')' != b'\x16'
E
E Full diff:
E + (b')\x95\xc7\x8a\xbe\xf1W\x15\x102L!\x7f\xe2\x17\x9f\xf7\xab\xbcL'
E + b'\xa3\xc6\xa1\x90m\r\xabP\xbe\x99&\xdb\xb1>\xfa>\xdb\xf4\x94\xa3\x03~\xbc\x91'
E + b'k5f\xcb0\x13\x83\x93\xb2\xfc\xad\x15\xe4\x05\xb6\xc1S\xe1\x94W]u\xec\x1c'...
E
E ...Full output truncated (87 lines hidden), use '-vv' to show
http_ece/tests/test_ece.py:475: AssertionError
(Perhaps and endian error?)
- Linguagem predominante
- JavaScript
- Estrelas
- 36
- Forks
- 26
- Merge médio
- 15min
- PRs com merge (30d)
- 1
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de web-push-libs/encrypted-content-encoding
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 48/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 42/100
-
feat(python): use secrets moduleTalvez já em andamento @Rotzbua assumiu há 22 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 54/100
web-push-libs/encrypted-content-encoding#97 · 2 comentários ·
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
web-push-libs/encrypted-content-encoding#80 · 1 reação ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 32/100
Todas as issues de web-push-libs/encrypted-content-encoding
Issues semelhantes
-
area/frontend good first issue topic/intents
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
aws-samples/sample-collaborative-ai-dlc#1049 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 80/100
avniproject/avni-client#2268 ·
-
plugins/dsh: todayStr() computes UTC but is documented as local — journal entries written 00:00–08:00 local land in the previous day's fileTalvez já em andamento @Beehtrix assumiu hoje. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
zilliztech/memsearch#907 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
we-promise/sure#6115 ·
Mantenedores costumam responder em até 1 dia
-
withImplementation leaves the temporary mock installed when its callback throws or rejectsTalvez já em andamento @Cynnamoroll assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 10 dias