Skip to content

Commit e91838f

Browse files
Shubham ChaturvediShubham Chaturvediseebees
authored
fix: Use FORBID_ENCRYPT_ALLOW_DECRYPT policy for decrypt oracle (aws#538)
* fix: Use FORBID_ENCRYPT_ALLOW_DECRYPT policy for decrypt oracle * fix: pin tox version < 4.0 * Update decrypt_oracle/src/aws_encryption_sdk_decrypt_oracle/app.py Co-authored-by: seebees <[email protected]> * fix: change forward-slashes to pound for comment * fix: linting issue - ran autoformatter Co-authored-by: Shubham Chaturvedi <[email protected]> Co-authored-by: seebees <[email protected]>
1 parent 2822364 commit e91838f

19 files changed

+23
-20
lines changed

codebuild/coverage/coverage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ phases:
1010
python: latest
1111
build:
1212
commands:
13-
- pip install tox
13+
- pip install "tox < 4.0"
1414
- tox

codebuild/py310/awses_local.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ phases:
2222
commands:
2323
- pyenv install 3.10.0
2424
- pyenv local 3.10.0
25-
- pip install tox tox-pyenv
25+
- pip install "tox < 4.0"
2626
- cd test_vector_handlers
2727
- tox

codebuild/py310/examples.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ phases:
2020
commands:
2121
- pyenv install 3.10.0
2222
- pyenv local 3.10.0
23-
- pip install tox tox-pyenv
23+
- pip install "tox < 4.0"
2424
- tox

codebuild/py310/integ.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ phases:
2020
commands:
2121
- pyenv install 3.10.0
2222
- pyenv local 3.10.0
23-
- pip install tox tox-pyenv
23+
- pip install "tox < 4.0"
2424
- tox

codebuild/py37/awses_local.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ phases:
2222
commands:
2323
- pyenv install 3.7.12
2424
- pyenv local 3.7.12
25-
- pip install tox tox-pyenv
25+
- pip install "tox < 4.0"
2626
- cd test_vector_handlers
2727
- tox

codebuild/py37/examples.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ phases:
2020
commands:
2121
- pyenv install 3.7.12
2222
- pyenv local 3.7.12
23-
- pip install tox tox-pyenv
23+
- pip install "tox < 4.0"
2424
- tox

codebuild/py37/integ.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ phases:
2020
commands:
2121
- pyenv install 3.7.12
2222
- pyenv local 3.7.12
23-
- pip install tox tox-pyenv
23+
- pip install "tox < 4.0"
2424
- tox

codebuild/py38/awses_local.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ phases:
2222
commands:
2323
- pyenv install 3.8.12
2424
- pyenv local 3.8.12
25-
- pip install tox tox-pyenv
25+
- pip install "tox < 4.0"
2626
- cd test_vector_handlers
2727
- tox

codebuild/py38/examples.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ phases:
2020
commands:
2121
- pyenv install 3.8.12
2222
- pyenv local 3.8.12
23-
- pip install tox tox-pyenv
23+
- pip install "tox < 4.0"
2424
- tox

codebuild/py38/integ.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ phases:
2020
commands:
2121
- pyenv install 3.8.12
2222
- pyenv local 3.8.12
23-
- pip install tox tox-pyenv
23+
- pip install "tox < 4.0"
2424
- tox

codebuild/py39/awses_1.7.1.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ phases:
2222
commands:
2323
- pyenv install 3.9.7
2424
- pyenv local 3.9.7
25-
- pip install tox tox-pyenv
25+
- pip install "tox < 4.0"
2626
- cd test_vector_handlers
2727
- tox

codebuild/py39/awses_2.0.0.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ phases:
2222
commands:
2323
- pyenv install 3.9.7
2424
- pyenv local 3.9.7
25-
- pip install tox tox-pyenv
25+
- pip install "tox < 4.0"
2626
- cd test_vector_handlers
2727
- tox

codebuild/py39/awses_latest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ phases:
2222
commands:
2323
- pyenv install 3.9.7
2424
- pyenv local 3.9.7
25-
- pip install tox tox-pyenv
25+
- pip install "tox < 4.0"
2626
- cd test_vector_handlers
2727
- tox

codebuild/py39/examples.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ phases:
2020
commands:
2121
- pyenv install 3.9.7
2222
- pyenv local 3.9.7
23-
- pip install tox tox-pyenv
23+
- pip install "tox < 4.0"
2424
- tox

codebuild/py39/integ.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ phases:
2020
commands:
2121
- pyenv install 3.9.7
2222
- pyenv local 3.9.7
23-
- pip install tox tox-pyenv
23+
- pip install "tox < 4.0"
2424
- tox

codebuild/release/prod-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010
phases:
1111
install:
1212
commands:
13-
- pip install tox
13+
- pip install "tox < 4.0"
1414
- pip install --upgrade pip
1515
runtime-versions:
1616
python: latest

codebuild/release/test-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010
phases:
1111
install:
1212
commands:
13-
- pip install tox
13+
- pip install "tox < 4.0"
1414
- pip install --upgrade pip
1515
runtime-versions:
1616
python: latest

codebuild/release/validate.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 0.2
33
phases:
44
install:
55
commands:
6-
- pip install tox
6+
- pip install "tox < 4.0"
77
runtime-versions:
88
python: latest
99
pre_build:
@@ -13,7 +13,7 @@ phases:
1313
- sed -i "s/aws_encryption_sdk/aws_encryption_sdk==$VERSION/" requirements-dev.txt
1414
- pyenv install 3.8.12
1515
- pyenv local 3.8.12
16-
- pip install tox tox-pyenv
16+
- pip install "tox < 4.0"
1717
build:
1818
commands:
1919
- NUM_RETRIES=3

decrypt_oracle/src/aws_encryption_sdk_decrypt_oracle/app.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import os
1717

1818
import aws_encryption_sdk
19+
from aws_encryption_sdk.identifiers import CommitmentPolicy
1920
from aws_encryption_sdk.key_providers.kms import DiscoveryAwsKmsMasterKeyProvider
2021
from chalice import Chalice, Response
2122

@@ -59,7 +60,9 @@ def basic_decrypt() -> Response:
5960
APP.log.debug(APP.current_request.raw_body)
6061

6162
try:
62-
client = aws_encryption_sdk.EncryptionSDKClient()
63+
# The decrypt oracle needs to be able to decrypt any message
64+
# it does not encrypt messages for anyone.
65+
client = aws_encryption_sdk.EncryptionSDKClient(commitment_policy=CommitmentPolicy.FORBID_ENCRYPT_ALLOW_DECRYPT)
6366
ciphertext = APP.current_request.raw_body
6467
plaintext, _header = client.decrypt(source=ciphertext, key_provider=_master_key_provider())
6568
APP.log.debug("Plaintext:")

0 commit comments

Comments
 (0)