Skip to content

docs(bb-auth): document the password policy in the README - #1510

Merged
xyos merged 2 commits into
mainfrom
docs/bb-auth-password-policy
Nov 18, 2026
Merged

xyos merged 2 commits into
mainfrom
docs/bb-auth-password-policy

Conversation

@xyos

@xyos xyos commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The Auth README never mentions emailPassword.passwordPolicy, and API.md only declares PasswordPolicy's fields without saying what they default to. A developer can't learn from the docs what a password needs by default, which calls check it, or what the client receives for a weak password.

Issue #, if available: none

Stack: 2 of 5 (base: #1509, the docs content fixes). The PRs above it add the cdk-blocks docs command (#1511), point the scaffolded docs at it (#1512) and add --output json (#1521). Review fixes are in their own commit. This PR only touches packages/bb-auth/README.md and adds a changeset.

Changes

A new "Password policy" section in the @aws-blocks/bb-auth README, after "Sign-up and email delivery" (@aws-blocks/bb-auth and @aws-blocks/blocks, patch; the umbrella ships the block READMEs in its docs/). It covers:

  • each PasswordPolicy field (minLength, requireUppercase, requireLowercase, requireDigits, requireSymbols) and its default: 8 characters, with all four kinds of character required. With no passwordPolicy the block writes none, and the pool gets the CDK UserPool construct's default policy, which has the same values;
  • the range of minLength, 6 to 99: the block and the local pool don't check it, and the CDK construct throws at synth;
  • where it is enforced: signUp, the new-password answer to confirmSignIn, confirmResetPassword, updatePassword, auth.admin.createUser's temporaryPassword and auth.admin.setUserPassword, plus the setAuthState actions that call them. On AWS the user pool the block creates enforces it; locally the local user pool checks the same rules, with two differences: a generated temporary password (admin.createUser without temporaryPassword) has 16 characters and is checked against the policy, so minLength above 16 throws locally, and an imported pool keeps the block's policy locally while AWS checks the pool's own;
  • what the client receives: InvalidPasswordException (AuthErrors.InvalidPassword), status 400, with a message built from the policy (the same locally and on AWS). Through setAuthState the error is retriable;
  • how to branch on it: isAuthError(e, AuthErrors.InvalidPassword) for a thrown error, hasAuthError(state, 'InvalidPasswordException') for a returned state. The example is a new recipe, "Tell the user what a password needs", under ## Recipes, so readme-recipes.test.ts compiles it;
  • that an imported pool (userPool: Auth.fromExisting(…)) keeps its own policy on AWS and the fixed message.

Every statement follows the current source: PasswordPolicy and EmailPasswordOptions in src/types.ts, passwordPolicyMessage and toAuthApiError in src/error-mapping.ts, statusForAuthError and isRetriableAuthError in src/errors.ts, the local engines' password checks (src/engines/native-mock*.ts), the Cognito calls that carry a password (src/engines/native-cognito*.ts) and mapPasswordPolicy in src/cdk/mappers.ts.

No code change.

Validation

Run locally at the stack top (f05527191, on main at 03778d9f6) with Node 22.23.1 (.nvmrc):

The full suites ran on the previous head (b8a78177a, on main at d01c34c96), Node 22.23.1, before this rebase onto nine more main commits; the rebase changed only bb-kv-store/README.md (a conflict with #1608) in this stack's own diff:

  • npm run test:e2e:local: exit 0; 580 tests, 574 pass, 0 fail, 6 skipped.
  • npm test: 13,802 tests, 13,767 pass, 21 fail, 10 skipped. Every failure is a dev-server, signal or file-watcher test in core, hosting or blocks' cli/context.test.js (none in cdk-blocks docs, bb-auth, bb-kv-store or create-blocks-app), and the log has 46 EMFILE errors from fs.watch: this machine's fs.inotify.max_user_instances (128) was used up by other processes. CI runs these suites.

No new tests: the change is documentation only. No sandbox run.

Checklist

  • PR description included
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@xyos
xyos added this pull request to stack #1513 November 15, 2026 22:24
@changeset-bot

changeset-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6234fa7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@aws-blocks/bb-auth Patch
@aws-blocks/blocks Patch
@aws-blocks/create-blocks-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@xyos xyos changed the title docs/bb auth password policy docs(bb-auth): document the password policy in the README Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor
📖 Glossary & notes — scoring, indicators, per-metric thresholds (click to expand)
  • N = 1 — one rep per cell, so a small delta may be model variance, not a real change; re-run for certainty.
  • Indicators (change vs baseline, per metric): ✨ noticeably improved · ✅ OK / no significant change (within noise band) · ⚠️ slight regression (beyond 1× threshold) · ❌ serious regression (beyond 2× threshold) · 🆕 new — no baseline value yet (current value shown, tagged (new)) · — nothing to show this run · 🗑️ cell gone since the baseline. Each cell shows <indicator> <value> (<Δ vs main>) inline.
  • Columns: Tests (pass/denom) · Judge (overall 0-10 score with signed delta; per-dimension breakdown lives in the judge artifact JSON) · Cost · Turns (agent cycles) · Score · Stop reason.
  • Threshold definitions (per metric, DELTA_THRESHOLDS in overview.mjs):
    • composite/score: ±5 points — a change ≤5 pts is ✅; >5 improving is ✨; >5 worsening is ⚠️; >10 worsening is ❌.
    • judge (overall): ±0.3 — a shift ≤0.3 is ✅; >0.3 improving is ✨; >0.3 worsening is ⚠️; >0.6 worsening is ❌.
    • tests: ±1 pass — a ≤1 pass change is ✅; >1 improving is ✨; >1 worsening is ⚠️; >2 worsening is ❌.
    • cost: ±10% of baseline (floor $0.02) — within 10% is ✅; >10% cheaper is ✨; >10% more expensive is ⚠️; >20% more expensive is ❌.
    • turns: ±3 cycles — a ≤3 turn change is ✅; >3 fewer is ✨; >3 more is ⚠️; >6 more is ❌.
  • Directions: higher is better for tests, judge, and score; lower is better for cost and turns.
  • Composite (0-100) = round(60·test_rate + 4·judge·min(1, 4·test_rate), 1) — 60% objective pass-rate + 40% judge, the judge term gated below a 25% pass-rate.
  • Cost = builder token spend at Bedrock Claude Opus 4.8 rates ($5 in / $25 out per 1M tokens; BUILDER_PRICING in scoring.mjs).
  • SCORE = composite ÷ cost — composite points per dollar (higher = better). Cost, not raw token volume, is the denominator, so tokens can't dominate; a broken (composite 0) cell scores 0 no matter how cheap. Flip SCORE_PER_DOLLAR in scoring.mjs for cost-per-point (lower = better).
  • Baseline = the most recent main-branch bench (bench/runs/latest-main.json), NOT the PR base commit — the PR always diffs against the current state of main.
  • Excluded from the mean: harness_error cells (infra failures) and gradeable cells that ran no tests. agent_fail (agent produced no app in budget) and dead_server (built app never served / crashed) are BOTH included, as composite 0.
  • Run artifacts — per-cell source + full agent traces · 🕒 Last run: 2026-11-18T10:39:31Z · run #44281022444

Results — PR vs main baseline

Each metric shows its current value colored by the change vs the latest main baseline 668227b. ✨ improved · ✅ within noise · ⚠️ slight regression · ❌ serious regression · 🆕 no baseline yet (value shown, tagged (new)).

  • Mean composite 89.6/100 across 10 scored cell(s) — ✨ +9.0 vs main · judge mean 8.84/10.
  • Verdicts: 9 pass · 1 partial · 0 fail · 0 harness_error.
  • Totals: cost $136.93 · tokens 26.4M in / 193K out · 386 turns.
  • Biggest gains: kb-chat-agent/demo (+95.2), collab-presence-board/default (+3.2), email-digest/demo (+0.8).
  • Biggest drops: oidc-dsql-notes/react (-2.9), async-word-counter/bare (-2.4), cognito-profile/auth (-1.6).
  • Config: baseline 668227b.
  • ✅ Composite band 🟢 across 10 scored cell(s). Threshold 65 — pass.
Task Template Tests Judge Cost Turns Score Stop reason
async-word-counter bare ✅ 13/13 (0) ⚠️ 8.8 (-0.6) ❌ $3.79 (+$1.17) ⚠️ 19 (+4) ❌ 25.1 (-12.2) endTurn
auth-notes demo ✅ 11/11 (0) ✅ 8.4 (0) ❌ $20.64 (+$8.34) ❌ 63 (+23) ✅ 4.5 (-3.1) endTurn
cognito-profile auth ✅ 10/10 (0) ⚠️ 8.4 (-0.4) ❌ $39.79 (+$28.79) ❌ 79 (+40) ⚠️ 2.4 (-6.3) endTurn
collab-presence-board default ✅ 11/11 (0) ✨ 9.4 (+0.8) ❌ $3.59 (+$1.17) ⚠️ 18 (+5) ❌ 27.2 (-11.8) endTurn
email-digest demo ✅ 12/12 (0) ✅ 9.4 (+0.2) ❌ $5.25 (+$1.02) ❌ 33 (+16) ✅ 18.6 (-4.3) endTurn
file-gallery bare ✅ 12/12 (0) ✅ 9.6 (+0.2) ✨ $2.69 (-$0.38) ✅ 14 (-3) ✅ 36.6 (+4.8) endTurn
kb-chat-agent demo 🆕 9/9 (new) 🆕 8.8 (new) ❌ $31.47 (+$27.42) ❌ 60 (+47) ✅ 3 (+3) endTurn
observability-api backend ✅ 18/18 (0) ⚠️ 9 (-0.4) ✅ $6.75 (+$0.4) ✨ 26 (-6) ✅ 14.2 (-1.2) endTurn
oidc-dsql-notes react ✅ 2/11 (0) ❌ 7.4 (-1) ✨ $14.8 (-$15.57) ✨ 44 (-37) ✅ 2.2 (+1) endTurn
sql-kb-catalog nextjs ✅ 9/9 (0) ⚠️ 9.2 (-0.4) ❌ $8.16 (+$3.32) ⚠️ 30 (+5) ⚠️ 11.9 (-8.4) endTurn

Merge verdict

✅ This bench run does not block the PR.

  • ✅ Absolute floor — mean composite 89.6 >= floor 65.
  • ✅ Regression vs main — mean composite delta +9.0 pts vs main is within the 10-pt limit.

The Δ vs base ball above is a fixed ±5-pt display band; the regression gate uses BENCH_MAX_REGRESSION. The ball is cosmetic — the gate threshold is what blocks.

@xyos
xyos marked this pull request as ready for review November 16, 2026 14:56
@xyos
xyos requested a review from a team as a code owner November 16, 2026 14:56
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
@xyos
xyos force-pushed the docs/bb-auth-password-policy branch from 24a66b0 to 6d948e7 Compare November 17, 2026 22:11
@xyos
xyos force-pushed the docs/bb-auth-password-policy branch from 6d948e7 to 5f8e05b Compare November 17, 2026 22:18
xyos added 2 commits November 18, 2026 10:59
The README never mentioned `emailPassword.passwordPolicy`; API.md only declares it. A new
"Password policy" section lists each `PasswordPolicy` field and its default, the calls that
enforce it (sign-up, the new-password sign-in answer, password reset and change, and the two
admin calls that set a password), and what a client receives for a weak password:
`InvalidPasswordException`, 400, retriable through `setAuthState`, with a message built from
the policy. It shows how to branch on it with `isAuthError` and `hasAuthError`, and notes that
an imported pool keeps its own policy and the fixed message.
- Move the policy and hasAuthError snippets into a Recipes entry, so the README recipe test compiles them.
- minLength: 6 to 99, checked at synth by the CDK UserPool, not by the block or the local pool.
- With no passwordPolicy the block writes no policy; the pool gets the CDK UserPool default.
- Locally a generated temporary password is checked against the policy (minLength above 16 throws).
- An imported pool: the local pool still checks the block's policy; AWS checks the pool's.

This branch was previously deployed

2 inactive deployments
e2e — 6234fa78 Deployed Nov 18, 2026 by xyos via E2E Teardown Verify #7048
agent-bench — 6234fa78 Deployed Nov 18, 2026 by xyos via bench / summary #6122
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants