Add SotoSignerCloudFront module for signed URLs and cookies#696
Open
sebsto wants to merge 2 commits into
Open
Conversation
Implements CloudFront RSA-based signing (PKCS#1 v1.5) as a new dedicated module, separate from SotoSignerV4. Supports canned and custom policies for both signed URLs and signed cookies, with SHA-1 (default) and SHA-256 hash algorithms. New module: SotoSignerCloudFront - CloudFrontSigner struct with Sendable conformance - Canned policy signed URLs and cookies - Custom policy with wildcard resources, IP restrictions, start times - CloudFront-specific base64 encoding - Dual PEM initializers (String + Data) - Comprehensive error handling Tests: 33 unit tests covering all public API methods, edge cases, error conditions, and round-trip signature verification. Verified on both macOS and Linux (swift:amazonlinux2023). Documentation: Swift DocC documentation with usage examples and a complete end-to-end testing guide (SotoCore.docc/SotoSignerCloudFront/Articles/ EndToEndTesting.md) that walks through setting up a real CloudFront distribution and verifying signed URLs against it. Resolves: soto-project#613
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #696 +/- ##
==========================================
+ Coverage 81.13% 81.55% +0.41%
==========================================
Files 91 95 +4
Lines 6580 6718 +138
==========================================
+ Hits 5339 5479 +140
+ Misses 1241 1239 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new
SotoSignerCloudFrontmodule that generates CloudFront signed URLs and signed cookies using RSA PKCS#1 v1.5 signatures. This is a first-class implementation of the signing logic described in the CloudFront developer guide.Closes #613
What's included
SotoSignerCloudFront(separate fromSotoSignerV4— uses_CryptoExtrasfor RSA)Hash-Algorithmparam appended for SHA-256)swift:amazonlinux2023API
Testing
docker run swift:amazonlinux2023)Documentation
Includes Swift DocC documentation:
CloudFrontSignerSotoCore.docc/SotoSignerCloudFront/Articles/EndToEndTesting.md) with copy-pasteable AWS CLI commands to set up a test distribution, generate signed URLs, verify with curl, and clean up all resources