fix(plugin-security,plugin-hono-server): ADR-0090 live-test fixes + permission-model test suite#2910
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 13 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
| // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. | ||
|
|
||
| import { Plugin, PluginContext, IHttpServer, IDataEngine } from '@objectstack/core'; | ||
| import { Plugin, PluginContext, IHttpServer, IDataEngine, resolveAuthzContext } from '@objectstack/core'; |
…ermission-model test suite Live testing of docs/design/permission-model.md against app-showcase (49 REST assertions + 11 Playwright cases incl. console UI evidence) surfaced two engine defects, both fixed with regression tests: - plugin-security: computeWriteCheckFilter dropped the caller's held positions, so position-scoped write-time `check` policies (ADR-0058 D4) never fired — an owner transfer that should be rejected was allowed. - plugin-hono-server: resolveCtx hand-rolled identity resolution and skipped sys_user_position / sys_position_permission_set, so /auth/me/permissions under-reported position-granted capability and the console rendered read-only forms while the data plane accepted the same writes. Now delegates to the shared resolveAuthzContext. Test artifacts kept under examples/app-showcase: - docs/test/permission-model-test-checklist.md (A–M matrix) - docs/test/permission-model-test-report.md (findings + evidence) - docs/test/scripts/perm-setup.sh / perm-test.sh (49-assertion REST suite) - e2e/permission-model.spec.ts + playwright.permission.config.ts (opt-in config; excluded from the default smoke run via testIgnore) - docs/test/screenshots/L1–L5 console UI evidence
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.
Summary
Live-tested docs/design/permission-model.md (ADR-0090) end-to-end against
examples/app-showcase— 49 REST assertions + 11 Playwright cases including real console UI runs with evidence screenshots. Testing surfaced two engine defects, both fixed here with regression tests.Engine fixes
1. plugin-security — write-time
checkpolicies dropped position applicability (checklist G4)computeWriteCheckFiltercalledcollectRLSPolicieswithout the caller's held positions, so acheckpolicy declaring apositionsdomain never fired for its holders — an owner transfer that ADR-0058 D4 post-image validation should reject was silently allowed, diverging from the read path (using). Fixed by passingcontext.positions; +3 regression tests.2. plugin-hono-server —
/auth/me/permissionsidentity-resolution drift → console fake read-only (checklist L5)resolveCtxhand-rolled identity resolution and skippedsys_user_position/sys_position_permission_set, violating the invariant documented inpackages/core/src/security/resolve-authz-context.ts(every HTTP entry point must use the shared resolver). Position-granted capability never reachedGET /api/v1/auth/me/permissions: the console rendered fully read-only forms for users whose writes the data plane (which uses the shared resolver) accepted. Fixed by delegating toresolveAuthzContext, return shape aligned with@objectstack/rest; +2 regression tests.Test artifacts (kept, repeatable)
examples/app-showcase/docs/test/permission-model-test-checklist.mdexamples/app-showcase/docs/test/permission-model-test-report.mdexamples/app-showcase/docs/test/scripts/perm-{setup,test}.shexamples/app-showcase/e2e/permission-model.spec.tstestIgnore)examples/app-showcase/playwright.permission.config.tsexamples/app-showcase/docs/test/screenshots/L*.pngUI evidence highlights
viewAllRecords) sees all inquiries and foreign private notes.budget/spentdisabled by FLS whilestatus/dates stay editable — this is the case that exposed fix ✨ Set up Copilot instructions #2 (before the fix the whole form was disabled).Verification
pnpm -C packages/plugins/plugin-security test→ 329/329 ✅pnpm -C packages/plugins/plugin-hono-server test→ 66/66 ✅ (incl. 5 new regression tests across both packages)Changeset included (patch × 2).