Repository navigation
fix(plugin-auth)!: Setup → Authentication shows what the deployment runs for every declared auth setting, and says when sign-up is forced off - #38255
Conversation
… every key it states; sign-up forced off is stated Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
…nfig, and the forced-off sign-up statement Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
… key Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 21 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d0d958d26fdc2b8b2e4f7bddcd049c7dad7f07ea && git checkout d0d958d26fdc2b8b2e4f7bddcd049c7dad7f07ea
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e42520c67bcef027552f8db83655ff9b54d32cef 53c02901f87dc30eae502ae2649f1a5250de41e1 && git checkout -B drift-repro e42520c67bcef027552f8db83655ff9b54d32cef && git merge --no-ff 53c02901f87dc30eae502ae2649f1a5250de41e1
node scripts/docs-audit/affected-docs.mjs --json e42520c67bcef027552f8db83655ff9b54d32cef
|
Fixes #38184
Clause-②: yes (narrowing) — narrowed: with nothing stored,
SettingsService.get('auth', …)andGET /api/settings/authanswer 24 moreauthkeys with the deployment's declaration (stillsource: 'default') where they answered the manifest default:password_min_length,password_max_length,membership_policy,password_reject_breached,password_require_complexity,password_min_classes,password_history_count,password_expiry_days,mfa_required,mfa_grace_period_days,api_key_default_expiry_days,api_key_max_expiry_days,api_key_inactivity_days,session_expiry_days,session_refresh_days,session_idle_timeout_minutes,session_absolute_max_hours,max_concurrent_sessions_per_user,allowed_ip_ranges,lockout_threshold,lockout_duration_minutes,audience_posture,audience_allowed_email_domains,audience_self_registration_permission_set; so a published response's value changes for an existing reader on any deployment whose own configuration differs from the manifest default for one of them. Four keys gate another key's visibility, so with nothing stored a declaration now shows a key that was hidden, and a save that touches it or its gate is judged for its options and bounds where it was not:lockout_duration_minutesunder a declaredlockoutThresholdabove 0 (for examplelockout_duration_minutes: 5000is now refused400 SETTINGS_VALIDATIONwhere it was stored),mfa_grace_period_daysunder a declaredmfaRequirementother thanoff,password_min_classesunder a declaredpasswordRequireComplexity: true, andaudience_allowed_email_domains/audience_self_registration_permission_setunder a declaredaudience.postureofemail_domainoropen. A save that sets one of these keys to its manifest default where the declaration differs now asks the key's write predicates. Widened: a save that sets one of these keys to the declaration with nothing stored is no change and asks no predicate. The Setup → Authentication live-status banner adds awarningforsignup_enabledstored on where the deployment forces sign-up off (SSO-only, cloud-managed,OS_DISABLE_SIGNUP), in all 11 languages; where both that and the cloud-managed email-and-password hold apply, one banner carries both statements.Metadata-protocol: none
Skills-docs: none — no skill under
skills/**teaches the auth settings page, these keys or the settings cascade's bottom rung.维护者速读
What changes
Measured first, on base
23fa3619(after the declared-default seam landed). A realAuthPluginover the realSettingsService, booted twice per key: once declaring nothing, once declaring a value other than the manifest default. Declaring nothing, every key inAUTH_SETTING_RESTOREresolved what runs, except the rate-limit pair andgoogle_enabled(below). Declaring a value, every key resolved the manifest default while the running config took the declaration.password_min_length/password_max_lengthminPasswordLength: 12/maxPasswordLength: 64membership_policyinvite-onlyautoinvite-onlypassword_reject_breached,password_require_complexitytruefalsetruepassword_min_classes,password_history_count,password_expiry_daysmfa_required,mfa_grace_period_daysadministrators, 3off, 7administrators, 3api_key_default_expiry_days,api_key_max_expiry_days,api_key_inactivity_dayssession_expiry_days,session_refresh_daysexpiresIn30 d,updateAge2 dsession_idle_timeout_minutes,session_absolute_max_hours,max_concurrent_sessions_per_userallowed_ip_rangeslockout_threshold,lockout_duration_minutesaudience_posture,audience_allowed_email_domains,audience_self_registration_permission_setemail_domain, two domains,member_defaultinvite_only, nothing, nothingrate_limit_max/rate_limit_window_secondsrateLimit5 / 120google_enabled,google_client_id,google_client_secretsocialProvidersThe declarations (
auth-settings-declared-defaults.ts).AUTH_DECLARED_DEFAULTSgrows from 3 keys to 27. Each formula reads the declaration captured ininit()(synchronous, reads no setting) through the reader the running config uses:resolveAudience,resolveMfaGracePeriodDays,resolveApiKeyLifecyclePolicy's window reading and ceiling,getDeploymentAccessFloor's?? 0, the lockout and complexity bodies' defaults and clamps, the session block's seconds as days, andbuildPluginList's env-then-declared reading for breached passwords. With nothing declared each formula answers the manifest default (or nothing, for a key with no default), so a deployment that declares none of these reads as before.Type and options against the specifier (#38180 review N1/N2): each answer takes the key's shape. Session lifetimes are days. The IP list and the domain list are one entry per line, the textarea's own reading. A select (
membership_policy,mfa_required) answers only one of its options, so an off-vocabulary declaration answers nothing and the manifest default stands. The audience posture goes throughresolveAudience, which already reads an off-vocabulary posture asinvite_only. Every numeric answer is a number, so theOS_*coercion type is unchanged for every key.Not declared, with the reason in the module header. The rate-limit pair: with nothing stored, sign-in, sign-up and password reset run on the auth library's per-path rules (and its production-only switch); a declared
rateLimitis a global pair, not the per-endpoint cap the setting writes. No one number states what runs, so this stays an open question for the seat.api_key_policy_started_atis recorded into the store at first boot.google_enabledis an intent toggle whose runtime default is the manifest's on. The Google credentials: a declared credential outranks a saved one, so it is not what a clear returns to, and a secret is never served as a default.Sign-up forced off over a value saved on (
auth-settings-live-status.ts).describeSignUpLiveStatussays whensignup_enabledreads on (stored) and the deployment forces sign-up off whatever is saved (AuthManager.resolveDisableSignUp(false): SSO-only, cloud-managed,OS_DISABLE_SIGNUP). The switch is shown while email and password is not off. The statement is awarning, written in all 11 languages of the copy table. The provider inbindAuthSettingsasks both statements.combineAuthLiveStatusfolds them into the one banner the settings service takes: the first title, each statement's body in order. With nothing stored, the switch already reads the forced off through the declared default and nothing is stated.Read first (by risk):
packages/plugins/plugin-auth/src/auth-settings-declared-defaults.ts: the 24 new formulas against the readers they mirror.packages/plugins/plugin-auth/src/auth-plugin.ts: the live-status provider hunk.packages/plugins/plugin-auth/src/auth-settings-live-status.test.ts: theEXPECTEDtable and therunning()reader.Why
With nothing saved, Setup → Authentication showed the manifest default for every auth key while the running system enforced the deployment's own declaration. The same defect was fixed for three switches in #38180. The page also showed self-registration on, with nothing saying otherwise, where an SSO-only or cloud-managed runtime forces it off.
Tests
All in
auth-settings-live-status.test.ts, the file that already holds this harness. The boot and page helpers move to module scope, and two describes are added. They use the realAuthPlugin, the realSettingsServiceand the realGET /api/settings/:namespacehandler.getand the page route answer{ value, source: 'default' }. No banner.AUTH_SETTING_RESTOREkey reads its manifest default.membershipPolicyleaves the manifest default.lockout_threshold).lockoutThreshold: 5,lockout_duration_minutes: 5000is refusedSETTINGS_VALIDATIONat that field. CONTROL, nothing declared: the key is hidden and the same save is stored.warningis stated (en, zh-CN). CONTROL, self-hosted: saved on over a declared off is applied and nothing is stated. Cloud-managed: a row stored on is stated. With email and password held off as well, one banner carries both statements.describeSignUpLiveStatus(states, and the four cases that state nothing) andcombineAuthLiveStatus(none, one, two). The existing copy-table test checks every locale for the two new sentences.Acceptance notes
Clause-②: yes (narrowing)is declared here and in the changeset. The claim's line readClause-②: no. The claim also says a key whose change reaches an existing reader is declared per AGENTS.md, and the resolved values of 24 keys change for an existing reader, so the narrowing is declared.lockoutDurationMinutes: 2000declared, then a save oflockout_threshold.service-settings: the seam from fix(plugin-auth)!: Setup → Authentication's switches show what the deployment runs when nothing is saved #38180 holds every key unchanged.Verification
Measurement and reverse verification on base 23fa361
git restore --source(unstaged), then restored withgit restore --source=HEAD --staged --worktree(git status --porcelainempty after):auth-settings-declared-defaults.tsfrom base: 3 failed, 21 passed. The declared case fails atpassword_min_length: expected value 12, received 8. The clear case fails atexpected value 5, received 0(the running config restores 5). The visibility case fails because the save resolved instead of rejecting. Every CONTROL passed.auth-plugin.tsfrom base: 2 failed, 22 passed. The SSO-only and cloud-managed sign-up cases fail withexpected undefined to match object(no banner). The unit cases passed.Local runs at head 53c0290
pnpm --filter '@objectstack/plugin-auth^...' build, thenpnpm --filter @objectstack/plugin-auth build, thenpnpm --filter @objectstack/plugin-auth typecheck && pnpm --filter @objectstack/plugin-auth test(tsc, the examples project,check:test-typecheck): Test Files 297 passed (297), Tests 6331 passed, 10 skipped (6341). Lock verdictcommand-exit 0.node scripts/pm/dispatch-gates.mjs --commandsgave 77. The--ranreconciliation with exit codes: 77 accounted, 74 run with exit 0, 3 NOT MEASURED (exit 3, prerequisite).node scripts/check-plugin-teardown-shape.mjs --self-testneeds an unshallowed clone.pnpm check:dual-build-cjs-loadsreads built output of packages outside this closure.pnpm check:type-check-debt's re-measure got no turn on the shared verify lock (queue-timeout, held by another seat's dogfood run). CI runs all three. Families CI runs are read from this PR's check-runs, not re-run here.!). It is queued on the verify lock at this head, and its reading goes to the dev report comment on the card.Two-minute check:
pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/auth-settings-live-status.test.ts. Expect 24 passed; the first new case readslockout_thresholdas{ value: 5, source: 'default' }on a deployment that declareslockoutThreshold: 5.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses. (No formatter ran;pnpm lintis the CI-owned repo scan, not run locally.)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK