aws / aws/aws-dynamodb-encryption-python
Upgrading "Do Nothing" model to one with a single action fails to decrypt old items
- Ngôn ngữ chính
- Python
- Star
- 95
- Fork
- 57
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### 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
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu tại src/dynamodb_encryption_sdk/encrypted/item.py quanh các dòng 176-178 và src/dynamodb_encryption_sdk/structures.py quanh các dòng 137-148. Tái hiện quá trình chuyển đổi từ mô hình AttributeActions chỉ có DO_NOTHING sang mô hình thêm ENCRYPT_AND_SIGN cho someNewField, sau đó theo dõi quá trình giải mã một item cũ không có trường đó. Hoàn thành khi các item cũ không có thuộc tính yêu cầu mã hóa hoặc ký vẫn có thể được giải mã bằng mô hình đã cập nhậ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ệ
- python
- Lĩnh vực
- security
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100