Repository navigation
fix(auth)!: a server outside development mode refuses a development seed credential - #34717
Conversation
…tial Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…t seed credential refusal Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…is bounded, and the session read-count pin names the stamp read Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…ord suite pays its loads at module top, and the tenant audit census counts the new writes Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…eld, served to nobody Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
|
security#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj Release: security#2 clocks out (maintainer, verbatim 「当前任务处理完,合并后就下班」). This draft returns to the queue for the sibling seat State: GHSA-gpr7 (medium), maintainer ruling A. Ruling items 1 and 2 are on the branch; item 3 is owed and unimplemented. The PR has had no contract review. It was stopped under the maintainer's 「中危不继续修」; whether it resumes is the holder's call within the maintainer's direction. |
|
security#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj |
Conflicts: - packages/plugins/plugin-auth/src/auth-manager-membership-admission.ts: both sides kept (the seed stamp staging, then main's invitation-admission staging). - content/docs/permissions/tenant-audit-census.mdx and docs/audits/2026-08-tenant-audit-write-call-sites.counts.md: main's version taken; the census is regenerated over the merged tree in the next commit. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 56 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 15 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 51 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 7254162e136c4a00469fc621fc876a3b87445edd && git checkout 7254162e136c4a00469fc621fc876a3b87445edd
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0967cbe6a2919413952ab3521b9d7771a5398274 634321be6f3b78a9fa8e5e96445f8b2b49559054 && git checkout -B drift-repro 0967cbe6a2919413952ab3521b9d7771a5398274 && git merge --no-ff 634321be6f3b78a9fa8e5e96445f8b2b49559054
node scripts/docs-audit/affected-docs.mjs --json 0967cbe6a2919413952ab3521b9d7771a5398274
|
… merged tree The three plugin-auth write call sites this branch adds are placed in the per-package shard main now carries; the page holds no live total. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…kens before the password lands `os user set-password` sets a password, so it keeps the rule every password door now keeps: the account's outstanding password-reset rows are ended before the new credential is written. The CLI holds no server cache, so it ends the rows, as the raw adapter does. Docs and changeset state it at that reach. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…lugin-auth shard Regenerated with `node scripts/tenant-audit-census.mjs --write`. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…`os user set-password` before `os start` A server outside development mode refuses the development seed password, so the fixture takes the documented step between `os dev` and `os start` and signs in to the production boots with the password it set. Its assertions are unchanged. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…he call The built entry runs from dist/ only when the child is readably not in development or test; the env overrides are shared, the NODE_ENV clause is spelled at both spawns. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…at proved the seed's own provisioning ticket The operator class is wider than the seed: an administrator's create-user, a bulk import and directory provisioning earn it too. The mark now keys on the proven ticket alone, so `os dev`'s admin and each `demoStaff` account are marked and an administrator-created account is not. Pinned: an account an administrator creates in development carries no mark and signs in outside development mode; the phone-number password sign-in refuses the seed password. Docs and changeset: the operator reset states exactly what it checks, its reach over a host secondary storage for reset links and sessions alike with the remedy, and the release's present limit with its follow-up; the ADR-0087 marker says a system column is added. The verifier's fail-closed answer is commented with its effect on the sign-in lock. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
|
security#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj The seat adopts the delta record below. The same isolated reviewer rendered it on this head at the contract-review tier, after a FAIL at Contract reviewServed-tier: ① Derived judgments
Findings at this head
② Semver levelUnchanged and correct:
③ Boundary flags
④ Design judgmentKeying the mark on the proven ticket, not on a creation class, ties it to the one act that defines a seed credential. It cannot widen when a new operator-class method is added. Implemented-by: VERDICT: PASS |
|
security#2 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj 席位核对ACCEPT · head
|
Clause-②: yes (narrowing)
Metadata-protocol: none
维护者速读
NODE_ENV不是development)的服务器不再接受开发种子凭据:用开发种子密码(admin123,或OS_SEED_ADMIN_PASSWORD的值)登录一律拒绝;os dev种出的管理员和demoStaff账号(只有走种子自身开通票据的创建)带种子标记,管理员建的账号不带,密码仍是种子密码时任何登录方式都不开会话。新增os user set-password EMAIL,在服务器上直接改密码,拒绝提示里点名它。本 PR 只落裁决第 1、2 项。os start、os serve、镜像与自定义宿主一并覆盖。维护者续裁:「已经开发完的要继续跟进到合并」「只合前两项:第三项另开一张跟进卡。」os user set-password结束,开机时结束它们是 Leaving development mode retires what the development seed issued (follow-up to #34717) #35184。生产模式每次建会话多一次sys_user读。回滚即 revert 本 PR(新列留空无害)。packages/plugins/plugin-auth/src/dev-seed-credential.ts(三条拒绝与种子标记)、auth-manager-membership-admission.ts(种子标记只在种子开通票据被证实时暂存)、operator-password-reset.ts(改密:先清掉该账号未用的重置令牌,再写密码、撤会话与 API key)。pnpm --filter @objectstack/plugin-auth exec vitest run src/dev-seed-credential-production.test.ts,应见 13 个用例全绿(含管理员建号对照组:开发模式建、生产模式能登录)。What changes
The rule: a server that is not in development mode never accepts a development seed credential. Development mode is
NODE_ENV=development, the condition the development seed itself runs under. The rule lives in@objectstack/plugin-auth, soos start,os serve, the image and a custom host all apply it. This PR lands ruling items 1 and 2.refuseDevSeedPasswordSignIn, first in the globalhooks.before). A password sign-in (/sign-in/email,/sign-in/username,/sign-in/phone-number) that submits the development seed password (admin123, or the valueOS_SEED_ADMIN_PASSWORDsets) answers403 PERMISSION_DENIEDwith a sentence namingos user set-password EMAIL. It is decided on the submitted password alone, so every address gets the same answer.withDevSeedPasswordRefusal, wrapping the pair handed toemailAndPassword.password): a seed password, or the hash a marked account still holds from the seed, is answered as a wrong password on every door that checks a password.sys_user.dev_seed_credential(new,internal,readonly, indexed, translated in all locales) holds a SHA-256 digest of the password hash the seed stored, never the password. It is staged by the audience gate only for a creation that proved the development seed's own provisioning ticket for its address (os dev's admin, eachdemoStaffaccount), never for the wider operator class (an administrator's create-user, a bulk import, directory provisioning), and written inaccount.create.after, in development only. Any password change stops it matching.refuseDevSeedCredentialSession, insession.create.before), on every door: password, emailed link, one-time code, passkey, social or SSO, impersonation and a minted session. The answer is403 PERMISSION_DENIEDnaming the reset command; a read that fails answers503, as the sibling refusals do.os user set-password EMAIL(newusertopic). It resolves the account first, reads the password from an unechoed prompt (twice) or--password-stdin, never from argv. plugin-auth'ssetOperatorPasswordchecks exactly two things about the new password, that it is not a seed password and that it is 8 to 128 characters (the deployment's own password policy and history are not applied), refuses an account with no password credential, deletes the account's outstanding password-reset rows before the new password lands (the rule every password door keeps,credential-change-ends-reset-tokens.ts), writes better-auth's own hash, clears the mark and any sign-in lock, stampspassword_changed_at, and ends every session and revokes every API key of the account (revokeSessionsAndApiKeys). It sets no forced change. It writes the project database only: a host secondary storage is out of its reach for reset links and sessions alike, and the docs give the remedy (run it with the server stopped, or restart the server afterwards).content/docs/deployment/cli.mdx(the command),content/docs/deployment/self-hosting.mdx(the rule). Changeset:.changeset/dev-seed-credential-production-refusal.md(BREAKING banner,Clause-②, ADR-0087not-requiredmarker naming the added system column). Both the changeset andself-hosting.mdxstate the release's present limit: sessions and API keys a seeded account was issued before the server left development mode are ended byos user set-password, and ending them at boot is follow-up Leaving development mode retires what the development seed issued (follow-up to #34717) #35184.Tests
packages/plugins/plugin-auth/src/dev-seed-credential-production.test.ts(13; realObjectKernel+ ObjectQL on SQLite +AuthPluginwith onedemoStaffentry +SecurityPlugin, seeded in development, then served by a secondAuthManageroutside development): development control; an account an administrator creates in development (better-authcreateUser, as/admin/create-userdrives it) carries no mark while the seed's accounts on the same boot do, and it signs in outside development mode; the mark is a digest and never served; the seed admin refused 403 with the command and no session; a demo account refused; the phone-number password sign-in refused; an unknown address answered identically; an unmarked account on the seed password refused; a marked account on a custom seed password answered as a wrong password with no session; the emailed sign-in link opens no session for it; aftersetOperatorPasswordthe new password signs in, the mark is gone and the development session is ended; the reset ends the account's outstanding reset links and no other account's; the reset's refusals write nothing.packages/plugins/plugin-auth/src/dev-seed-credential.test.ts(7, unit): the seed password set, the sign-in refusal's doors and development passthrough, the verifier's answers./sign-in/usernamestays in the refused set but has no real-pipeline case: the platform's own composition serves no username plugin.packages/cli/src/commands/user/set-password.integration.test.ts(3, real SQLite file through oclif): sets the password from stdin in the format a server verifies and ends the session and the API key; refuses the seed password and writes nothing; refuses an unknown address before asking.packages/cli/src/utils/schema-migrate.one-shot-family.integration.test.ts: the command joins the one-shot family.packages/cli/test/dev-start-shared-data-key.integration.test.ts: the fixture serves anos devdatabase underos start, so it now runsos user set-passwordbetween the two boots and signs in with the password it set. Its assertions are unchanged.packages/qa/dogfood/test/colleague-lookup-over-mcp.dogfood.test.ts: the directory set leaves out aninternalcolumn served to nobody.Acceptance notes
origin/mainmerged at4b1eb0eab7(220 first-parent commits). Conflicts:auth-manager-membership-admission.tskept both sides (the seed mark staging, then main's invitation-admission staging); the two tenant-audit census files took main's version and the plugin-auth shard was regenerated withnode scripts/tenant-audit-census.mjs --write.setOperatorPasswordalso keeps main's rule that a password set ends the account's outstanding reset tokens. It deletes the rows in the project database before the write; a hostsecondaryStorageis not reachable from the CLI, the same reach as the raw adapter (createObjectQLAdapter), and the docs and changeset state that reach.Verification
Tree
objectstack-ai/objectstack, branchclaude/sec2-gpr7, final headcc6754e708. Each reading names its commit; the last round (222a618930tocc6754e708) touched plugin-auth source and tests, two docs pages and the changeset only.Suites (under scripts/pm/os-verify-lock.sh)
pnpm --filter @objectstack/plugin-auth build && pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 && pnpm --filter @objectstack/plugin-auth typecheckoncc6754e708: 287 files passed; 6017 passed, 10 skipped; typecheck exit 0.cc6754e708(dev-seed-credential-production,dev-seed-credential): 20 passed.pnpm --filter @objectstack/platform-objects exec vitest run --maxWorkers=2on16228898f8: 123 files, 2047 passed.pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2on16228898f8: 428 files, 6098 passed.--project integration, the set-password suite and the one-shot family: 2 files, 182 passed.test/dev-start-shared-data-key.integration.test.tson222a618930: 6 passed. The rest of the integration layer is declared to CI (Test Core, green oncc6754e708).first-session-membership-orderingandcredential-change-ends-reset-tokenson6d75801d76: 4 files, 55 passed.Ablation (each mutation red, then restored)
On
cc6754e708, againstdev-seed-credential-production.test.ts(13 tests), one leg per wiring point, each throughscripts/ablation-replace.mjswith the blob equal to HEAD andgit diff HEADempty after the restore: sign-in refusal 4 red; verifier 1 red; session refusal 1 red; mark staging removed 6 red; mark staged on the operator class instead of the proven ticket 1 red (the administrator-created control); reset-token end in the operator reset 1 red. Control: 13 of 13.Type check
turbo run typecheck --filter='...@objectstack/plugin-auth' --filter='...@objectstack/platform-objects' --filter='...@objectstack/cli' --concurrency=2on6178523ef4: 158 of 158 tasks successful. Oncc6754e708,TypeScript Type Checkis green in CI.pnpm --filter @objectstack/cli typecheck && pnpm --filter @objectstack/plugin-auth typecheckon222a618930: exit 0. plugin-auth typecheck oncc6754e708: exit 0.Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackon222a618930: 125 families. 125 exited 0 (check:type-check-debtexited 3 while the verify lock was held and 0 on a retry).--ran: 125 derived, 125 run, 0 NOT MEASURED.check:tenant-audit-censusandcheck:cli-test-child-envexit 0. Oncc6754e708the derivation is the same 125 families; the 102 that read the last round's seven files were re-run, all exit 0, and--ranreads 102 derived, 102 run, 0 NOT MEASURED.Dogfood battery
pnpm --filter @objectstack/dogfood teston222a618930(the last round moves no door-level assertion, so it was not re-run): 483 files, 480 passed, 3 skipped; 4143 tests, 4075 passed, 68 skipped, 0 failed.CI on cc6754e
All required contexts green:
Lint & Repo Gates,TypeScript Type Check,Test Core(10 of 10 shards),Build Core,Governed Surface Queue Guard,Live E2E UI,Test UI,Dogfood Regression Gate;Lint UI,Type Check UI,Build & E2E UIskipped by their selectors. 41 success, 15 skipped, 0 failed.Generated by Claude Code