Repository navigation
feat(plugins): enforce host-function permissions (WI-1821) - #421
Merged
Merged
Conversation
Plugin host functions were registered for every plugin, so a plugin that declared a minimal capability set still received process execution, outbound HTTP/SMTP, KV, comment and SCM access (security finding F2). - New manifest field `permissions` with a closed catalog: process.exec -> cli_exec, network.egress -> http_fetch, mail.send -> smtp_send, storage.kv -> kv_get/kv_set/kv_delete, comments.write -> create_comment, scm.write -> scm_create_branch/scm_create_item_link. `log` stays always available. - Unknown permission names fail the load; declared permissions are normalized and deduplicated. - Every gated host function checks the calling plugin's effective permissions and returns a typed denial instead of executing. An absent plugin context denies. - License precedence is permission AND license: an unlicensed plugin keeps loading but gets no host-function permissions. - The admin plugin list reports requested vs effective permissions, and module settings renders a badge per permission. - A load-time warning names the plugin and the host functions it can no longer call. - NewManager validates the registered host function set against the catalog so a new host function cannot ship unguarded.
|
Size Change: 0 B 🆕 Total Size: 0 B |
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
Plugin host functions were registered for every plugin, so a plugin that declared a minimal capability set still received process execution, outbound HTTP/SMTP, KV, comment and SCM access (security finding F2, the capability half of H2).
Host-function access is now default-deny and driven by a new, closed
permissionsfield in the plugin manifest.capabilitiesstays the open product-feature advertising list consumed byHasCapability/GetCapabilitiesand/api/features.What changed
internal/plugins/capabilities.go— closed catalog and mapping:process.exec→cli_exec,network.egress→http_fetch,mail.send→smtp_send,storage.kv→kv_get/kv_set/kv_delete,comments.write→create_comment,scm.write→scm_create_branch/scm_create_item_link.logis always available. Unknown names fail the load.Manager.requirePermissiongates every host function through one helper using the calling plugin's effective permissions. An absent plugin context denies; each function returns its own typed denial (http_fetch→ 403).NewManagervalidates the registered host-function set against the catalog so a new host function cannot ship unguarded.GET /admin/pluginsreportsrequested_permissionsvseffective_permissions; Module settings renders a badge per permission.Breaking change
A plugin that declares no permissions now gets only
log. Existing plugins must add the permissions they rely on to their manifest. The Pro plugin calls no host functions and needs no manifest change.Out of scope
Per-plugin operator grant/deny overrides (WI-1821 item 5, optional) and
create_commentauthor impersonation (the other half of H2).Tests
Covered by the
core-testsbranchwi-1821-plugin-permissions:normalizePermissions, deny/allow, unknown-name load failure, license gating, log-still-worksplugin-permission-badgeAlso verified:
golangci-lint,gofmt,go build(with and withoutnoplugins), full./internal/handlers/...,svelte-check, locale guard, and theplugin-route-auth-badge/collection-map-swimlanese2e specs. PostgreSQL was not run; the permission logic is engine-independent.