Skip to content

fix(plugin-auth)!: Setup → Authentication shows what the deployment runs for every declared auth setting, and says when sign-up is forced off - #38255

Draft
objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/issue-38184-auth-declared-defaults
Draft

objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/issue-38184-auth-declared-defaults

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #38184

Clause-②: yes (narrowing) — narrowed: with nothing stored, SettingsService.get('auth', …) and GET /api/settings/auth answer 24 more auth keys with the deployment's declaration (still source: '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_minutes under a declared lockoutThreshold above 0 (for example lockout_duration_minutes: 5000 is now refused 400 SETTINGS_VALIDATION where it was stored), mfa_grace_period_days under a declared mfaRequirement other than off, password_min_classes under a declared passwordRequireComplexity: true, and audience_allowed_email_domains / audience_self_registration_permission_set under a declared audience.posture of email_domain or open. 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 a warning for signup_enabled stored 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.

维护者速读

  • 管理员在 设置 → 认证 里、没保存过值时,密码规则、多因素、会话时长、锁定、IP 白名单、成员策略、注册受众等设置显示部署实际在跑的值,不再显示清单默认值;被部署强制关闭注册却保存为开时,页面顶部会给出警告。
  • 接着上一轮只修了三个开关的工作,把同一问题在其余认证设置上一次补齐(托管云环境统一登录工作的一部分)。
  • 出错时管理员会在没保存值的情况下看到与实际不符的设置值,或某些原本隐藏的设置在保存时被校验拒绝;已保存的值不受影响,可直接撤回本改动。
  • 无。

What changes

Measured first, on base 23fa3619 (after the declared-default seam landed). A real AuthPlugin over the real SettingsService, booted twice per key: once declaring nothing, once declaring a value other than the manifest default. Declaring nothing, every key in AUTH_SETTING_RESTORE resolved what runs, except the rate-limit pair and google_enabled (below). Declaring a value, every key resolved the manifest default while the running config took the declaration.

key declared resolved on base running
password_min_length / password_max_length minPasswordLength: 12 / maxPasswordLength: 64 8 / 128 12 / 64
membership_policy invite-only auto invite-only
password_reject_breached, password_require_complexity true false true
password_min_classes, password_history_count, password_expiry_days 2, 5, 90 3, 0, 0 2, 5, 90
mfa_required, mfa_grace_period_days administrators, 3 off, 7 administrators, 3
api_key_default_expiry_days, api_key_max_expiry_days, api_key_inactivity_days 30, 180, 0 90, 365, 90 30, 180, 0
session_expiry_days, session_refresh_days expiresIn 30 d, updateAge 2 d 7, 1 30, 2
session_idle_timeout_minutes, session_absolute_max_hours, max_concurrent_sessions_per_user 30, 12, 3 0, 0, 0 30, 12, 3
allowed_ip_ranges two ranges nothing the two ranges
lockout_threshold, lockout_duration_minutes 5, 30 0, 15 5, 30
audience_posture, audience_allowed_email_domains, audience_self_registration_permission_set email_domain, two domains, member_default invite_only, nothing, nothing as declared
rate_limit_max / rate_limit_window_seconds rateLimit 5 / 120 10 / 60 the declared global pair; per-path rules on sign-in
google_enabled, google_client_id, google_client_secret Google declared in socialProviders on, nothing, nothing on with the declared credential

