aws / aws/aws-dynamodb-encryption-python

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

Ouverte
#177 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
Python
Étoiles
95
Forks
57
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez dans src/dynamodb_encryption_sdk/encrypted/item.py autour des lignes 176-178 et dans src/dynamodb_encryption_sdk/structures.py autour des lignes 137-148. Reproduisez la transition d’un modèle AttributeActions utilisant uniquement DO_NOTHING vers un modèle ajoutant ENCRYPT_AND_SIGN pour someNewField, puis suivez le déchiffrement d’un ancien élément sans ce champ. C’est terminé lorsque les anciens éléments sans attributs nécessitant un chiffrement ou une signature peuvent toujours être déchiffrés avec le modèle mis à jour.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
security
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.