-
Notifications
You must be signed in to change notification settings - Fork 19
chore(duvet): modernize duvet #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
05464c1
cdcd393
d5e5a3c
5a1c06c
afd8c65
cf8ea4f
0142144
8e812f4
7815334
0d1badb
c8da890
4cbfed4
d5d73d4
044e80d
1e10b42
97ff0ca
1f7b084
256218e
28c52c6
b8bec36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| reports/ | ||
| requirements/ | ||
| specification/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| '$schema' = "https://awslabs.github.io/duvet/config/v0.4.0.json" | ||
|
|
||
| [[source]] | ||
| pattern = "src/**/*.java" | ||
|
|
||
| # 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: duvet | ||
|
|
||
| on: | ||
| workflow_call: | ||
| # Optional inputs that can be provided when calling this workflow | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: macos-latest | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| pages: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - name: Setup Rust toolchain | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| 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 | ||
|
|
||
| - 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 | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| [submodule "specification"] | ||
| [submodule "private_aws"] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. procedure: i would like to merge the Spec PR then move this back to public before merging this PR |
||
| path = specification | ||
| url = git@github.com:awslabs/aws-encryption-sdk-specification.git | ||
| url = https://github.com/awslabs/aws-encryption-sdk-specification.git | ||
| branch = tonyknap/s3ec-v3.0.1-candidate | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Duvet Annotation Context | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer not checking this in, |
||
|
|
||
| ## Overview | ||
| Working through incomplete Duvet requirements one at a time to add citations and tests to the codebase. | ||
|
|
||
| ## Key Insights | ||
| - **Duvet syntax**: Only comments with exactly two slashes (`//`) are read by Duvet | ||
| - `//=` for specification links | ||
| - `//#` for requirement descriptions | ||
| - `///` or `////` are NOT read by Duvet (effectively commented out) | ||
| - **Annotation types**: `type=implication`, `type=exception`, `type=test` | ||
| - **Report location**: `.duvet/reports/report.html` | ||
| - **Total requirements**: 198 (178 complete, 20 incomplete as of last run) | ||
|
|
||
| ## Completed Requirements | ||
|
|
||
| ### 1. V1 Format Exclusive Keys | ||
| **Requirement**: "When the object is encrypted using the V1 format, - Mapkeys exclusive to other format versions MUST NOT be present." | ||
|
|
||
| **Citation added**: | ||
| - `MetadataKeyConstants.isV1Format()` at line 73 | ||
| - `ContentMetadataDecodingStrategy.isV1InObjectMetadata()` at line 424 | ||
|
|
||
| **Test**: Already tested via `ContentMetadataStrategyTest.testExclusiveKeysCollision` | ||
|
|
||
| ### 2. V2 Format Tag Length Requirements | ||
| **Requirements**: | ||
| - "If the object is encrypted using AES-GCM for content encryption, then the mapkey 'x-amz-tag-len' MUST be present." | ||
| - "If the object is encrypted using AES-CBC for content encryption, then the mapkey 'x-amz-tag-len' MUST NOT be present." | ||
|
|
||
| **Bug fixed**: Code was incorrectly writing tag length for CBC (should only be for GCM) | ||
|
|
||
| **Citation added**: `ContentMetadataEncodingStrategy.addMetadataToMap()` at line 190 | ||
|
|
||
| **Implementation**: Check `cipherName().contains("GCM")` to determine whether to write tag length | ||
|
|
||
| **Test**: Existing tests validate tag length is written for GCM and read correctly | ||
|
|
||
| ## Commit History | ||
| - `9068c876`: fix(CBC): Add annotations for V1/V2 format requirements and fix CBC tag length bug | ||
|
|
||
| ## Files Modified | ||
| - `src/main/java/software/amazon/encryption/s3/internal/MetadataKeyConstants.java` | ||
| - `src/main/java/software/amazon/encryption/s3/internal/ContentMetadataEncodingStrategy.java` | ||
| - `src/main/java/software/amazon/encryption/s3/internal/ContentMetadataDecodingStrategy.java` | ||
|
|
||
| ## Process for Next Requirements | ||
| 1. User provides incomplete requirement text | ||
| 2. Find where requirement is implemented in code | ||
| 3. Add Duvet annotation at implementation location | ||
| 4. Verify test coverage exists | ||
| 5. Run tests: `mvn clean compile` then `mvn test -Dtest=ContentMetadataStrategyTest,MetadataKeyConstantsTest,CipherProviderTest,AlgorithmSuiteValidationTest` | ||
| 6. Stage and commit changes | ||
|
|
||
| ## Remaining Work | ||
| 18 incomplete requirements remaining (as of last count) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,12 @@ | ||
| # Used for misc supporting functions like Duvet and prettier. Builds, tests, etc. should use the usual Java/Maven tooling. | ||
|
|
||
| duvet: | duvet_extract duvet_report | ||
|
|
||
| duvet_extract: | ||
| rm -rf compliance | ||
| $(foreach file, $(shell find specification/s3-encryption -name '*.md'), duvet extract -o compliance -f MARKDOWN $(file);) | ||
| duvet: | duvet_clean duvet_report | ||
|
|
||
| duvet_report: | ||
| duvet \ | ||
| report \ | ||
| --spec-pattern "compliance/**/*.toml" \ | ||
| --source-pattern "src/**/*.java" \ | ||
| --source-pattern "compliance_exceptions/*.txt" \ | ||
| --html specification_compliance_report.html | ||
| duvet report | ||
|
|
||
| duvet-view-report-mac: | ||
| open .duvet/reports/report.html | ||
|
|
||
| duvet_clean: | ||
| rm -rf .duvet/reports/ .duvet/requirements/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is there a specific spec file we want to ignore? can we just give the glob for
specification/s3-encryption?also nit: i think we're missing Algorithm Suite, but i am also pretty sure that one doesn't contain RFC 2119 words