aws / aws/aws-dynamodb-encryption-python

Upgrading "Do Nothing" model to one with a single action fails to decrypt old items

オープン
#177 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Python
スター
95
フォーク
57
PR マージ指標
30日以内にマージされた PR はありません

説明

### Problem:

According to our documentation it should always be possible to add new attributes to our model without issue: https://docs.aws.amazon.com/dynamodb-encryption-client/latest/devguide/data-model.html#add-attribute

However, if you start with data encrypted using
```
actions = AttributeActions(
default_action=CryptoAction.DO_NOTHING
)
```

And update to using
```
actions = AttributeActions(
default_action=CryptoAction.DO_NOTHING, attribute_actions={"someNewField": CryptoAction.ENCRYPT_AND_SIGN}
)
```

You run into issues. This is because data under the first model doesn't have a material description or signature written with it. Once the model is updated to include an action other than `DO_NOTHING`, it always expects there to be a material description and signature, *even if the record it's attempting to decrypt doesn't include `someNewField` yet*.

### Solution:

We should probably update the logic here to also pass through if the item under decrypt specifically doesn't have attributes where encryption or signing is needed, even if the attributeActions includes an encrypt or sign action for a non-present field.

https://github.com/aws/aws-dynamodb-encryption-python/blob/25c7c3d80bfbe0deb661b4beb86f61b8b2f8545e/src/dynamodb_encryption_sdk/encrypted/item.py#L176-L178

https://github.com/aws/aws-dynamodb-encryption-python/blob/25c7c3d80bfbe0deb661b4beb86f61b8b2f8545e/src/dynamodb_encryption_sdk/structures.py#L137-L148

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

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

調査の方向性

src/dynamodb_encryption_sdk/encrypted/item.py の 176~178 行付近と、src/dynamodb_encryption_sdk/structures.py の 137~148 行付近から始めます。DO_NOTHING のみを使用する AttributeActions モデルから、someNewField に ENCRYPT_AND_SIGN を追加するモデルへの移行を再現し、その後、そのフィールドがない古い項目の復号を追跡します。更新後のモデルでも、暗号化または署名が必要な属性を持たない古い項目を復号できれば完了です。

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

評価

技術スタック
python
領域
security
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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