aws / aws/aws-encryption-sdk-javascript
Return friendly error if input is Base64 encoded
- Lenguaje dominante
- TypeScript
- Estrellas
- 260
- Forks
- 68
- Merge medio
- 22 h 19 min
- PR fusionados (30 d)
- 2
Descripción
### 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/ )
Guía de contribución
Línea de trabajo
Comienza en modules/serialize/src/deserialize_factory.ts y compara después el manejo del primer byte en deserialize_header_v1.ts y deserialize_header_v2.ts. Sigue la rama actual de selección de versión y verifica que la entrada codificada en Base64 produzca un error claro antes de la selección de la versión de deserialización; confirma que las pruebas de serialización pertinentes pasan.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 42/100