The declarations (auth-settings-declared-defaults.ts). AUTH_DECLARED_DEFAULTS grows from 3 keys to 27. Each formula reads the declaration captured in init() (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, and buildPluginList'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 through resolveAudience, which already reads an off-vocabulary posture as invite_only. Every numeric answer is a number, so the OS_* 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 rateLimit is 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_at is recorded into the store at first boot. google_enabled is 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). describeSignUpLiveStatus says when signup_enabled reads 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 a warning, written in all 11 languages of the copy table. The provider in bindAuthSettings asks both statements. combineAuthLiveStatus folds 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):

  1. packages/plugins/plugin-auth/src/auth-settings-declared-defaults.ts: the 24 new formulas against the readers they mirror.
  2. packages/plugins/plugin-auth/src/auth-plugin.ts: the live-status provider hunk.
  3. packages/plugins/plugin-auth/src/auth-settings-live-status.test.ts: the EXPECTED table and the running() 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 real AuthPlugin, the real SettingsService and the real GET /api/settings/:namespace handler.

  • Declared: one deployment declares a non-default value for all 24 keys. For each key the test asserts that the running config takes the declared value (read off the manager as enforcement reads it), that the value differs from the manifest default, and that get and the page route answer { value, source: 'default' }. No banner.
  • CONTROL, keys not stated: on the same deployment, the rate-limit pair and the Google trio keep the manifest default.
  • CONTROL, nothing declared: every AUTH_SETTING_RESTORE key reads its manifest default.
  • CONTROL, a declaration equal to the manifest default: the same value is read.
  • An off-vocabulary membershipPolicy leaves the manifest default.
  • A stored value wins, and a clear returns to the declaration (lockout_threshold).
  • The accept-set narrowing: under a declared lockoutThreshold: 5, lockout_duration_minutes: 5000 is refused SETTINGS_VALIDATION at that field. CONTROL, nothing declared: the key is hidden and the same save is stored.
  • Sign-up: under SSO-only with nothing stored, the switch reads off and there is no banner. Saved on, it is not applied and a warning is 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.
  • Unit: describeSignUpLiveStatus (states, and the four cases that state nothing) and combineAuthLiveStatus (none, one, two). The existing copy-table test checks every locale for the two new sentences.

Acceptance notes

  • The rate-limit pair still reads 10 / 60 with nothing stored, while the auth library's own per-path rules run (and only in production). This card does not carry that mismatch, because no single number states it. It is an open question in the dev report for the seat (options: state it as nothing, or add a statement to the live-status banner).
  • Clause-②: yes (narrowing) is declared here and in the changeset. The claim's line read Clause-②: 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.
  • A declared value outside a specifier's bounds is answered as declared, because it is what runs. A save that touches the key, or a key that gates its visibility, is then refused at that key, as for a stored value below a raised floor. Example: lockoutDurationMinutes: 2000 declared, then a save of lockout_threshold.
  • No change to 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
  • Measurement: a scratch test (not committed) booted the real plugin per key with and without a declaration. Its results are the table above.
  • Reverse verification, fix committed, each file restored from base with git restore --source (unstaged), then restored with git restore --source=HEAD --staged --worktree (git status --porcelain empty after):
    • auth-settings-declared-defaults.ts from base: 3 failed, 21 passed. The declared case fails at password_min_length: expected value 12, received 8. The clear case fails at expected 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.ts from base: 2 failed, 22 passed. The SSO-only and cloud-managed sign-up cases fail with expected undefined to match object (no banner). The unit cases passed.
Local runs at head 53c0290
  • Dependency closure pnpm --filter '@objectstack/plugin-auth^...' build, then pnpm --filter @objectstack/plugin-auth build, then pnpm --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 verdict command-exit 0.
  • Derived gate families: node scripts/pm/dispatch-gates.mjs --commands gave 77. The --ran reconciliation with exit codes: 77 accounted, 74 run with exit 0, 3 NOT MEASURED (exit 3, prerequisite). node scripts/check-plugin-teardown-shape.mjs --self-test needs an unshallowed clone. pnpm check:dual-build-cjs-loads reads 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.
  • Dogfood battery: owed at the final head (title carries !). 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 reads lockout_threshold as { value: 5, source: 'default' } on a deployment that declares lockoutThreshold: 5.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (No formatter ran; pnpm lint is the CI-owned repo scan, not run locally.)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK

… 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
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-auth, touching 19 documentable anchor(s).

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/protocol/kernel/config-resolution.mdx (via email_password_enabled (literal, a string literal in bindAuthSettings), signup_enabled (literal, a string literal in bindAuthSettings))
What this run could not see
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 21 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json e42520c67bcef027552f8db83655ff9b54d32cef → packageMentionDocs.

Which tree this was computed on

This run read content/docs from d0d958d26fdc2b8b2e4f7bddcd049c7dad7f07ea — the merge of head 53c02901f87dc30eae502ae2649f1a5250de41e1 into base e42520c67bcef027552f8db83655ff9b54d32cef, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs e42520c67bcef027552f8db83655ff9b54d32cef → pass the list as
args.docs, on the commit named under Which tree this was computed on.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings: other auth keys still show the manifest default, not the deployment declaration, when nothing is stored

2 participants