aws / aws/aws-encryption-sdk-javascript

Return friendly error if input is Base64 encoded

Aperta
#630 1 commento 2 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
TypeScript
Stelle
260
Fork
68
Merge medio
22h 19m
PR unite (30g)
2

Descrizione

### Problem:

We have some code that intends to return a friendly error if the first byte is base64 encoded:
- https://github.com/aws/aws-encryption-sdk-javascript/blob/43813f463ef6c53bd4de1963e7843b56733d1bec/modules/serialize/src/deserialize_header_v1.ts#L88-L93
- https://github.com/aws/aws-encryption-sdk-javascript/blob/43813f463ef6c53bd4de1963e7843b56733d1bec/modules/serialize/src/deserialize_header_v2.ts#L92-L96

However we can't ever get inside those statements because we first do a check at: https://github.com/aws/aws-encryption-sdk-javascript/blob/43813f463ef6c53bd4de1963e7843b56733d1bec/modules/serialize/src/deserialize_factory.ts#L74

### Solution:

Move the logic checking the expected first byte in Base64 before the branch that determines which version we're deserializing.

### Out of scope:

n/a

[//]: # (NOTE: If you believe this might be a security issue, please email aws-security@amazon.com instead of creating a GitHub issue. For more details, see the AWS Vulnerability Reporting Guide: https://aws.amazon.com/security/vulnerability-reporting/ )

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da modules/serialize/src/deserialize_factory.ts, quindi confronta la gestione del primo byte in deserialize_header_v1.ts e deserialize_header_v2.ts. Segui il ramo corrente di selezione della versione e verifica che l'input codificato in Base64 raggiunga un errore chiaro prima della selezione della versione di deserializzazione; conferma che i test di serializzazione pertinenti abbiano esito positivo.

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

Valutazione

Stack tecnologico
typescript
Ambito
backend
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.