Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/inspect-ses-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 12 additions & 5 deletions scripts/test-inspect-ses-account.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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'
Expand Down
Loading