forked from secure-systems-lab/securesystemslib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test setup to test AWSSigner locally or on GitHub CI using localstack. **Change details** * Add independent tox environment to init/cleanup localstack, configure ambient AWS KMS credentials, create test keys, and run the test. * Adds aws requirements file with pinned runtime requirements to trigger tox run via Dependabot. Note: test requirements are not included, but defined directly in tox.ini without pinning (we don't really need to trigger of those update). * Adds shell script to generate test keys for all supported schemes in tox setup. * Update AWSSigner tests to match localstack setup. The previous setup looked like it needed manual intervention in order to run. The new tests runs the full Signer API flow -- import (with and without passed scheme), load, sign, verify (pass and fail) -- automatically and for each scheme supported by AWSSigner. * Adds independent GitHub Action workflow to run tox aws test closes secure-systems-lab#612 Signed-off-by: Lukas Puehringer <[email protected]>
- Loading branch information
Showing
5 changed files
with
150 additions
and
57 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Run AWS KMS tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
local-aws-kms: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout securesystemslib | ||
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d | ||
with: | ||
python-version: '3.x' | ||
cache: 'pip' | ||
cache-dependency-path: 'requirements*.txt' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade tox | ||
- name: Run tests | ||
run: tox -e local-aws-kms |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
boto3==1.34.82 | ||
botocore==1.34.82 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Create test keys | ||
awslocal kms create-key \ | ||
--key-spec RSA_4096 \ | ||
--key-usage SIGN_VERIFY | ||
|
||
awslocal kms create-key \ | ||
--key-spec ECC_NIST_P256 \ | ||
--key-usage SIGN_VERIFY | ||
|
||
awslocal kms create-key \ | ||
--key-spec ECC_NIST_P384 \ | ||
--key-usage SIGN_VERIFY | ||
|
||
# Create test keyid aliases ("alias/" prefix is mandatory) | ||
awslocal kms create-alias \ | ||
--alias-name alias/rsa \ | ||
--target-key-id $(awslocal kms list-keys --query "Keys[0].KeyId" --output text) | ||
|
||
awslocal kms create-alias \ | ||
--alias-name alias/ecdsa_nistp256 \ | ||
--target-key-id $(awslocal kms list-keys --query "Keys[1].KeyId" --output text) | ||
|
||
awslocal kms create-alias \ | ||
--alias-name alias/ecdsa_nistp384 \ | ||
--target-key-id $(awslocal kms list-keys --query "Keys[2].KeyId" --output text) |
This file contains 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