diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2ed42fe..a8e84b8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,6 +14,20 @@ on: permissions: {} jobs: + inspect-ses-account: + name: Read-only SES inspection boundaries + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Checkout the proposed source without cloud credentials + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Test the actual inspection scripts with isolated fake AWS reads + run: bash scripts/test-inspect-ses-account.sh + retired-repo-links: name: Retired repository links runs-on: ubuntu-latest @@ -167,7 +181,7 @@ jobs: ci-required-checks: name: CI - Required Checks runs-on: ubuntu-latest - needs: [validate-manifests, validate-crossplane-schemas, retired-repo-links] + needs: [validate-manifests, validate-crossplane-schemas, retired-repo-links, inspect-ses-account] if: always() permissions: actions: read @@ -180,3 +194,4 @@ jobs: ${{ needs.validate-manifests.result }} ${{ needs.validate-crossplane-schemas.result }} ${{ needs.retired-repo-links.result }} + ${{ needs.inspect-ses-account.result }} diff --git a/.github/workflows/inspect-ses-account.yaml b/.github/workflows/inspect-ses-account.yaml new file mode 100644 index 0000000..b94d355 --- /dev/null +++ b/.github/workflows/inspect-ses-account.yaml @@ -0,0 +1,110 @@ +# Read-only counterpart to set-up-ses-account.yaml. It shares the approved +# protected-main identity, restricted further by an inline session policy. +name: Inspect SES Account + +on: + workflow_dispatch: + inputs: + confirm: + description: Type inspect-ses-account to read readiness without changing the account + required: true + type: string + +permissions: {} + +concurrency: + group: inspect-ses-account + cancel-in-progress: false + +jobs: + inspect: + name: Inspect SES readiness without changing settings + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + id-token: write + env: + AWS_REGION: eu-central-1 + ROLE_ARN: arn:aws:iam::939001610192:role/ses-account-setup + EXPECTED_ACCOUNT_ID: "939001610192" + AWS_PAGER: "" + AWS_CLI_AUTO_PROMPT: "off" + AWS_RETRY_MODE: standard + AWS_MAX_ATTEMPTS: "3" + AWS_EC2_METADATA_DISABLED: "true" + AWS_IGNORE_CONFIGURED_ENDPOINT_URLS: "true" + AWS_SHARED_CREDENTIALS_FILE: /dev/null + AWS_CONFIG_FILE: /dev/null + steps: + - name: Require the exact confirmed main workflow + id: guard + shell: bash + env: + CONFIRM: ${{ inputs.confirm }} + run: | + set -euo pipefail + refuse() { printf '%s\n' 'SES_ACCOUNT_INSPECTION=REFUSED' >&2; exit 2; } + if [[ $# != 0 || "$GITHUB_EVENT_NAME" != workflow_dispatch || "$GITHUB_REF" != refs/heads/main || "$GITHUB_REPOSITORY" != devantler-tech/aws || "$GITHUB_WORKFLOW_REF" != devantler-tech/aws/.github/workflows/inspect-ses-account.yaml@refs/heads/main || "$GITHUB_ACTOR" != devantler || "$GITHUB_RUN_ATTEMPT" != 1 || "$RUNNER_ENVIRONMENT" != github-hosted || "$CONFIRM" != inspect-ses-account ]]; then + refuse + fi + jq -e '.inputs | type == "object" and keys == ["confirm"] and .confirm == "inspect-ses-account"' \ + "$GITHUB_EVENT_PATH" >/dev/null 2>&1 || refuse + + - name: Assume the existing identity with an inspection-only session + id: credentials + uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0 + with: + role-to-assume: ${{ env.ROLE_ARN }} + role-session-name: ses-account-inspect-${{ github.run_id }} + aws-region: ${{ env.AWS_REGION }} + role-duration-seconds: 900 + allowed-account-ids: ${{ env.EXPECTED_ACCOUNT_ID }} + mask-aws-account-id: true + unset-current-credentials: true + translate-env-variables: false + output-credentials: false + retry-max-attempts: 3 + action-timeout-s: 90 + inline-session-policy: >- + {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["ses:GetAccount","sts:GetCallerIdentity"],"Resource":"*","Condition":{"StringEquals":{"aws:RequestedRegion":"eu-central-1"}}}]} + + - name: Read and validate only the fixed readiness fields + id: read + shell: bash + run: | + set -euo pipefail + fail() { printf 'SES_ACCOUNT_INSPECTION=UNVERIFIED stage=%s\n' "$1" >&2; exit 2; } + identity=$(aws sts get-caller-identity --region "$AWS_REGION" --output json --no-cli-pager \ + --cli-connect-timeout 10 --cli-read-timeout 20 2>/dev/null) || fail identity + jq -e -s --arg expected "$EXPECTED_ACCOUNT_ID" \ + 'length == 1 and (.[0] | type == "object" and (.Account | type == "string") and .Account == $expected)' \ + <<<"$identity" >/dev/null 2>&1 || fail identity + unset identity + account=$(aws sesv2 get-account --region "$AWS_REGION" --output json --no-cli-pager \ + --cli-connect-timeout 10 --cli-read-timeout 20 2>/dev/null) || fail account + jq -c -e -s ' + def finite: type == "number" and isfinite; + if length != 1 then empty else .[0] | + if type == "object" and + (.ProductionAccessEnabled | type == "boolean") and + (.SendingEnabled | type == "boolean") and + (.EnforcementStatus | IN("HEALTHY", "PROBATION", "SHUTDOWN")) and + (.SendQuota | type == "object" and + (.Max24HourSend | finite and (. >= 0 or . == -1)) and + (.MaxSendRate | finite and . >= 0) and + (.SentLast24Hours | finite and . >= 0)) and + ((has("Details") | not) or (.Details | type == "object" and + ((has("ReviewDetails") | not) or (.ReviewDetails | type == "object" and + ((has("Status") | not) or (.Status | type == "string" and IN("PENDING", "FAILED", "GRANTED", "DENIED"))))))) + then (.Details.ReviewDetails.Status // null) as $review | { + productionAccessEnabled: .ProductionAccessEnabled, + sendingEnabled: .SendingEnabled, + enforcementHealthy: (.EnforcementStatus == "HEALTHY"), + reviewKnown: ($review != null), + reviewPending: ($review == "PENDING"), + max24HourSend: .SendQuota.Max24HourSend, + maxSendRate: .SendQuota.MaxSendRate, + sentLast24Hours: .SendQuota.SentLast24Hours + } else empty end + end + ' <<<"$account" 2>/dev/null || fail metadata diff --git a/README.md b/README.md index 22b50c5..3651919 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,26 @@ Authentication (namespace, `SecretStore`, bootstrap-credential `ExternalSecret`, the `ProviderConfig`) is provisioned platform-side — see [platform#2325](https://github.com/devantler-tech/platform/issues/2325). +## Inspect SES readiness + +The separate [Inspect SES Account workflow](.github/workflows/inspect-ses-account.yaml) +reads the approved account in the fixed sending region after the typed confirmation +`inspect-ses-account`. It runs only from protected `main` as the maintainer, using the existing +identity with a session restricted to identity verification and the SES account read. Its cloud +job checks out no repository code and cannot request production access, change pricing or send mail. +The existing account setup workflow retains its separate purpose and confirmation. + +The receipt contains readiness and review booleans plus numeric quota fields. Missing required +fields, malformed metadata, a failed API call or an unexpected account fail the inspection. +An omitted optional review status yields `reviewKnown: false`; that is not evidence that an earlier +review has finished. Neither a sandbox result nor a pending review authorizes another request. +The read also does not prove an authenticated delivery or inbox placement. + +Run `bash scripts/test-inspect-ses-account.sh` to exercise the actual scripts with synthetic API +responses and no AWS credentials or network calls. This needs Bash, `jq` and Mike Farah's `yq` v4. +The check validates source and session-policy boundaries before testing success, failure and +private-output handling. CI includes it in the required aggregate. + ## Contributing Follow [CONTRIBUTING.md](CONTRIBUTING.md) for a safe first change, local checks and submission. diff --git a/scripts/test-inspect-ses-account.sh b/scripts/test-inspect-ses-account.sh new file mode 100644 index 0000000..465e450 --- /dev/null +++ b/scripts/test-inspect-ses-account.sh @@ -0,0 +1,209 @@ +#!/usr/bin/env bash +# Execute the actual workflow scripts with a local AWS stand-in and no credentials. +set -euo pipefail +root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) +workflow=${1:-"$root/.github/workflows/inspect-ses-account.yaml"} +work=$(mktemp -d) +trap 'rm -rf "$work"' EXIT +fail() { printf 'FAIL: %s\n' "$1" >&2; exit 1; } +[[ -f $workflow ]] || fail 'inspection workflow is missing' +yq -o=json '.' "$workflow" > "$work/workflow.json" +yq -o=json '.' "$root/.github/workflows/set-up-ses-account.yaml" > "$work/setup.json" +role=$(jq -er '.jobs["set-up"].env.ROLE_ARN' "$work/setup.json") +region=$(jq -er '.jobs["set-up"].env.AWS_REGION' "$work/setup.json") +setup_group=$(jq -er '.concurrency.group | select(type == "string" and length > 0)' "$work/setup.json") +account=${role#arn:aws:iam::}; account=${account%%:*} +[[ $account =~ ^[0-9]{12}$ && $region == eu-central-1 ]] || fail 'approved source binding is unavailable' + +# Parse the workflow structure, including the policy, rather than looking for +# safe-looking words that a different runnable job could bypass. +jq -e --arg role "$role" --arg region "$region" --arg account "$account" --arg setup_group "$setup_group" ' + keys == ["concurrency","jobs","name","on","permissions"] and + .concurrency == {group:"inspect-ses-account", "cancel-in-progress":false} and + (.concurrency.group | ascii_downcase) != ($setup_group | ascii_downcase) and + (.on | keys == ["workflow_dispatch"]) and + (.on.workflow_dispatch.inputs | keys == ["confirm"]) and + (.on.workflow_dispatch.inputs.confirm | .type == "string" and .required == true and (has("default") | not)) and + .permissions == {} and + (.jobs | keys == ["inspect"]) and + (.jobs.inspect | ."runs-on" == "ubuntu-latest" and ."timeout-minutes" <= 10 and + keys == ["env","name","permissions","runs-on","steps","timeout-minutes"] and + .permissions == {"id-token":"write"} and + .env.ROLE_ARN == $role and .env.AWS_REGION == $region and .env.EXPECTED_ACCOUNT_ID == $account and + [.steps[].id] == ["guard", "credentials", "read"] and + all(.steps[]; (has("if") | not)) and + [.steps[] | select(has("uses")) | .id] == ["credentials"] and + (.steps[0] | keys == ["env","id","name","run","shell"] and + (.env | keys == ["CONFIRM"]) and .env.CONFIRM == "${{ inputs.confirm }}") and + (.steps[2] | keys == ["id","name","run","shell"]) and + (.steps[1] | keys == ["id","name","uses","with"] and + .uses == "aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd" and + (.with | keys == ["action-timeout-s","allowed-account-ids","aws-region","inline-session-policy","mask-aws-account-id","output-credentials","retry-max-attempts","role-duration-seconds","role-session-name","role-to-assume","translate-env-variables","unset-current-credentials"]) and + .with."role-to-assume" == "${{ env.ROLE_ARN }}" and + .with."aws-region" == "${{ env.AWS_REGION }}" and + .with."allowed-account-ids" == "${{ env.EXPECTED_ACCOUNT_ID }}" and + .with."mask-aws-account-id" == true and + .with."unset-current-credentials" == true and + .with."translate-env-variables" == false and + .with."output-credentials" == false and + .with."role-duration-seconds" == 900 and + (.with."inline-session-policy" | fromjson) == { + Version:"2012-10-17", Statement:[{ + Effect:"Allow", Action:["ses:GetAccount", "sts:GetCallerIdentity"], Resource:"*", + Condition:{StringEquals:{"aws:RequestedRegion":$region}} + }] + })) +' "$work/workflow.json" > /dev/null || fail 'inspection source or permission boundary changed' +jq -er '.jobs.inspect.steps[] | select(.id == "guard") | .run | select(type == "string" and length > 0)' "$work/workflow.json" > "$work/guard.sh" +jq -er '.jobs.inspect.steps[] | select(.id == "read") | .run | select(type == "string" and length > 0)' "$work/workflow.json" > "$work/read.sh" +mkdir "$work/bin" +cat > "$work/bin/aws" <<'AWS' +#!/usr/bin/env bash +set -euo pipefail +[[ -z ${AWS_ACCESS_KEY_ID:-}${AWS_SECRET_ACCESS_KEY:-}${AWS_SESSION_TOKEN:-} ]] || exit 92 +[[ $# == 11 && $3 == --region && $4 == eu-central-1 && $5 == --output && $6 == json && $7 == --no-cli-pager && $8 == --cli-connect-timeout && $9 == 10 && ${10} == --cli-read-timeout && ${11} == 20 ]] || exit 93 +printf '%s %s\n' "$1" "$2" >> "$FIXTURE_DIR/calls" +case "$1 $2" in + 'sts get-caller-identity') + [[ $FIXTURE_CASE != identity-api-failure ]] || { echo private-api-error-canary >&2; exit 9; } + cat "$FIXTURE_DIR/identity.json" ;; + 'sesv2 get-account') + [[ $FIXTURE_CASE != account-api-failure ]] || { echo private-api-error-canary >&2; exit 9; } + cat "$FIXTURE_DIR/account.json" ;; + *) echo forbidden-api >&2; exit 91 ;; +esac +AWS +chmod 0700 "$work/bin/aws" +test_path="$work/bin:$PATH" +reset_fixture() { + printf '{"Account":"%s","Arn":"private-arn-canary","UserId":"private-user-canary"}\n' "$account" > "$work/identity.json" + cat > "$work/account.json" <<'JSON' +{"ProductionAccessEnabled":false,"SendingEnabled":true,"EnforcementStatus":"HEALTHY","SendQuota":{"Max24HourSend":200,"MaxSendRate":1,"SentLast24Hours":0},"Details":{"ReviewDetails":{"Status":"PENDING","CaseId":"private-case-canary"},"UseCaseDescription":"private-message-canary","AdditionalContactEmailAddresses":["private-address-canary@example.invalid"]}} +JSON + printf '{"inputs":{"confirm":"inspect-ses-account"}}\n' > "$work/event.json" + : > "$work/calls" +} +run_script() { + env -i PATH="$test_path" FIXTURE_DIR="$work" FIXTURE_CASE="$case_name" \ + EXPECTED_ACCOUNT_ID="$account" AWS_REGION="$region" \ + GITHUB_EVENT_PATH="$work/event.json" GITHUB_EVENT_NAME=workflow_dispatch \ + GITHUB_REF=refs/heads/main GITHUB_REPOSITORY=devantler-tech/aws \ + GITHUB_WORKFLOW_REF=devantler-tech/aws/.github/workflows/inspect-ses-account.yaml@refs/heads/main \ + GITHUB_ACTOR=devantler GITHUB_RUN_ATTEMPT=1 RUNNER_ENVIRONMENT=github-hosted \ + CONFIRM=inspect-ses-account "$@" +} +private_free() { + ! grep -Eq "private-.*-canary|$account|arn:|@example.invalid|AccessKey|SecretAccess|SessionToken" "$work/stdout" "$work/stderr" || fail 'private data reached a receipt' +} +receipt_shape() { + jq -e -s 'length == 1 and (.[0] | + keys == ["enforcementHealthy","max24HourSend","maxSendRate","productionAccessEnabled","reviewKnown","reviewPending","sendingEnabled","sentLast24Hours"] and + ([.productionAccessEnabled,.sendingEnabled,.enforcementHealthy,.reviewKnown,.reviewPending] | all(.[]; type == "boolean")) and + ([.max24HourSend,.maxSendRate,.sentLast24Hours] | all(.[]; type == "number")))' "$work/stdout" >/dev/null || fail 'receipt is not exactly the fixed public shape' +} +for case_name in pending granted unknown-review unlimited; do + reset_fixture + case "$case_name" in + granted) jq '.ProductionAccessEnabled=true | .SendingEnabled=false | .EnforcementStatus="PROBATION" | .Details.ReviewDetails.Status="GRANTED" | .SendQuota.MaxSendRate=14.5' "$work/account.json" > "$work/changed.json"; mv "$work/changed.json" "$work/account.json" ;; + unknown-review) jq 'del(.Details)' "$work/account.json" > "$work/changed.json"; mv "$work/changed.json" "$work/account.json" ;; + unlimited) jq '.SendQuota.Max24HourSend=-1' "$work/account.json" > "$work/changed.json"; mv "$work/changed.json" "$work/account.json" ;; + esac + run_script bash "$work/guard.sh" > "$work/stdout" 2> "$work/stderr" || fail "valid guard refused: $case_name" + [[ ! -s $work/stdout && ! -s $work/stderr ]] || fail 'guard emitted data' + run_script bash "$work/read.sh" > "$work/stdout" 2> "$work/stderr" || fail "valid inspection refused: $case_name" + [[ $(cat "$work/calls") == $'sts get-caller-identity\nsesv2 get-account' ]] || fail 'inspection used an unexpected API sequence' + receipt_shape + case "$case_name" in + pending) jq -e '.productionAccessEnabled == false and .sendingEnabled == true and .enforcementHealthy == true and .reviewKnown == true and .reviewPending == true and .max24HourSend == 200 and .maxSendRate == 1 and .sentLast24Hours == 0' "$work/stdout" >/dev/null || fail 'pending fields were changed' ;; + granted) jq -e '.productionAccessEnabled == true and .sendingEnabled == false and .enforcementHealthy == false and .reviewKnown == true and .reviewPending == false and .maxSendRate == 14.5' "$work/stdout" >/dev/null || fail 'granted fields were changed' ;; + unknown-review) jq -e '.reviewKnown == false and .reviewPending == false' "$work/stdout" >/dev/null || fail 'missing review invented a known decision' ;; + unlimited) jq -e '.max24HourSend == -1' "$work/stdout" >/dev/null || fail 'documented unlimited quota was changed' ;; + esac + [[ ! -s $work/stderr ]] || fail 'success wrote a diagnostic' + private_free +done + +for case_name in wrong-account identity-api-failure identity-malformed identity-missing identity-number identity-multiple account-api-failure malformed multiple non-object missing-production null-production string-sending missing-quota string-quota negative-quota infinite-quota missing-rate missing-sent unknown-enforcement malformed-details malformed-review unknown-review-status null-review-status; do + reset_fixture + case "$case_name" in + wrong-account) printf '{"Account":"000000000000"}\n' > "$work/identity.json" ;; + identity-malformed) printf 'private-error-canary\n' > "$work/identity.json" ;; + identity-missing) printf '{}\n' > "$work/identity.json" ;; + identity-number) printf '{"Account":123}\n' > "$work/identity.json" ;; + identity-multiple) printf '{}\n' >> "$work/identity.json" ;; + malformed) printf 'private-error-canary\n' > "$work/account.json" ;; + multiple) printf '{}\n' >> "$work/account.json" ;; + non-object) printf '[]\n' > "$work/account.json" ;; + missing-production) filter='del(.ProductionAccessEnabled)' ;; + null-production) filter='.ProductionAccessEnabled=null' ;; + string-sending) filter='.SendingEnabled="false"' ;; + missing-quota) filter='del(.SendQuota)' ;; + string-quota) filter='.SendQuota.Max24HourSend="200"' ;; + negative-quota) filter='.SendQuota.Max24HourSend=-2' ;; + infinite-quota) filter='.SendQuota.MaxSendRate=1e999' ;; + missing-rate) filter='del(.SendQuota.MaxSendRate)' ;; + missing-sent) filter='del(.SendQuota.SentLast24Hours)' ;; + unknown-enforcement) filter='.EnforcementStatus="private-status-canary"' ;; + malformed-details) filter='.Details=[]' ;; + malformed-review) filter='.Details.ReviewDetails="PENDING"' ;; + unknown-review-status) filter='.Details.ReviewDetails.Status="private-status-canary"' ;; + null-review-status) filter='.Details.ReviewDetails.Status=null' ;; + esac + if [[ -n ${filter:-} ]]; then jq "$filter" "$work/account.json" > "$work/changed.json"; mv "$work/changed.json" "$work/account.json"; unset filter; fi + status=0 + run_script bash "$work/read.sh" > "$work/stdout" 2> "$work/stderr" || status=$? + [[ $status != 0 && ! -s $work/stdout ]] || fail "invalid metadata accepted: $case_name" + if [[ $case_name == wrong-account || $case_name == identity-* ]]; then + [[ $(cat "$work/calls") == 'sts get-caller-identity' ]] || fail 'account read reached after identity refusal' + else + [[ $(cat "$work/calls") == $'sts get-caller-identity\nsesv2 get-account' ]] || fail 'failure used an unexpected API sequence' + fi + grep -Eq '^SES_ACCOUNT_INSPECTION=UNVERIFIED stage=(identity|account|metadata)$' "$work/stderr" || fail 'failure diagnostic is not fixed' + private_free +done + +for case_name in branch repository workflow actor retry runner event confirmation extra-input malformed-event missing-event arguments; do + reset_fixture + override=() + case "$case_name" in + branch) override=(GITHUB_REF=refs/heads/topic) ;; + repository) override=(GITHUB_REPOSITORY=someone/aws) ;; + workflow) override=(GITHUB_WORKFLOW_REF=devantler-tech/aws/.github/workflows/set-up-ses-account.yaml@refs/heads/main) ;; + actor) override=(GITHUB_ACTOR=someone) ;; + retry) override=(GITHUB_RUN_ATTEMPT=2) ;; + runner) override=(RUNNER_ENVIRONMENT=self-hosted) ;; + event) override=(GITHUB_EVENT_NAME=push) ;; + confirmation) override=(CONFIRM=set-up-ses-account) ;; + extra-input) printf '{"inputs":{"confirm":"inspect-ses-account","mode":"setup"}}\n' > "$work/event.json" ;; + malformed-event) printf 'private-event-canary\n' > "$work/event.json" ;; + missing-event) rm "$work/event.json" ;; + esac + arguments=(); [[ $case_name != arguments ]] || arguments=(setup) + status=0 + run_script env "${override[@]}" bash "$work/guard.sh" "${arguments[@]}" > "$work/stdout" 2> "$work/stderr" || status=$? + [[ $status != 0 && ! -s $work/stdout && ! -s $work/calls ]] || fail "unsafe dispatch accepted: $case_name" + [[ $(cat "$work/stderr") == SES_ACCOUNT_INSPECTION=REFUSED ]] || fail 'dispatch diagnostic is not fixed' + private_free +done + +# These fixtures must fail the structural gate before any script/API runs. +# The optional file argument prevents recursive negative-control generation. +if [[ $# == 0 ]]; then + for boundary in policy role mutable-action extra-job cloud-checkout guard-bypass concurrency-collision; do + case "$boundary" in + policy) change='.jobs.inspect.steps[1].with["inline-session-policy"] |= (fromjson | .Statement[0].Action += ["ses:PutAccountDetails"] | tojson)' ;; + role) change='.jobs.inspect.env.ROLE_ARN = "arn:aws:iam::000000000000:role/different"' ;; + mutable-action) change='.jobs.inspect.steps[1].uses = "aws-actions/configure-aws-credentials@main"' ;; + extra-job) change='.jobs.mutate = {steps:[{run:"aws sesv2 put-account-details"}]}' ;; + cloud-checkout) change='.jobs.inspect.steps += [{uses:"actions/checkout@main"}]' ;; + guard-bypass) change='.jobs.inspect.steps[1].if = "always()"' ;; + concurrency-collision) change=".concurrency.group = \$setup_group" ;; + esac + jq --arg setup_group "$setup_group" "$change" "$work/workflow.json" > "$work/boundary.yaml" + status=0 + bash "$root/scripts/test-inspect-ses-account.sh" "$work/boundary.yaml" > "$work/boundary.log" 2>&1 || status=$? + [[ $status != 0 ]] || fail "unsafe source fixture accepted: $boundary" + grep -q '^FAIL: inspection source or permission boundary changed$' "$work/boundary.log" || fail "source fixture failed outside the structural gate: $boundary" + done +fi +printf '%s\n' 'PASS: isolated SES inspection, exact policy, dispatch refusal, API ordering, metadata and private-output controls'