Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .duvet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
reports/
requirements/
specification/
33 changes: 33 additions & 0 deletions .duvet/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'$schema' = "https://awslabs.github.io/duvet/config/v0.4.0.json"

[[source]]
pattern = "src/**/*.py"
type = "implementation"
comment-style = { meta = "##=", content = "##%" }
[[source]]
pattern = "test/**/*.py"
type = "test"
comment-style = { meta = "##=", content = "##%" }

# Include required specifications here
[[specification]]
source = "specification/s3-encryption/client.md"
[[specification]]
source = "specification/s3-encryption/decryption.md"
[[specification]]
source = "specification/s3-encryption/encryption.md"
[[specification]]
source = "specification/s3-encryption/key-commitment.md"
[[specification]]
source = "specification/s3-encryption/key-derivation.md"
[[specification]]
source = "specification/s3-encryption/data-format/content-metadata.md"
[[specification]]
source = "specification/s3-encryption/data-format/metadata-strategy.md"

[report.html]
enabled = true

# Enable snapshots to prevent requirement coverage regressions
[report.snapshot]
enabled = false
9 changes: 9 additions & 0 deletions .github/workflows/all-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ jobs:
python-version: ${{ inputs.python-version || '3.11' }}
secrets: inherit

run-duvet:
permissions:
id-token: write
contents: read
pages: write
name: Run Duvet
uses: ./.github/workflows/duvet.yml
secrets: inherit

run-duvet-test-server:
permissions:
id-token: write
Expand Down
37 changes: 27 additions & 10 deletions .github/workflows/duvet-test-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,31 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
submodules: true
token: ${{ secrets.PAT_FOR_SPEC }}

# There are a lot of submodules here
# This initializes the checkouts in parallel (--jobs)
# rather than in series the way actions/checkout@v5 does it.

- name: Get CPU count
id: cpu-count
run: echo "count=$(node -p 'require("os").cpus().length')" >> $GITHUB_OUTPUT

- name: Setup git submodules with PAT
run: |
git config --global url."https://github.com/".insteadOf "git@github.com:"
git config --global credential.helper store
echo "https://x-token-auth:${{ secrets.PAT_FOR_SPEC }}@github.com" > ~/.git-credentials

- name: Optimize git for performance
run: |
git config --global fetch.parallel ${{ steps.cpu-count.outputs.count }}
git config --global submodule.fetchJobs ${{ steps.cpu-count.outputs.count }}
git config --global remote.origin.tagOpt --no-tags

- name: Checkout submodules with --jobs
run: |
git submodule update --init --depth 1 --single-branch --jobs ${{ steps.cpu-count.outputs.count }} test-server/


- name: Checkout CPP code cpp-v3
uses: actions/checkout@v5
Expand All @@ -32,14 +54,9 @@ jobs:
with:
toolchain: stable

- name: Clone duvet repository
run: git clone https://github.com/awslabs/duvet.git /tmp/duvet

- name: Build and install duvet
run: |
cd /tmp/duvet
cargo xtask build
cargo install --path ./duvet
cargo install duvet --locked

- name: Run duvet
if: always()
Expand All @@ -49,7 +66,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: reports
name: test-server-reports
include-hidden-files: true
path: test-server/*-server/.duvet/reports/report.html

Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/duvet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: duvet on the local S3EC-Python

on:
workflow_call:
# Optional inputs that can be provided when calling this workflow

jobs:
test:
runs-on: ubuntu-slim
permissions:
id-token: write
contents: read
pages: write

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Checkout specific specification
run: git submodule update --init --recursive specification

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Install duvet
run: |
cargo install duvet --locked

- name: Run duvet
run: make duvet

- name: Upload duvet reports
uses: actions/upload-artifact@v4
with:
name: reports
include-hidden-files: true
path: .duvet/reports/report.html

2 changes: 1 addition & 1 deletion .github/workflows/test-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- name: Checkout submodules with --jobs
run: |
git submodule update --init --depth 1 --single-branch --jobs ${{ steps.cpu-count.outputs.count }}
git submodule update --init --depth 1 --single-branch --jobs ${{ steps.cpu-count.outputs.count }} test-server/

- name: Update cpp submodules recursively with --jobs
run: |
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@
path = test-server/cpp-v3-server/aws-sdk-cpp
url = git@github.com:aws/aws-sdk-cpp.git
branch = main
[submodule "specification"]
path = specification
url = https://github.com/awslabs/aws-encryption-sdk-specification.git
branch = tonyknap/s3ec-v3.0.1-candidate
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: lint format test test-unit test-integration install

# Default target
all: lint test
all: lint test duvet

# Install dependencies
install:
Expand Down Expand Up @@ -37,3 +37,13 @@ clean:
find . -type d -name .pytest_cache -exec rm -rf {} +
find . -type d -name .coverage -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
rm -rf .duvet/reports/ .duvet/requirements/

duvet: | clean duvet-report

duvet-report:
duvet report

duvet-view-report-mac:
open .duvet/reports/report.html

1 change: 1 addition & 0 deletions specification
Submodule specification added at 7edabc
7 changes: 7 additions & 0 deletions src/s3_encryption/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ def decrypt(self, response, encryption_context=None):
# Get decryption materials from the crypto materials manager
dec_materials = self.cmm.decrypt_materials(dec_materials)

##= specification/s3-encryption/decryption.md#cbc-decryption
##= type=TODO
##% If an object is encrypted with ALG_AES_256_CBC_IV16_NO_KDF and
##% [legacy unauthenticated algorithm suites](#legacy-decryption) is NOT enabled,
##% the S3EC MUST throw an error which details that client was
##% not configured to decrypt objects with ALG_AES_256_CBC_IV16_NO_KDF.

aesgcm = AESGCM(dec_materials.plaintext_data_key)

return aesgcm.decrypt(nonce=iv_bytes, data=encrypted_data, associated_data=None)
Loading