procurement-ingest/tests
Adam Moussa 7569bd8250
harden(webhook): resolve /sh-security-review findings (1 confirmed medium + cheap fixes)
High-recall detector fan-out (injection/authz/secrets-crypto/iac-iam/logic)
+ proof-or-kill verifier. Gate PASSES: 1 confirmed medium, 0 confirmed
critical/high. Confirmed finding fixed; several unverified-but-cheap
hardenings applied since the emitter ships dark and activation is weeks out.

- CONFIRMED medium (confused deputy): the rotation Lambda's generated
  invoke permission for secretsmanager.amazonaws.com carried no
  SourceAccount/SourceArn, so any account's Secrets Manager could invoke
  the rotator. Patched the generated CfnPermission in place (a second
  permission would be additive, not restrictive) to pin account + this
  secret ARN.
- delivery + replay: refuse to follow receiver 3xx redirects (no-redirect
  opener) so live X-SH-* auth headers can't be forwarded to a
  receiver-chosen Location and an http:// Location can't slip past the
  https guard. Fixed the "unfollowed 3xx" comment that was factually wrong.
- delivery: classify 401/403 as retryable (invalidate key cache + retry in
  order) instead of parking -- transient auth failures (rotation outran the
  TTL cache, clock skew) are availability events, not contract bugs.
- envelope: build_event now genuinely total (guarded eventID /
  ApproximateCreationDateTime subscripts) per its own never-raise contract.
- handler: catch-all so an unexpected per-record error (e.g. SQS park
  failure) reports only that record instead of failing the whole batch
  (which would re-deliver every earlier success for 24h); per-invocation
  emit/skip batch summary so a systemic silent drop is queryable/alarmable.
- rotator: narrow the AWSCURRENT-read except to ResourceNotFound/JSONDecode
  (transient SM/KMS errors re-raise so the overlap key isn't silently
  dropped); kid uniqueness checked against ALL retained kids with a random
  suffix on collision (never reissue a kid for a different secret).
- contract: skeleton-upsert required on ANY unknown work_order_id (not just
  comment-before-create) + monotonicity guard (ignore older updated_at), so
  a parked created or an out-of-order replay can't corrupt receiver state.

Unverified/refuted findings left as-is with rationale: the two "high" logic
claims (whole-batch crash triggers, ordering violation) were refuted on
reachability (real stream records carry required fields; persistence writes
strings only; full-state idempotent upsert absorbs the ordering gap). Signed
kid/version binding (AUTHZ-002) declined: coordinated contract change, not
cheap, no exploit with one algorithm/key.
2026-07-24 15:23:24 -04:00
..
support feat(webhook): SHOC WO webhook emitter — dark-ship streams, HMAC secret + rotation 2026-07-24 14:54:07 -04:00
requirements.txt test: consolidate test roots — one loader, shared support, enforced CI floor (phase 8) (#118) 2026-07-20 16:19:15 -04:00
test_api_handlers.py feat(api): Redocly lint gate + SHOC-themed /docs (Redoc theming, topbar, collapsible samples) (#130) 2026-07-24 18:04:30 +00:00
test_api_pagination_moto.py feat(api): procurement-api read stack + OpenAPI docs (SHOC reconciliation path) (#127) 2026-07-23 19:32:20 -04:00
test_api_spec_drift.py feat(api): Redocly lint gate + SHOC-themed /docs (Redoc theming, topbar, collapsible samples) (#130) 2026-07-24 18:04:30 +00:00
test_bundle_consistency.py feat(webhook): SHOC WO webhook emitter — dark-ship streams, HMAC secret + rotation 2026-07-24 14:54:07 -04:00
test_cross_account_principal_pin.py fix(webhook): kms:ViaService pins, https-only delivery, cross-account principal CI pin 2026-07-24 15:00:15 -04:00
test_handler_auth_seam.py test: consolidate test roots — one loader, shared support, enforced CI floor (phase 8) (#118) 2026-07-20 16:19:15 -04:00
test_parse_raw_email.py Add pytest suite and enable tests in CI (#95) 2026-07-15 19:06:20 -04:00
test_replay_shoc_webhooks_contract.py feat(webhook): SHOC WO webhook emitter — dark-ship streams, HMAC secret + rotation 2026-07-24 14:54:07 -04:00
test_reprocess_contract.py Migrate to seahaven-prod: deploy role, backfill tooling, account-portability fixes (#125) 2026-07-23 17:08:47 -04:00
test_ses_auth.py fix(ses_auth): harden comment stripping and alarm evaluation window (#103) 2026-07-16 19:00:40 +00:00
test_shoc_emitter_delivery.py harden(webhook): resolve /sh-security-review findings (1 confirmed medium + cheap fixes) 2026-07-24 15:23:24 -04:00
test_shoc_emitter_envelope.py feat(webhook): SHOC WO webhook emitter — dark-ship streams, HMAC secret + rotation 2026-07-24 14:54:07 -04:00
test_shoc_emitter_handler.py harden(webhook): resolve /sh-security-review findings (1 confirmed medium + cheap fixes) 2026-07-24 15:23:24 -04:00
test_shoc_hmac_rotator.py harden(webhook): resolve /sh-security-review findings (1 confirmed medium + cheap fixes) 2026-07-24 15:23:24 -04:00
test_web_ui_auth.py feat(api): procurement-api read stack + OpenAPI docs (SHOC reconciliation path) (#127) 2026-07-23 19:32:20 -04:00
test_web_ui_handlers.py test: consolidate test roots — one loader, shared support, enforced CI floor (phase 8) (#118) 2026-07-20 16:19:15 -04:00