Repository navigation
test: pin that a guest request reaches create hooks as a named caller - #30179
Merged
Merged
Conversation
The guest entry's envelope must keep a caller field the engine's session hop copies, so a create hook that skips context-less engine calls never reads an anonymous request as one. Three pins, test-only: - core: the guest envelope keeps the guest position under every face input; - objectql: buildSession of the real guest envelope is a session naming no user, with a control that an envelope naming nothing yields none; - service-storage: through the wired engine, a guest-context create of an attachment is refused 403 RECORD_NOT_ACCESSIBLE and writes no row. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
Contributor
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
Contributor
Author
|
security#1 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj 席位核对ACCEPT · head
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
维护者速读
*.test.ts,发布产物字节不变);回滚即 revert 本 PR。packages/objectql/src/engine-execution-plumbing.session-locale.test.ts(会话那一跳的钉子)、packages/services/service-storage/src/attachment-access-hooks.test.ts(整机引擎创建被拒)、packages/core/src/security/assemble-execution-context.test.ts(信封端)。pnpm --filter @objectstack/service-storage exec vitest run src/attachment-access-hooks.test.ts -t "guest request",预期 2 passed。What changes
Test-only. One rule, pinned at three layers: a request served through the guest entry reaches create hooks as a named caller, so it is never read as a context-less (bare-kernel) engine call.
@objectstack/core— the guest envelope keeps theguestposition under every input a face can pass for an anonymous request (no tenant / no grants, and guest-anchor grants in an organization).@objectstack/objectql—buildSessionof the envelope the realassembleExecutionContextOrGuestproduces is defined and names no user (and is not the system arm); a control pins that an envelope naming nothing the session copies yields no session.@objectstack/service-storage— through the wired engine (realObjectQL+ the installed attachment hooks), a create ofsys_attachmentunder the real guest envelope is refused403 RECORD_NOT_ACCESSIBLEand writes no row; control: the same create by a signed-in caller resolves and stamps that caller as the uploader.New pins are top-level
describeblocks in each component's existing test file. No product code changes, soskip-changeset: none of the three packages'files[](dist,README.md,CHANGELOG.md) changes — the new test titles have zero hits in the threedist/trees whileassembleExecutionContextOrGuest(positive control) hitspackages/core/dist/index.js.Tests
All on head
36bffe5b4c.Changed files and package suites
assemble-execution-context.test.ts212/212, objectqlengine-execution-plumbing.session-locale.test.ts5/5, service-storageattachment-access-hooks.test.ts153/153; each new test confirmed by name under--reporter=verbose.os-verify-lock.sh: core 133 files / 2974 tests passed; service-storage 71 / 1329 passed; objectql 548 / 10846 passed; each exit 0.typecheckfor core, objectql, service-storage: exit 0 (each package'scheck:test-typecheckOK).One-shot ablation: drop the guest position from the guest envelope
Mutation via
scripts/ablation-replace.mjsonpackages/core/src/security/assemble-execution-context.ts: the guest arm ofpositionsreplaced with an expression that evaluates to undefined (anchor 1 to 0, blob442040f156dfto0039cf95db86). core rebuilt under the lock;ablation-dist-preflightfound the marker indist/index.jsanddist/index.cjs.dist/): exit 1, exactly the new session pin red (expected undefined to be defined); its control stayed green.Restore: blob equals HEAD,
git diff HEADempty; core rebuilt,--absentpreflight clean over 14 built files, objectql file green again (5/5).Acceptance notes
buildSessiontreats an emptypositions: []as present (its presence test is!== undefined), so the identification hinges on the key being emitted at all, not on its contents; the pins assert theguestvalue, which is the declared vocabulary.toEqualon the guest envelope) already went red under the ablation; the new pin names the rule so the reason survives a future edit of that frozen transcription.Verification
Gate derivation and reconciliation
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 57 commands for the 3 changed paths. All 57 run, exit codes captured before any pipe;--ranreconciliation: "57 derived famil(ies) accounted for — 55 run, 2 NOT-MEASURED".pnpm check:dual-build-cjs-loads(needs every package'sdist/) andpnpm check:i18n(needs the CLI build closure). Neither reads test files; CI'sLint & Repo Gatesruns both on a full build.test:repoare left to CI.Generated by Claude Code