feat(spec,hono): user-level export permission axis (#3544)#3553
Merged
Conversation
Make `export` a user-gated operation, not just "anyone who can list", wiring the `userExportAllowed` slot reserved in #3391 P1. - spec: ObjectPermissionSchema gains an optional `allowExport` bit — no default, so it is a backward-compatible opt-out: unset inherits read (today's can-list ⇒ can-export), false denies export while keeping read, true grants. - plugin-hono-server: annotateEffectiveApiOperations derives userExportAllowed = allowExport !== false and threads it into resolveEffectiveApiMethods (export ⊆ list ∧ userExportAllowed). When the axis removes export from an otherwise-open object, that object is now annotated (effective set minus export) so the client hides Export; an open object with export still allowed stays unannotated (default-allow). - Regenerated content/docs/references/security/permission.mdx. Zero change to the derivation table or the frontend (already consumes the effective apiOperations). Existing permission sets keep today's behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012L8EfEa157Pe6C73qRnaJH
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 105 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
…stry (#3544) The new allowExport property on ObjectPermissionSchema is a governed-type property and must carry a liveness classification. It is `live` — enforced end-to-end via the hono /me/permissions annotate (userExportAllowed) → effective apiOperations → REST export gate + UI. Fixes the "Spec property liveness" gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012L8EfEa157Pe6C73qRnaJH
os-zhuang
marked this pull request as ready for review
July 27, 2026 04:44
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.
背景
#3391 的 follow-up ①(见 #3544)。P1 里
export派生自list(export ⊆ list),意味着「任何能 list 的用户即可一键全表导出」——与 Salesforce "Export Reports" / Dynamics "Export to Excel" / NetSuite "Export Lists" / SAPS_GUI 61的独立导出权限轴不符。本 PR 接入 P1 预留的userExportAllowed槽,把 export 变成用户级可门控的操作。改动
ObjectPermissionSchema新增可选allowExport位。故意不设默认值 —— 是向后兼容的 opt-out:false→ 保留读、但禁止导出;true→ 显式授予。annotateEffectiveApiOperations从解析后的 per-object 权限推导userExportAllowed = allowExport !== false,传入resolveEffectiveApiMethods(export ⊆ list ∧ userExportAllowed)。当该轴把 export 从本来全开的对象移除时,现在会给该对象下发注解(effective 集去掉 export),前端据此隐藏 Export 按钮;export 仍允许的全开对象保持不注解(前端 default-allow)。content/docs/references/security/permission.mdx。契约 / 兼容
对派生表与前端零契约变更(前端已消费 effective
apiOperations,objectui#2823)。现有权限集(无allowExport)处处保持今天行为。默认取 opt-out(而非 opt-in)以保证零 breaking;若要改为严格 opt-in,建议放到 P2(#3543)窗口一并做。测试
allowExport可选、无默认(未设 = undefined;true/false 正常解析);api-derivation的userExportAllowed=false用例已覆盖 resolver 侧。allowExport:false从收紧对象移除 export;从全开对象强制注解移除 export 而保留其余;未设则继承 read(全开对象仍不注解);true保留 export。关联
userExportAllowed)。🤖 Generated with Claude Code
https://claude.ai/code/session_012L8EfEa157Pe6C73qRnaJH
Generated by Claude Code