Skip to content

feat: adaptive CAPTCHA, deploy freeze windows, SBOM diff comments, and config parity drift detection - #939

Merged
Dydex merged 1 commit into
AstronLabs:mainfrom
Levi-Ojukwu:feat/security-devops-captcha-freeze-sbom-drift
Oct 17, 2026
Merged

Dydex merged 1 commit into
AstronLabs:mainfrom
Levi-Ojukwu:feat/security-devops-captcha-freeze-sbom-drift

Conversation

@Levi-Ojukwu

Copy link
Copy Markdown
Contributor

Summary

Resolves #934, #930, #929, #931.

closes #934 Adaptive CAPTCHA

  • Challenge only when risk signals are present (repeated failures, bad reputation, unusual request rate, credential-stuffing lockout); normal users are never challenged.
  • Tokens are HMAC-signed, verified server-side, bound to a single action and source, expire, and are single-use.
  • Accessible text-based challenge, a delayed assisted fallback after repeated failures, and a support contact on every challenge so users are never blocked.
  • Guards POST /api/auth/register and POST /api/admin/2fa/verify; new /api/captcha/{challenge,solve,assisted} routes. The credential-stuffing guard lets a challenged user with a valid token through.
  • Docs: docs/ADAPTIVE_CAPTCHA.md.

closes #930 Deployment freeze windows

  • Calendar in devops/deploy-freeze-calendar.json (month-end rule plus one-off windows; start inclusive, end exclusive).
  • Deploy Freeze Gate job in blue-green-deploy.yml blocks production deploys during a freeze unless an authorized override with a reason is supplied (freeze_override_reason).
  • Overrides are logged with person and reason (run summary, artifact, team channel). Freeze status is shown in the run summary; upcoming freezes are announced on weekdays.
  • Docs: docs/DEPLOYMENT_FREEZE.md.

closes #929 SBOM diff PR comments

  • sbom-diff.yml builds SBOMs for base and head, diffs them with scripts/sbom-diff.mjs, and maintains a single updating PR comment.
  • Flags disallowed licenses (scripts/license-allowlist.json, SPDX expressions supported) and known vulnerabilities (OSV).

closes #931 Config parity drift

  • config-parity-drift.yml snapshots non-secret config, versions and flags from staging and production every 6h and compares them against devops/config-parity-allowlist.json.
  • Secrets are never collected. Only new drift alerts (webhook + issue); first-seen/resolved history is kept on the config-drift-history branch.
  • Docs: docs/CONFIG_PARITY_DRIFT.md.

Testing

  • backend: npx jest src/__tests__/adaptiveCaptcha.test.ts src/__tests__/credentialStuffing.test.ts (20 passing): triggers, verification, action/source binding, replay, forgery, expiry, assisted path.
  • node --test scripts/{deploy-freeze-gate,sbom-diff,config-parity-drift}.test.mjs (window boundaries, month-end/leap year, overrides, SBOM diff/licenses/vulns with sample SBOMs, fixture environments).
  • auth.test.ts has 2 failures that also fail on main; not related.

Reviewer notes

  • authorizedOverriders currently contains only Levi-Ojukwu; replace with the real release managers.
  • CAPTCHA state is in-memory (same as the credential-stuffing detector); set CAPTCHA_SECRET on every instance.
  • Drift collector reads flags from SSM /remitmortgage/<env>/flags/; adjust if flags live elsewhere. Allowlist expect values for CPU/memory/sampler ratio should be confirmed.
  • SBOM comment is skipped on fork PRs (read-only token); the diff is still in the run summary.

… PR diff, and config parity drift detection

Security
- Add adaptive CAPTCHA (AstronLabs#934): challenge only when risk signals fire
  (repeated failures, bad reputation, unusual request rate, stuffing
  lockout). Tokens are HMAC-signed, verified server-side, bound to one
  action and source, and single-use. Includes an accessible text
  challenge, a delayed assisted fallback, and a support contact.
  Applied to /api/auth/register and /api/admin/2fa/verify.

DevOps
- Add deployment freeze windows (AstronLabs#930): version-controlled calendar with
  month-end rule, a deploy-freeze gate in blue-green-deploy.yml, logged
  authorized overrides (person + reason), and freeze announcements.
- Add SBOM diff PR comments (AstronLabs#929): single updating comment listing
  added/removed/upgraded packages with licenses, flagging disallowed
  licenses and OSV vulnerabilities.
- Add staging/production config parity drift detection (AstronLabs#931): scheduled
  secret-free snapshots, allowlist of expected differences, new-drift
  alerts and first-seen history.
@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@Levi-Ojukwu Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Dydex
Dydex merged commit 8e9b4a5 into AstronLabs:main Oct 17, 2026
29 of 60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants