From 8d0f99764545d1cc53fac55f5efd74d763ce0004 Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Mon, 16 Nov 2026 22:35:32 +0100 Subject: [PATCH] ci(ses): report the sanitized review outcome Expose only the documented review status or UNKNOWN when absent, retaining refusal of malformed or unrecognized metadata. Exercise all four outcomes and each optional-field omission through the actual read program. Part of #95. --- .github/workflows/inspect-ses-account.yaml | 1 + README.md | 4 +++- scripts/test-inspect-ses-account.sh | 17 ++++++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/inspect-ses-account.yaml b/.github/workflows/inspect-ses-account.yaml index b94d355..abe978a 100644 --- a/.github/workflows/inspect-ses-account.yaml +++ b/.github/workflows/inspect-ses-account.yaml @@ -102,6 +102,7 @@ jobs: enforcementHealthy: (.EnforcementStatus == "HEALTHY"), reviewKnown: ($review != null), reviewPending: ($review == "PENDING"), + reviewStatus: ($review // "UNKNOWN"), max24HourSend: .SendQuota.Max24HourSend, maxSendRate: .SendQuota.MaxSendRate, sentLast24Hours: .SendQuota.SentLast24Hours diff --git a/README.md b/README.md index 3651919..779a1ba 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,9 @@ identity with a session restricted to identity verification and the SES account 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 +The receipt contains readiness and review booleans, a closed review-status value, and numeric +quota fields. +The status is `PENDING`, `FAILED`, `GRANTED`, `DENIED` or `UNKNOWN` when absent. 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. diff --git a/scripts/test-inspect-ses-account.sh b/scripts/test-inspect-ses-account.sh index 465e450..b1c0e18 100644 --- a/scripts/test-inspect-ses-account.sh +++ b/scripts/test-inspect-ses-account.sh @@ -97,15 +97,20 @@ private_free() { } receipt_shape() { jq -e -s 'length == 1 and (.[0] | - keys == ["enforcementHealthy","max24HourSend","maxSendRate","productionAccessEnabled","reviewKnown","reviewPending","sendingEnabled","sentLast24Hours"] and + keys == ["enforcementHealthy","max24HourSend","maxSendRate","productionAccessEnabled","reviewKnown","reviewPending","reviewStatus","sendingEnabled","sentLast24Hours"] and ([.productionAccessEnabled,.sendingEnabled,.enforcementHealthy,.reviewKnown,.reviewPending] | all(.[]; type == "boolean")) and + (.reviewStatus | IN("PENDING","FAILED","GRANTED","DENIED","UNKNOWN")) 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 +for case_name in pending granted failed denied unknown-review missing-review-details missing-review-status 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" ;; + failed) jq '.Details.ReviewDetails.Status="FAILED"' "$work/account.json" > "$work/changed.json"; mv "$work/changed.json" "$work/account.json" ;; + denied) jq '.Details.ReviewDetails.Status="DENIED"' "$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" ;; + missing-review-details) jq 'del(.Details.ReviewDetails)' "$work/account.json" > "$work/changed.json"; mv "$work/changed.json" "$work/account.json" ;; + missing-review-status) jq 'del(.Details.ReviewDetails.Status)' "$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" @@ -114,9 +119,11 @@ for case_name in pending granted unknown-review unlimited; do [[ $(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' ;; + pending) jq -e '.productionAccessEnabled == false and .sendingEnabled == true and .enforcementHealthy == true and .reviewKnown == true and .reviewPending == true and .reviewStatus == "PENDING" 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 .reviewStatus == "GRANTED" and .maxSendRate == 14.5' "$work/stdout" >/dev/null || fail 'granted fields were changed' ;; + failed) jq -e '.reviewKnown == true and .reviewPending == false and .reviewStatus == "FAILED"' "$work/stdout" >/dev/null || fail 'failed review status was changed' ;; + denied) jq -e '.reviewKnown == true and .reviewPending == false and .reviewStatus == "DENIED"' "$work/stdout" >/dev/null || fail 'denied review status was changed' ;; + unknown-review|missing-review-details|missing-review-status) jq -e '.reviewKnown == false and .reviewPending == false and .reviewStatus == "UNKNOWN"' "$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'