fix(approvals): guard self-service OOO delegation writes + i18n (#1322)#3255
Merged
Merged
Conversation
Follow-up hardening on the merged OOO delegation feature (#3235). Security — delegator forge guard: sys_approval_delegation is apiEnabled CRUD, but as a system object it gets no owner_id anchor and defaults to a `public` sharing model, so an unguarded member could create a delegation naming SOMEONE ELSE as delegator and reroute that victim's individually-routed approvals to themselves. bindDelegationWrite- Guard (plugin-approvals beforeInsert/beforeUpdate, mirroring the ADR-0092 identity write-guard) forces a normal user's writes to name themselves as delegator: system context bypasses, admins (roles include 'admin') may set any delegator, everyone else is stamped-to-self on insert and rejected on a foreign delegator. Row ownership on update/delete is already covered by member_default's wildcard `created_by == current_user.id` RLS. i18n: Register sys_approval_delegation in the plugin's i18n extract config and add its object/field/view translations. zh-CN fully translated; en/ja-JP/es-ES carry the English baseline pending translation. (Blocks hand-added to avoid a full re-extract dropping existing enum/view keys.) Tests: 9 new guard cases (self-create, forge reject on insert/update, stamp on omit, unauthenticated reject, system + admin bypass, batch). plugin-approvals 123 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016ypkQikZ55oWUHUnMebwXA
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 4 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
July 19, 2026 06:39
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.
Follow-up hardening on the merged OOO delegation feature (#1322 / #3235).
Security — delegator forge guard
sys_approval_delegationisapiEnabledCRUD so users can self-declare their out-of-office delegation. But it's a system object: it gets noowner_idanchor and (with nosharingModel) defaults to apublicsharing model. Un-guarded, a member could create a delegation naming someone else asdelegator_idand reroute that victim's individually-routed approvals to themselves.bindDelegationWriteGuard(plugin-approvalsbeforeInsert/beforeUpdate, mirroring the ADR-0092 identity write-guard) forces a normal user's writes to name themselves as delegator:rolesincludes'admin') → may set anydelegator_id;delegator_id(insert or update).Row ownership on update/delete (you can only touch a delegation you created) is already enforced by
member_default's wildcardcreated_by == current_user.idRLS — this guard adds the delegator-identity check RLS alone can't express. Reads staypublic, consistent with the siblingsys_approval_request(amy_delegationslist-view / read-scoping is a possible follow-up, matching platform convention for these optional-plugin system tables).i18n
Registered
sys_approval_delegationin the plugin's i18n extract config and added its object/field/view translations. zh-CN fully translated; en/ja-JP/es-ES carry the English baseline pending translation. Blocks were hand-added rather than via a full re-extract, because re-running extract here drifts and drops existing enum/view keys (recalled,escalate,My Pending, …) — the diff is pure additions, 0 deletions.Tests
9 new guard cases: self-create allowed; forge rejected on insert and update; stamp-on-omit; unauthenticated non-system rejected; system + admin bypass; batch insert with one foreign row rejected.
plugin-approvals123 passed; package build + eslint clean.Context
Community-core OOO delegation shipped in #3235 (#1322). Enterprise governance (act-as inbox, SoD, admin-over-others, compliance reporting) remains tracked in objectstack-ai/cloud#855.
🤖 Generated with Claude Code
Generated by Claude Code