Repository navigation
feat: store plugin packs and fetch them from Git - #200
Conversation
Adds the plugin_packs and plugin_pack_resources tables (chatdmig node), their forkdb queries with dbauthz and dbmetrics wrappers, and coderd/x/pluginpacks, which fetches one commit of a pack directory over smart HTTP with a host allowlist and fixed size caps. Packs reuse the organization skill RBAC object, so only organization admins and auditors read or manage them.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b2a885aa5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The 64 MiB transfer cap does not bound memory, because go-git inflates every fetched object into memory storage before the per-file limits run. Read the pack first and reject it when its object headers, and the target sizes of its deltas, add up to more than 256 MiB.
|
@codex review
|
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…nstall # Conflicts: # coderd/database/forkdb/sqlc.yaml
…server The rejected-source subtest asserted that no request reached the server, but the parallel subtests shared that server and its counter, so a sibling fetch could make it fail.
|
@codex review
|
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Merged as a squash of head
|
Second step of plugin packs (R7.2): store installed packs and fetch a pack from Git, pinned to one commit. The API that installs, lists, updates and deletes packs, and the per-organization host allowlist, come in the next PR, which stacks on this one.
What changes
plugin_packsadds two tables.plugin_packshas one row per pack: organization, name (unique per organization), source URL, path and ref, plus the commit the stored files come from.plugin_pack_resourcesholds the files of a pack (path, content, SHA-256), deleted with the pack.forkdb/queries/plugin_packs.sql): pack CRUD, plus batch insert, read and delete of a pack's files (unnestoverbytea[]). Every query has a dbauthz and a dbmetrics wrapper.ResourceOrganizationSkill. Only organization admins and auditors can read or manage packs. Members get no access to packs; they reach pack content later, when it is materialized into the workspace. This PR adds no RBAC resource.coderd/x/pluginpacks):httpsonly, rejects URLs with credentials, and checks every request against the host allowlist, redirects included.Nothing calls these yet, so behavior does not change.
Validation
forkdb/generate.shregen,chatdmig check,go build ./coderd/... ./enterprise/..., and vet../coderd/x/pluginpacks/(a realgit http-backendbehind an httptest TLS server: tag, branch, SHA, rejected hosts and schemes that never reach the server, unknown ref, oversized file),forkdbTestPluginPackResources, and dbauthzTestForkQuerier../coderd/database/migrations/chatdmig/passed in a container against Postgres 17 with a matchingpg_dump, andTestCheckUnpackedSizecovers the unpacked cap with a delta-compressed pack.