model-fga-authorization
The procedure for changing the OpenFGA authorization model under backend/services/stigmer-server/fga, covering the file and its header, the suite that pins it, the regenerated JSON, the one command that proves it on the engine and the built-in evaluator, and what a new type needs in the server. Use when touching the model or its suites.
- License 许可
- Apache-2.0
- 所属仓库
- stigmer/stigmer
- 最近更新
- 2026-11-10
- Stars
- ★ 9
- Forks
- 6
01 前言 Front Matter
- name
- model-fga-authorization
- paths
- [ "backend/services/stigmer-server/fga/**" ]
- description
- The procedure for changing the OpenFGA authorization model under backend/services/stigmer-server/fga, covering the file and its header, the suite that pins it, the regenerated JSON, the one command that proves it on the engine and the built-in evaluator, and what a new type needs in the server. Use when touching the model or its suites.
02 资源文件 218
- 参考文档DEVELOPMENT.md16.4 KB
- 其他kendex.settings.toml.example3.4 KB
- 参考文档patterns/workflow-actions.md9.5 KB
- 参考文档README.md5.8 KB
- 参考文档references/authentication.md3.5 KB
- 参考文档references/request-journal.md2.5 KB
- 脚本scripts/commands/attachments.sh6.7 KB
- 脚本scripts/commands/auth-check.sh6.7 KB
- 脚本scripts/commands/auth-mint.sh902 B
- 脚本scripts/commands/comments.sh12.3 KB
- 脚本scripts/commands/cycles.sh8.8 KB
- 脚本scripts/commands/documents.sh3.9 KB
- 脚本scripts/commands/initiatives.sh17.9 KB
- 脚本scripts/commands/issues.sh161.2 KB
- 脚本scripts/commands/labels.sh14.5 KB
- 脚本scripts/commands/milestones.sh10.2 KB
- 脚本scripts/commands/project-labels.sh8.0 KB
- 脚本scripts/commands/projects.sh44.3 KB
- 脚本scripts/commands/session-status.sh23.7 KB
- 脚本scripts/commands/statuses.sh4.9 KB
- 脚本scripts/commands/teams.sh4.2 KB
- 脚本scripts/commands/users.sh4.1 KB
- 脚本scripts/lib/attachments.sh8.1 KB
- 脚本scripts/lib/auth.sh9.7 KB
- 脚本scripts/lib/bash-version.sh366 B
- 脚本scripts/lib/common.sh97.8 KB
- 脚本scripts/lib/cycle-dates.sh3.0 KB
- 脚本scripts/lib/formatters.sh30.7 KB
- 脚本scripts/lib/issue-validation.sh23.6 KB
- 脚本scripts/lib/kendex-env.sh18.0 KB
- 脚本scripts/lib/pages.sh16.7 KB
- 脚本scripts/linear.sh9.1 KB
- 脚本tests/api-key-precedence.test.sh7.8 KB
- 脚本tests/assert-outstanding-jobs.test.sh2.4 KB
- 脚本tests/assert-subshell.test.sh3.0 KB
- 脚本tests/assert-verdict.test.sh2.8 KB
- 脚本tests/attachments.test.sh9.5 KB
- 脚本tests/bash4-runtime-contract.test.sh940 B
- 脚本tests/blocked-by-open.test.sh10.6 KB
- 脚本tests/bulk-update-diagnostics.test.sh4.8 KB
- 脚本tests/comments-body-file.test.sh2.2 KB
- 脚本tests/comments-bulk-list.test.sh5.7 KB
- 脚本tests/comments-create-attach.test.sh8.5 KB
- 脚本tests/completion-validation-bundle-children.test.sh22.7 KB
- 脚本tests/completion-validation-parented-root.test.sh5.3 KB
- 脚本tests/controls/api-key-precedence.control.sh551 B
- 脚本tests/controls/assert-outstanding-jobs.control.sh464 B
- 脚本tests/controls/assert-subshell.control.sh419 B
- 脚本tests/controls/assert-verdict.control.sh392 B
- 脚本tests/controls/attachments.control.sh260 B
- 脚本tests/controls/bash4-runtime-contract.control.sh356 B
- 脚本tests/controls/blocked-by-open.control.sh507 B
- 脚本tests/controls/bulk-update-diagnostics.control.sh526 B
- 脚本tests/controls/comments-body-file.control.sh428 B
- 脚本tests/controls/comments-bulk-list.control.sh471 B
- 脚本tests/controls/comments-create-attach.control.sh415 B
- 脚本tests/controls/completion-validation-bundle-children.control.sh592 B
- 脚本tests/controls/completion-validation-parented-root.control.sh517 B
- 脚本tests/controls/cross-team-guard.control.sh285 B
- 脚本tests/controls/estimate-clear.control.sh325 B
- 脚本tests/controls/graphql-query-large-variables.control.sh440 B
- 脚本tests/controls/initiatives-projects-fields.control.sh448 B
- 脚本tests/controls/interrupt.control.sh654 B
- 脚本tests/controls/issues-activate-agent.control.sh387 B
- 脚本tests/controls/issues-activate-assignee.control.sh321 B
- 脚本tests/controls/issues-add-relation-hierarchy.control.sh322 B
- 脚本tests/controls/issues-archive-trash-entity-verify.control.sh467 B
- 脚本tests/controls/issues-assignee-email.control.sh718 B
- 脚本tests/controls/issues-bulk-get.control.sh260 B
- 脚本tests/controls/issues-complete-done-when.control.sh670 B
- 脚本tests/controls/issues-complete-summary.control.sh252 B
- 脚本tests/controls/issues-complete-supersedes.control.sh201 B
- 脚本tests/controls/issues-create-agent-label-guard.control.sh375 B
- 脚本tests/controls/issues-create-attach.control.sh1.2 KB
- 脚本tests/controls/issues-create-format-ids.control.sh468 B
- 脚本tests/controls/issues-create-parent.control.sh378 B
- 脚本tests/controls/issues-create-project-map.control.sh503 B
- 脚本tests/controls/issues-create-reach-guard.control.sh562 B
- 脚本tests/controls/issues-create-team-labels.control.sh953 B
- 脚本tests/controls/issues-description-file.control.sh445 B
- 脚本tests/controls/issues-get-github-sync.control.sh382 B
- 脚本tests/controls/issues-header-shape-guard.control.sh925 B
- 脚本tests/controls/issues-list-filters.control.sh298 B
- 脚本tests/controls/issues-list-search-server-filter.control.sh402 B
- 脚本tests/controls/issues-remove-relation-completed-blocker.control.sh257 B
- 脚本tests/controls/issues-update-attach.control.sh2.3 KB
- 脚本tests/controls/issues-update-done-when.control.sh241 B
- 脚本tests/controls/issues-update-format-safe.control.sh466 B
- 脚本tests/controls/issues-update-unknown-label-refuses.control.sh384 B
- 脚本tests/controls/label-name-spaces.control.sh430 B
- 脚本tests/controls/label-taxonomy.control.sh416 B
- 脚本tests/controls/list-bounds.control.sh282 B
- 脚本tests/controls/live-resource-pages-cap.control.sh156 B
- 脚本tests/controls/live-resource-pages-chain.control.sh234 B
- 脚本tests/controls/live-resource-pages-children.control.sh311 B
- 脚本tests/controls/live-resource-pages-entity.control.sh289 B
- 脚本tests/controls/live-resource-pages-replay-content.control.sh483 B
- 脚本tests/controls/live-resource-pages-replay-issues.control.sh481 B
- 脚本tests/controls/live-resource-pages-replay-projects.control.sh596 B
- 脚本tests/controls/live-resource-pages-replay-workspace.control.sh481 B
- 脚本tests/controls/live-resource-pages-result.control.sh290 B
- 脚本tests/controls/live-resource-pages.control.sh240 B
- 脚本tests/controls/milestone-project-scope.control.sh711 B
- 脚本tests/controls/mutation-isolation.control.sh714 B
- 脚本tests/controls/oauth-auth.control.sh500 B
- 脚本tests/controls/project-name-canceled-duplicate.control.sh835 B
- 脚本tests/controls/projects-audit-map.control.sh788 B
- 脚本tests/controls/projects-list-pagination.control.sh394 B
- 脚本tests/controls/quota-hold.control.sh172 B
- 脚本tests/controls/rate-limited-http-400.control.sh364 B
- 脚本tests/controls/related-inverse.control.sh452 B
- 脚本tests/controls/request-journal.control.sh227 B
- 脚本tests/controls/roster-orphan.control.sh363 B
- 脚本tests/controls/run-status-errexit.control.sh815 B
- 脚本tests/controls/session-status-cycles.control.sh283 B
- 脚本tests/controls/session-status-issues.control.sh452 B
- 脚本tests/controls/stdin-final-line.control.sh425 B
- 脚本tests/controls/team-ref-resolution.control.sh214 B
- 脚本tests/controls/team-target-fail-closed.control.sh381 B
- 脚本tests/controls/teams-keys.control.sh570 B
- 脚本tests/cross-team-guard.test.sh13.0 KB
- 脚本tests/estimate-clear.test.sh7.2 KB
- 脚本tests/graphql-query-large-variables.test.sh2.6 KB
- 脚本tests/initiatives-projects-fields.test.sh14.6 KB
- 脚本tests/interrupt.test.sh5.7 KB
- 脚本tests/issues-activate-agent.test.sh8.2 KB
- 脚本tests/issues-activate-assignee.test.sh10.0 KB
- 脚本tests/issues-add-relation-hierarchy.test.sh10.2 KB
- 脚本tests/issues-archive-trash-entity-verify.test.sh6.0 KB
- 脚本tests/issues-assignee-email.test.sh7.2 KB
- 脚本tests/issues-bulk-get.test.sh10.5 KB
- 脚本tests/issues-complete-done-when.test.sh24.4 KB
- 脚本tests/issues-complete-summary.test.sh9.7 KB
- 脚本tests/issues-complete-supersedes.test.sh10.2 KB
- 脚本tests/issues-create-agent-label-guard.test.sh11.3 KB
- 脚本tests/issues-create-attach.test.sh15.3 KB
- 脚本tests/issues-create-format-ids.test.sh3.7 KB
- 脚本tests/issues-create-parent.test.sh8.3 KB
- 脚本tests/issues-create-project-map.test.sh11.3 KB
- 脚本tests/issues-create-reach-guard.test.sh7.9 KB
- 脚本tests/issues-create-team-labels.test.sh5.7 KB
- 脚本tests/issues-description-file.test.sh8.6 KB
- 脚本tests/issues-get-github-sync.test.sh3.5 KB
- 脚本tests/issues-header-shape-guard.test.sh21.4 KB
- 脚本tests/issues-list-filters.test.sh7.8 KB
- 脚本tests/issues-list-search-server-filter.test.sh7.9 KB
- 脚本tests/issues-remove-relation-completed-blocker.test.sh7.4 KB
- 脚本tests/issues-update-attach.test.sh22.9 KB
- 脚本tests/issues-update-done-when.test.sh6.4 KB
- 脚本tests/issues-update-format-safe.test.sh5.4 KB
- 脚本tests/issues-update-unknown-label-refuses.test.sh5.5 KB
- 脚本tests/label-name-spaces.test.sh6.5 KB
- 脚本tests/label-taxonomy.test.sh21.8 KB
- 脚本tests/lib/assert.sh30.8 KB
- 脚本tests/lib/control-runner.sh709 B
- 参考文档tests/lib/fixtures/issue-team-labels.json1.7 KB
- 参考文档tests/lib/fixtures/label-team-issue.json746 B
- 参考文档tests/lib/fixtures/recorded/attachments-list.json1.4 KB
- 参考文档tests/lib/fixtures/recorded/comments-bulk-list.json3.9 KB
- 参考文档tests/lib/fixtures/recorded/comments-list.json3.1 KB
- 参考文档tests/lib/fixtures/recorded/cycles-list.json1.5 KB
- 参考文档tests/lib/fixtures/recorded/documents-list.json1.1 KB
- 参考文档tests/lib/fixtures/recorded/initiatives-get.json1.3 KB
- 参考文档tests/lib/fixtures/recorded/initiatives-list.json1.5 KB
- 参考文档tests/lib/fixtures/recorded/issues-bulk-get.json5.2 KB
- 参考文档tests/lib/fixtures/recorded/issues-bundle.json7.4 KB
- 参考文档tests/lib/fixtures/recorded/issues-children-pending-raw.json3.6 KB
- 参考文档tests/lib/fixtures/recorded/issues-children-pending.json3.6 KB
- 参考文档tests/lib/fixtures/recorded/issues-children-recursive.json6.3 KB
- 参考文档tests/lib/fixtures/recorded/issues-children.json1.7 KB
- 参考文档tests/lib/fixtures/recorded/issues-get.json3.3 KB
- 参考文档tests/lib/fixtures/recorded/issues-list.json3.0 KB
- 参考文档tests/lib/fixtures/recorded/issues-relations.json1.6 KB
- 参考文档tests/lib/fixtures/recorded/labels-list.json1.6 KB
- 参考文档tests/lib/fixtures/recorded/milestones-list.json1.1 KB
- 参考文档tests/lib/fixtures/recorded/project-labels-list.json1.5 KB
- 参考文档tests/lib/fixtures/recorded/projects-dependencies.json1.4 KB
- 参考文档tests/lib/fixtures/recorded/projects-get.json1.9 KB
- 参考文档tests/lib/fixtures/recorded/projects-list.json2.2 KB
- 参考文档tests/lib/fixtures/recorded/README.md1.9 KB
- 参考文档tests/lib/fixtures/recorded/session-status.json71.2 KB
- 参考文档tests/lib/fixtures/recorded/statuses-get.json1.2 KB
- 参考文档tests/lib/fixtures/recorded/statuses-list.json1.9 KB
- 参考文档tests/lib/fixtures/recorded/teams-get.json3.6 KB
- 参考文档tests/lib/fixtures/recorded/teams-keys.json720 B
- 参考文档tests/lib/fixtures/recorded/teams-list.json3.9 KB
- 参考文档tests/lib/fixtures/recorded/users-list.json1.1 KB
- 参考文档tests/lib/fixtures/recorded/users-me.json810 B
- 脚本tests/list-bounds.test.sh5.4 KB
- 脚本tests/live-resource-pages-cap.test.sh873 B
- 脚本tests/live-resource-pages-chain.test.sh1.1 KB
- 脚本tests/live-resource-pages-children.test.sh2.2 KB
- 脚本tests/live-resource-pages-entity.test.sh1.5 KB
- 脚本tests/live-resource-pages-replay-content.test.sh752 B
- 脚本tests/live-resource-pages-replay-issues.test.sh836 B
- 脚本tests/live-resource-pages-replay-projects.test.sh802 B
- 脚本tests/live-resource-pages-replay-workspace.test.sh763 B
- 脚本tests/live-resource-pages-result.test.sh1.6 KB
- 脚本tests/live-resource-pages.test.sh3.4 KB
- 脚本tests/milestone-project-scope.test.sh10.2 KB
- 脚本tests/must-fail-controls.sh23.5 KB
- 脚本tests/mutation-isolation.test.sh17.1 KB
- 脚本tests/oauth-auth.test.sh27.0 KB
- 脚本tests/project-name-canceled-duplicate.test.sh6.6 KB
- 脚本tests/projects-audit-map.test.sh11.5 KB
- 脚本tests/projects-list-pagination.test.sh5.4 KB
- 脚本tests/quota-hold.test.sh10.3 KB
- 脚本tests/rate-limited-http-400.test.sh14.6 KB
- 脚本tests/related-inverse.test.sh4.9 KB
- 脚本tests/request-journal.test.sh15.7 KB
- 脚本tests/roster-orphan.test.sh7.3 KB
- 脚本tests/run-status-errexit.test.sh3.6 KB
- 脚本tests/session-status-cycles.test.sh4.3 KB
- 脚本tests/session-status-issues.test.sh6.0 KB
- 脚本tests/stdin-final-line.test.sh3.5 KB
- 脚本tests/team-ref-resolution.test.sh9.1 KB
- 脚本tests/team-target-fail-closed.test.sh19.2 KB
- 脚本tests/teams-keys.test.sh2.5 KB
03 SKILL.md 正文
Modelling authorization
The model is the .fga files under backend/services/stigmer-server/fga/model,
compiled into the one JSON file every edition reads. Its doctrine (visibility is
a tuple, the access patterns, the shapes to avoid, the compiled file's contract)
is backend/services/stigmer-server/fga/model/README.md; read it first, and let
it win when it and this skill disagree. This skill is the order of work.
1. Read the nearest precedent
Find the sibling type whose pattern fits (the README's Access Patterns), read
its .fga file and the suite under backend/services/stigmer-server/fga/tests/
that pins it, and write the change in the same shape.
2. Change the file
- Keep the header comment true: what the type is for, the tuples the application writes on creation, and the checks the handlers make.
- A new type is a new file, listed in
fga.modin dependency order (the generator refuses an unlisted file), named by the type. - A permission an RPC annotation asks (
rpc.configinapis/) must be a relation of its kind's type. The server's wire pin (backend/services/stigmer-server/src/authorization/__tests__/wire-permissions.test.ts) fails otherwise, and a known gap it pins asks for its line's removal when the model closes it. - A permission exists because something asks it. Every
can_*relation is anIamPermissionvalue or is named by the rewrite of a relation that is itself reachable, and everyIamPermissionvalue is defined by some type; the same file pins both. A relation nothing asks is deleted with the assertions that name it, and an enum value nothing defines is removed with its number and name reserved. - A type is never deleted for being unasked: the model declares every
open-source kind
(
backend/services/stigmer-server/src/authorization/model/__tests__/registry.test.ts), and an undeclared target is the evaluator's fault, not a denial.
3. Pin it with a suite
Extend the type's suite, or add fga/tests/<type>-<facet>.fga.yaml with
model_file: ../../src/authorization/model/data/authorization-model.json. The
cast includes a viewer-role principal whenever the type can be org-visible, an
outsider, and the operator where a platform permission is involved. check and
list_objects only. A new suite's file name joins DOCUMENTS in
backend/services/stigmer-server/src/authorization/__tests__/store-tests.test.ts.
4. Regenerate and prove
make test-authorization-model
It regenerates
backend/services/stigmer-server/src/authorization/model/data/authorization-model.json,
runs every suite on the OpenFGA engine at the pinned fga CLI version
(FGA_CLI_VERSION in the root Makefile; install that release, or point FGA
at it), then runs the suites and the model's pins through the built-in
evaluator. Commit the regenerated JSON with the source; CI's
ci.authorization-model lane fails on a stale file.
5. What a type or relation change needs in the server
- A new type: a row in
backend/services/stigmer-server/src/authorization/model/bindings.ts(its message schema, orROWLESSfor a type with no stored resource). The model refuses to load a type with no binding. - A relation
kind_meta.authorizationcannot derive from the row: a derived rule in the same table (child-organizations.ts, the organization'sparent_organdchild_org, is the precedent). - A removed relation: its derived rule goes with it, since the model refuses a rule for a relation the type does not define. No server code changes its answer: the evaluator answers a permission a type does not define with false, and an edition that runs OpenFGA must answer it the same way (the Grant conformance suite asks one on a run).
- A shape the evaluator does not run (
but not, a wildcard, a condition): the reader (backend/services/stigmer-server/src/authorization/model/openfga-json.ts) refuses it by name. Needing one is a design change of the evaluator, before the model.
Then make test-server, which runs the whole server suite over the new model.
6. Describe it
The pull request says what changed, why, and the suite that pins it; that and the commit are the change's note, and the release that carries it names it in its notes. There is no model changelog file. An edition that runs OpenFGA applies the released JSON as it is.
04 同仓库更多 Skills
writing-hookify-rules
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
sql-migrations
Write safe database schema migrations - reversible steps, online index builds, and backfills in batches.
repo-conventions
How to change Go code in this repository - error wrapping, table-driven tests, doc comments, no new dependencies, and running go test before finishing.
incident-postmortem
Write a blameless incident postmortem - timeline, impact, root cause, contributing factors and follow-up actions with owners.
data-analysis
Summarise a data export or table - lead with the key finding and give every number its baseline or comparison.
customer-support
Answer customer questions about orders, returns and refunds from the written policies and the order system, ending with a clear next step.