aws / aws/aws-encryption-sdk-javascript

Return friendly error if input is Base64 encoded

Đang mở
#630 1 bình luận 2 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
TypeScript
Star
260
Fork
68
Merge trung bình
22 giờ 19 phút
Pull request đã merge (30 ngày)
2

Mô tả

### 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/ )

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu trong modules/serialize/src/deserialize_factory.ts, sau đó so sánh cách xử lý byte đầu tiên trong deserialize_header_v1.ts và deserialize_header_v2.ts. Theo dõi nhánh chọn phiên bản hiện tại và xác minh rằng đầu vào được mã hóa Base64 dẫn đến một lỗi dễ hiểu trước khi chọn phiên bản giải tuần tự; xác nhận các bài kiểm thử tuần tự hóa liên quan đều đạt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.