test: add AWS XKS CI test against remote server - #1114
Open
p0wline wants to merge 14 commits into
Open
Conversation
- New script .mise/scripts/test/test_xks_remote.sh: provisions keys via XKS API and runs the vendored curl test suite against the persistent server at aws-xks-kms.cosmian.dev (no build, no local server). - New MISE task test:xks-remote delegating to that script. - New workflow .github/workflows/test_xks_remote.yml: triggered on push to develop/main/xks branches, PRs, and daily schedule; uses concurrency group to prevent parallel runs; reads SigV4 creds from secrets. - nix_helpers.sh: propagate KMS_XKS_* env vars through nix-shell re-entry.
test_data now points to fix/xks-config-env-override (d02f52e) which
uses ${VAR:-default} in config.sh — no runtime patching needed.
After Cosmian/test_data#13 is merged, update submodule to develop HEAD.
The remote test server persists keys across CI runs. On the old server (<=5.26.0), grant_access is skipped when the key already exists, so Alice and [aws-xks-service] may lose Encrypt/Decrypt/GetAttributes permissions between runs. Add grant_xks_access (idempotent re-grant) and update revoke_xks_op to target both identities so that encrypt-only/decrypt-only restriction tests work regardless of which server version is deployed.
The /access/grant endpoint deserializes operation_types with serde rename_all lowercase: the valid value is 'getattributes', not 'get_attributes'. The previous commit silently got HTTP 400 on every grant call, so Alice's permissions were never applied. Also capture and log the grant response so future failures are visible.
…ver before tests - Upgrade scratchstack-aws-signature 0.10→0.11 (removes ring 0.16.x dep, RUSTSEC-2025-0009/0010). API redesign: replace sigv4_verify + SigningKey with sigv4_validate_request + SigningKeyService implementing tower_service::Service. - Remove RUSTSEC-2025-0009/0010 from deny.toml and .cargo/audit.toml. - Add tower-service = "0.3" direct dep to crate/server. - test_xks_remote.yml: build non-fips release binary, deploy via SSH before tests. Remove daily schedule (CI now owns deployment). - Add deploy_xks_remote.sh: SSH deploy + systemctl restart + readiness wait. - Update log-reference.md for renamed SigV4 log variable. - lychee.toml: exclude ibm.com (503) and sekretz.com (SSL mismatch).
…dule KSecretKey::from_str in scratchstack 0.11 only accepts keys of exactly M-4 chars (default M=44 → 40 chars). XKS spec allows 43-64 chars and the CI key is longer, causing AuthenticationFailedException: Key too long. Derive the SigV4 signing key manually via hmac+sha2 to bypass the length restriction. KSigningKey has no public constructor from raw bytes, so transmute is used with a documented safety justification. Also rebase test_data/fix/xks-config-env-override onto develop to bring in the spire test data directory, fixing the CI spire test failure.
p0wline
force-pushed
the
feat/ci-xks-remote
branch
from
August 14, 2026 14:06
32abf5e to
043c5da
Compare
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.
Context
Before this PR, XKS tests only ran locally against a mock server. There was no way to catch regressions in the full AWS integration path.
What this PR does
1. scratchstack 0.10 → 0.11 migration
The SigV4 verification library rejected secret keys longer than 43 characters. Version 0.11 removes that restriction, which was blocking the real AWS infrastructure (key was 52 chars).
2. CI workflow
.github/workflows/test_xks_remote.ymlOn every PR and push:
non-fipsrelease binaryaws-xks-kms.cosmian.dev) via SSHaws_xks_kek,encrypt_only_key,decrypt_only_key), enforces usage restrictions (encrypt-only / decrypt-only), then runs the vendored AWS XKS curl test suite directly against the server using SigV4 — no AWS KMS involvedaws kms encrypt/aws kms decryptvia the real AWS KMS API, which routes through the configured external key store to our proxy — verifies the full chain from AWS to Cosmian KMS and back3. Cherry-pick of
a14031598(fix: create a dedicated AWS-XKS user)Pulled in from your
fix/xks_permissionsbranch. The server now uses the reserved identity[aws-xks-service]for all XKS operations instead ofawsPrincipalArnfrom the request body. This is required for the end-to-end test to work: when AWS KMS calls the proxy, the injected ARN varies per caller, but[aws-xks-service]gets a single permanent grant at startup on every XKS key.4.
test_datasubmodule updatePoints to
fix/xks-config-env-overridewhich fixesconfig.shto respect env vars (see test_data PR #13). Without this, the vendored test suite ignored the SigV4 credentials injected by the CI workflow.5.
lychee.tomlAdded
kms\.example\.comandkms\.different\.comto the link-checker exclusions — these are fictional hostnames used in unit tests insidestart_kms_server.rsand were causing lychee to fail on every commit.Required GitHub secrets (repo Cosmian/kms)
AWS_XKS_ACCESS_KEY_IDaws kms encrypt/decrypt(xks-test user)AWS_XKS_SECRET_ACCESS_KEYAWS_XKS_KEY_ARNKMS_XKS_SIGV4_ACCESS_KEY_IDKMS_XKS_SIGV4_SECRET_ACCESS_KEYKMS_XKS_SSH_PRIVATE_KEYKMS_XKS_SSH_KNOWN_HOSTSaws-xks-kms.cosmian.devKMS_XKS_SSH_USER