Policy
policy.yaml — the server-side, admin-owned access layer. Global caps ∩ per-user rules, hot-reloaded, fail-closed.
POLICY_PATH (default ./policy.yaml) points at a YAML file the server
hot-reloads on change. It is the feature this server exists for: a
server-side, admin-owned cap on what any PAT can reach — no client can
widen it, ever.
Effective access
PAT's own DC permissions ∩ global cap ∩ user's rules (or defaults)
Layers can only narrow access, never widen it. A user rule naming a space outside the global cap gets nothing (fail closed).
Example
global:
confluence:
allowedSpaces: ["TEAM", "DOC"] # hard cap, applies to EVERYONE
# readOnly: true # deny confluence_* writes for all
jira:
allowedProjects: ["SUP", "PLAT"]
# readOnly: true
allowWrites: false # writes globally off by default
defaults: # callers with no entry under users:
confluence: { spaces: ["TEAM"] }
jira: { projects: ["SUP"] }
users: # Atlassian usernames, resolved
alice: # from the caller's PAT
confluence: { spaces: ["TEAM", "DOC"] }
jira: { projects: ["SUP", "PLAT"] }
The full commented version lives in the repo:
policy.example.yaml.
Semantics
allowedSpaces/allowedProjectsunset → no cap at that layer.- User and
defaultslists are intersected with the global cap. - Identity can’t be resolved →
defaultsapply; nodefaults→ global cap only. allowWrites: falseor a servicereadOnly: true→ write tools stay visible but refuse with an explanatory error.- Empty or missing policy file → uncapped; the PAT’s own DC permissions still apply.
How enforcement lands per tool
| mechanism | where |
|---|---|
| scope injected into the query | confluence_search (CQL space in (...)), jira_search (JQL project in (...)) |
| scope checked post-fetch | confluence_get_page, confluence_get_page_children, confluence_get_comments, jira_get_issue, jira_get_comments, jira_get_changelog, jira_get_transitions |
| filtered to effective scope | confluence_list_spaces, jira_list_projects |
| write-gated + scope checked | confluence_create_page, confluence_update_page, confluence_add_comment, jira_create_issue, jira_update_issue, jira_transition_issue, jira_add_comment |
Hot reload & failure modes
- The file is re-read when it changes on disk — no restart needed.
- Reload is atomic per request; malformed YAML keeps the last good policy rather than failing open.
policy.yamlis gitignored — it belongs to the deployment, not the repo.
Audit log
Every tool call emits one JSON line on stderr:
{"tool":"jira_search","user":"alice","denied":false,"ms":212}
Pipe stderr to your log collector. Credentials are never logged — only
the resolved username and outcome. Denied calls (denied:true) name the
policy reason in the tool’s error response.