Repository navigation
Unify the AWS example with CloudFront and durable Edge Cookie storage #1540
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
Open
ChristianPavilonis
wants to merge
19
commits into
baseline/native-runtime-20261110
from
baseline/aws-examples-20261110
+3,345
−27
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
121ebcc
Keep sanitized AWS workload and DynamoDB examples separate from deplo…
ChristianPavilonis b67ffc6
Carry baseline check corrections into the next review unit
ChristianPavilonis 8985b11
Carry the docs-only site correction into the next baseline unit
ChristianPavilonis 9356c55
Carry the startup probe correction through the compatible baseline
ChristianPavilonis ee7f68f
Carry the browser CI host compatibility fix through the baseline
ChristianPavilonis 1636641
Carry the tagged EdgeZero snapshot through the stack
ChristianPavilonis a2edf24
Carry the monthly EdgeZero tag through the stack
ChristianPavilonis 1d3f3dd
Retain sanitized AWS references behind their closed qualification gates
ChristianPavilonis 661a311
Retain runtime-appropriate acceptance fixture storage
ChristianPavilonis 340f7c3
Retain current main validation and mediator fallback
ChristianPavilonis 1fd4b67
Retain the Cargo target-aware cache harness
ChristianPavilonis 9742add
Retain runtime-specific CLI smoke fixture coverage
ChristianPavilonis b4baa0b
Retain target-aware GPT bundle lookup for the cache fixture
ChristianPavilonis e63d6c7
Carry hosted qualification fixes through PR 1540
ChristianPavilonis e14b7e6
Carry hosted qualification fixes through PR 1540
ChristianPavilonis 20b576a
Carry hosted qualification fixes through PR 1540
ChristianPavilonis 1451e38
Carry hosted qualification fixes through PR 1540
ChristianPavilonis eb6e19e
Carry hosted qualification fixes through PR 1540
ChristianPavilonis db1ba33
Combine the AWS example with protected ingress and durable EC
ChristianPavilonis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: Native AWS deployment example | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'deploy/examples/native-aws-workload/**' | ||
|
ChristianPavilonis marked this conversation as resolved.
Resolved
|
||
| - '.tool-versions' | ||
| - '.github/workflows/native-aws-workload.yml' | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'deploy/examples/native-aws-workload/**' | ||
| - '.tool-versions' | ||
| - '.github/workflows/native-aws-workload.yml' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| offline-checks: | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 15 | ||
| env: | ||
| AWS_EC2_METADATA_DISABLED: 'true' | ||
| TF_IN_AUTOMATION: 'true' | ||
| CHECKPOINT_DISABLE: '1' | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Read pinned tooling | ||
| id: versions | ||
| run: | | ||
| terraform=$(awk '$1 == "terraform" { print $2 }' .tool-versions) | ||
| node=$(awk '$1 == "nodejs" { print $2 }' .tool-versions) | ||
| test -n "$terraform" | ||
| test -n "$node" | ||
| printf 'terraform=%s\nnode=%s\n' "$terraform" "$node" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | ||
| with: | ||
| node-version: ${{ steps.versions.outputs.node }} | ||
|
|
||
| - uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3 | ||
| with: | ||
| terraform_version: ${{ steps.versions.outputs.terraform }} | ||
| terraform_wrapper: false | ||
|
|
||
| - name: Check the offline workflow contract | ||
| run: node --test deploy/examples/native-aws-workload/test-workflow.mjs | ||
|
|
||
| - name: Validate schema and credential-free mock plans | ||
| run: | | ||
| terraform -chdir=deploy/examples/native-aws-workload fmt -check -recursive | ||
| terraform -chdir=deploy/examples/native-aws-workload init -backend=false -input=false -lockfile=readonly | ||
| terraform -chdir=deploy/examples/native-aws-workload validate | ||
| terraform -chdir=deploy/examples/native-aws-workload/retained init -backend=false -input=false -lockfile=readonly | ||
| terraform -chdir=deploy/examples/native-aws-workload/retained validate | ||
| env -u NODE_OPTIONS -u NODE_PATH node deploy/examples/native-aws-workload/test-draft.mjs | ||
| git diff --exit-code -- deploy/examples/native-aws-workload/.terraform.lock.hcl deploy/examples/native-aws-workload/retained/.terraform.lock.hcl | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| //! Verify the committed AWS examples through the native runtime config loader. | ||
|
|
||
| #![cfg(not(target_arch = "wasm32"))] | ||
|
|
||
| use std::collections::BTreeSet; | ||
|
|
||
| use error_stack::Report; | ||
| use trusted_server_core::config_payload::VerifiedConfigBlob; | ||
| use trusted_server_core::ec::storage::{EcRuntime, EcStorageSelection}; | ||
| use trusted_server_core::platform::{PlatformError, PlatformSecretStore, StoreId, StoreName}; | ||
|
|
||
| const ENVELOPES: [(&str, &str); 2] = [ | ||
| ( | ||
| "default", | ||
| include_str!("../../../deploy/examples/native-aws-workload/example-envelope.json"), | ||
| ), | ||
| ( | ||
| "noindex", | ||
| include_str!("../../../deploy/examples/native-aws-workload/example-noindex-envelope.json"), | ||
| ), | ||
| ]; | ||
|
|
||
| struct FictionalSecrets; | ||
|
|
||
| #[async_trait::async_trait(?Send)] | ||
| impl PlatformSecretStore for FictionalSecrets { | ||
| fn get_bytes( | ||
| &self, | ||
| store_name: &StoreName, | ||
| key: &str, | ||
| ) -> Result<Vec<u8>, Report<PlatformError>> { | ||
| if store_name.as_ref() != "trusted_server_secrets" { | ||
| return Err(Report::new(PlatformError::SecretStore)); | ||
| } | ||
| let value = match key { | ||
| "handler_password" => "fictional-reviewer-password", | ||
| "publisher_proxy_secret" => "fictional-publisher-proxy-secret-32-bytes", | ||
| "ec_passphrase" => "fictional-ec-passphrase-at-least-32-bytes", | ||
| _ => return Err(Report::new(PlatformError::SecretStore)), | ||
| }; | ||
| Ok(value.as_bytes().to_vec()) | ||
| } | ||
|
|
||
| async fn create( | ||
| &self, | ||
| _store_id: &StoreId, | ||
| _name: &str, | ||
| _value: &str, | ||
| ) -> Result<(), Report<PlatformError>> { | ||
| Err(Report::new(PlatformError::SecretStore)) | ||
| } | ||
|
|
||
| async fn delete(&self, _store_id: &StoreId, _name: &str) -> Result<(), Report<PlatformError>> { | ||
| Err(Report::new(PlatformError::SecretStore)) | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn committed_aws_envelopes_pass_runtime_integrity_and_settings_validation() { | ||
| let expected_keys = BTreeSet::from([ | ||
| "handler_password".to_owned(), | ||
| "publisher_proxy_secret".to_owned(), | ||
| "ec_passphrase".to_owned(), | ||
| ]); | ||
| for (name, envelope) in ENVELOPES { | ||
| let blob = VerifiedConfigBlob::parse(envelope) | ||
| .unwrap_or_else(|error| panic!("should verify {name} envelope: {error:?}")); | ||
| assert_eq!( | ||
| blob.required_secret_keys() | ||
| .expect("should collect reference-only secret keys"), | ||
| expected_keys, | ||
| "should resolve only the three declared application secrets for {name}" | ||
| ); | ||
| let settings = blob | ||
| .into_settings( | ||
| &FictionalSecrets, | ||
| &StoreName::from("trusted_server_secrets"), | ||
| ) | ||
| .unwrap_or_else(|error| panic!("should validate {name} settings: {error:?}")); | ||
| assert_eq!( | ||
| settings.publisher.domain, "publisher.example.com", | ||
| "should preserve the operator-configurable publisher fixture" | ||
| ); | ||
| assert_eq!( | ||
| settings.publisher.proxy_secret.expose(), | ||
| "fictional-publisher-proxy-secret-32-bytes", | ||
| "should resolve the proxy reference without using a real provider" | ||
| ); | ||
| let Some(EcStorageSelection::DynamoDb(storage)) = settings | ||
| .ec | ||
| .resolve_storage(EcRuntime::Native) | ||
| .expect("should resolve native EC storage") | ||
| else { | ||
| panic!("should select DynamoDB for the {name} AWS envelope"); | ||
| }; | ||
| assert_eq!( | ||
| storage.region, "eu-west-2", | ||
| "should use the retained region" | ||
| ); | ||
| assert_eq!( | ||
| storage.table, "example-retained-ec", | ||
| "should select the retained table" | ||
| ); | ||
| assert_eq!( | ||
| storage.namespace, "example-staging", | ||
| "should preserve the stable retained namespace" | ||
| ); | ||
| assert!( | ||
| storage.local_endpoint.is_none(), | ||
| "should not publish a local emulator endpoint" | ||
| ); | ||
| assert_eq!( | ||
| settings | ||
| .response_headers | ||
| .get("X-Robots-Tag") | ||
| .map(String::as_str), | ||
| (name == "noindex").then_some("noindex"), | ||
| "should preserve the optional noindex configuration" | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn rewriting_cli_float_tokens_invalidates_the_aws_envelopes() { | ||
| for (name, envelope) in ENVELOPES { | ||
| let rewritten = | ||
| envelope.replacen("\"access_sample_rate\":0.0", "\"access_sample_rate\":0", 1); | ||
| assert_ne!( | ||
| rewritten, envelope, | ||
| "should exercise the original float-to-integer regression for {name}" | ||
| ); | ||
| let error = VerifiedConfigBlob::parse(&rewritten) | ||
| .err() | ||
| .expect("should reject numeric normalization after CLI publication"); | ||
| assert!( | ||
| error.to_string().contains("integrity verification"), | ||
| "should detect rewritten {name} config before startup: {error:?}" | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn tampered_aws_envelopes_fail_runtime_integrity_verification() { | ||
| for (name, envelope) in ENVELOPES { | ||
| let mut tampered: serde_json::Value = | ||
| serde_json::from_str(envelope).expect("should parse the committed envelope"); | ||
| tampered["data"]["publisher"]["domain"] = | ||
| serde_json::json!("different.publisher.example.com"); | ||
| let tampered = | ||
| serde_json::to_string(&tampered).expect("should serialize the tampered envelope"); | ||
| let error = VerifiedConfigBlob::parse(&tampered) | ||
| .err() | ||
| .expect("should reject a data change without a matching checksum"); | ||
| assert!( | ||
| error.to_string().contains("integrity verification"), | ||
| "should reject tampered {name} through the runtime integrity check: {error:?}" | ||
| ); | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| .terraform/ | ||
| *.tfstate | ||
| *.tfstate.* | ||
| *.tfplan | ||
| *.tfvars | ||
| *.tfvars.json | ||
| *.auto.tfvars | ||
| *.auto.tfvars.json | ||
| *.backend.hcl | ||
| crash.log | ||
| crash.*.log | ||
| .terraform.tfstate.lock.info |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.