aws / aws/aws-encryption-sdk-javascript

Return friendly error if input is Base64 encoded

オープン
#630 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る
bug
主要言語
TypeScript
スター
260
フォーク
68
平均マージ
22時間 19分
マージ済み PR(30日)
2

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

modules/serialize/src/deserialize_factory.ts から開始し、次に deserialize_header_v1.ts と deserialize_header_v2.ts の先頭バイトの処理を比較します。現在のバージョン選択分岐を追跡し、Base64 エンコードされた入力がデシリアライズバージョンの選択前に分かりやすいエラーになることを確認します。関連するシリアライズテストがパスすることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
backend
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。