Files
adr-sml/scripts/aws-discover.sh
T
Pouya LajevardiandClaude Opus 5 6bf1167624 fix: sweep D3 amendment through the specs; correct inverted DKIM table
The re-audit of the deploy-guard change surfaced defects well outside the
diff, including one that would have broken production mail.

docs/05-backend-spec.md had the two SES DKIM sets exactly inverted, labelling
the three records that resolve as "orphans" and the three NXDOMAIN records as
"Live. Never delete". Entry (j) corrected this in AGENTS.md §7 and the
correction never reached docs/05. Since SES has no custom MAIL FROM, DKIM is
the only thing satisfying DMARC, so acting on that table would have silently
broken intake mail authentication.

Also in this change:

- .gitea/workflows/deploy.yml gains a guard as steps[0] that fails the run,
  naming the variable, if AWS_REGION, S3_BUCKET or CLOUDFRONT_DISTRIBUTION_ID
  is empty — how a Gitea too old for the vars context manifests. Verified
  fail-closed under bash -e, sh -e and bash -euo pipefail.
- AGENTS.md Current Truth: SPF and DMARC recorded as present (Q20), the
  matching §10 High risk row retired, three duplicate Q rows removed.
- docs/reference/AWS-Hosting-Guide.md tracked and given a do-not-execute
  banner; it was an executable procedure for the architecture D1/D3 replace.
- Copy decks: "a working litigator" and "an active litigation practice"
  replaced with the register's own wording; LegalService JSON-LD replaced with
  ProfessionalService; tribunal-secretary offers removed per D14; nine stale
  question blockers swept.
- astro.config.mjs: prefetchAll disabled — it injected JS into every page
  against the zero-JS convention with no decision recorded.
- src/data/site.ts: unregistered response-time commitment nulled (Q27);
  OBA section names downgraded to [assumed] (Q28).
- s3:AbortMultipartUpload reasoning corrected to measure ./dist, not the repo.

Opens Q27, Q28, Q29. AGENTS.md entry (q) records the full resolution,
including the findings declined and why.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012XquaEq4BgWMCwUqLEyNkF
2026-08-26 11:28:42 -04:00

63 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# ---------------------------------------------------------------------------
# Collects the AWS resource identifiers this project needs (AGENTS.md Q10).
# Read-only: no call creates or mutates anything.
#
# chmod +x scripts/aws-discover.sh
# ./scripts/aws-discover.sh > aws-inventory.txt
#
# aws-inventory.txt contains NO secrets — only resource names and IDs — so it
# is safe to share. It is gitignored anyway.
# ---------------------------------------------------------------------------
set -uo pipefail
hr() { printf '\n== %s %s\n' "$1" "$(printf '=%.0s' $(seq 1 $((60 - ${#1}))))"; }
try() { "$@" 2>&1 || echo " (failed — check permissions or region)"; }
command -v aws >/dev/null || { echo "AWS CLI not installed. See docs/reference/AWS-Hosting-Guide.md Part 0.5"; exit 1; }
hr "Identity and default region"
try aws sts get-caller-identity --output table
echo "default region: $(aws configure get region || echo '(unset)')"
hr "S3 buckets -> which one holds the site?"
try aws s3 ls
hr "CloudFront distributions -> Id, Aliases, Origin"
try aws cloudfront list-distributions \
--query "DistributionList.Items[].{Id:Id,Status:Status,Domain:DomainName,Aliases:join(',',Aliases.Items||[\`none\`]),Origin:Origins.Items[0].DomainName}" \
--output table
hr "ACM certificates (us-east-1 — CloudFront certs live there)"
try aws acm list-certificates --region us-east-1 \
--query "CertificateSummaryList[].{Domain:DomainName,Status:Status,Arn:CertificateArn}" --output table
hr "API Gateway HTTP APIs -> the intake endpoint"
try aws apigatewayv2 get-apis \
--query "Items[].{Name:Name,ApiId:ApiId,Endpoint:ApiEndpoint,Protocol:ProtocolType}" --output table
hr "Lambda functions"
try aws lambda list-functions \
--query "Functions[].{Name:FunctionName,Runtime:Runtime,Modified:LastModified}" --output table
hr "DynamoDB tables"
try aws dynamodb list-tables --output table
hr "SES verified identities"
try aws sesv2 list-email-identities \
--query "EmailIdentities[].{Identity:IdentityName,Type:IdentityType,Verified:VerifiedForSendingStatus}" --output table
hr "S3 versioning on each bucket (rollback depends on this)"
for b in $(aws s3api list-buckets --query 'Buckets[].Name' --output text 2>/dev/null); do
printf ' %-45s %s\n' "$b" "$(aws s3api get-bucket-versioning --bucket "$b" --query 'Status' --output text 2>/dev/null || echo '?')"
done
hr "Done"
cat <<'NOTE'
Send back:
* the S3 bucket that holds the site
* the CloudFront distribution Id whose Aliases include adr.smlcompany.ca
* the default region, and the region of the DynamoDB table
* the API Gateway Endpoint for the intake API
NOTE