Imagine an agent prepares version 2.4.1 of a library, and packaging pulls in a local configuration file. The reviewer approved the source change, not the configuration file that consumers would receive.
If merging automatically authorizes publication, the team has approved one thing and distributed another. Authorize publication of exact package bytes to a specific destination instead. The source diff alone cannot show everything inside the built package.
Separate preparation from distribution
A useful policy distinguishes four actions:
- Prepare: edit source, propose a version, generate release notes, and assemble a candidate package in an isolated workspace.
- Stage: place a candidate in a restricted location for inspection or testing.
- Approve: authorize distribution of an identified artifact to an identified destination.
- Publish: execute that authorized transfer using a controlled release identity.
One agent can assist with several actions without owning all the permissions. It can request publication without possessing a reusable public-registry credential.
I would keep public publishing credentials out of the agent’s environment by default. A separate release job should hold narrowly scoped authority and execute only after the required approval.
But separate credentials accomplish little if the agent can change the workflow that invokes them. It could leave the credential untouched while changing the release job to skip approval or substitute an unapproved artifact after the check. The permission boundary must therefore protect the release workflow and approval mechanism from agent-controlled changes, prevent replacement of the approved artifact, and block publication paths that bypass the release job.
Approval should follow the artifact, not just the commit.
Set authority by destination
A private registry is not automatically a harmless staging area. If other teams or customers install packages from it, publishing there is a distribution decision.
Use this matrix as a starting policy. Replace each role with a named person and backup before enabling the workflow.
| Destination or action | Default agent authority | Accountable owner | Evidence required before proceeding |
|---|---|---|---|
| Isolated local preparation | Create a candidate without publishing credentials | Repository maintainer | Source revision, build recipe, and candidate output location |
| Restricted internal staging | Upload through a scoped staging identity, if policy permits | Staging environment owner | Artifact digest, included-file inventory, destination, and access restrictions |
| Private registry used by downstream consumers | Request publication; no standing release authority | Package release owner | Verified candidate, exact package identity and version, test results, and explicit approval |
| Public registry | Request publication; no public publishing credential by default | Public release owner | The same evidence, plus confirmation that contents and destination are approved for external distribution |
Access matters more than the registry’s label. An internal staging location should not silently feed automatic installations. If consumers treat it as a release channel, apply release approval there too.
I would not require a person to approve every disposable candidate uploaded to an isolated test destination. I would require approval before that candidate crosses into a channel that consumers trust.
Verify the package consumers will receive
The release record needs to connect the approved source to the actual package. These checks answer different questions:
| Check | What it establishes | Important limit |
|---|---|---|
| Source revision and build record | Which source and process produced the candidate | A commit identifier alone does not establish package contents |
| Included-file inventory and content inspection | What will be distributed, including generated files and metadata | A filename list alone will not reveal sensitive content inside a file |
| Test and policy-check results | Which checks ran against the candidate or its installation | Passing checks cover only their stated scope |
| Artifact digest | Which exact bytes were inspected and approved | A digest identifies bytes; it does not establish that they are safe |
| Destination and version confirmation | Where the package will go and under what identity | Correct contents can still be published to the wrong namespace or channel |
Inspect the packaged output, not only the repository. Depending on the package format, release-relevant content can include bundled dependencies, generated code, installation hooks, and package metadata.
Prefer publishing the exact verified candidate. If the workflow rebuilds after approval, the inspected bytes and published bytes can diverge. Accept the rebuilt output only if its digest matches the approved digest; otherwise, inspect it and obtain fresh approval before publication. Build provenance alone does not establish that the rebuilt bytes were approved.
No unverified candidate should be promoted merely because it came from a previously approved commit.
Copy this publication authorization record
Keep this record where the agent cannot approve or alter it.
Publication authorization
Package: @example/format-kit
Version: 2.4.1
Destination: public registry / example namespace / stable channel
Source revision: <full immutable revision>
Build record: <retained build record identifier>
Candidate artifact: <immutable storage reference>
Artifact digest: <algorithm and full digest>
Included-file inventory: <retained inventory reference>
Content inspection: <review record and scope>
Verification results: <checks, results, and known gaps>
Release owner: <accountable release owner>
Backup owner: <designated backup>
Approver: <authorized person and recorded approval time>
Approval status: <pending, approved, revoked, reserved, or consumed>
Attempt identifier: <unique identifier recorded on reservation>
Executor: <controlled release job identity>
Authorization: one publication attempt for the artifact,
package identity, version, destination, and channel above
Expires: <team-defined deadline>
Invalidate approval if: artifact, source, package identity,
version, destination, or channel changes
After publication: record registry receipt and verify the
retrievable artifact against the approved candidate
Before publishing, the controlled release job must match the attempted publication to the approved digest, source revision, package identity, version, destination, and channel; verify that approval is granted, unexpired, and unused; and atomically reserve or consume that authorization before starting the attempt. A reservation must bind to one attempt identifier and block all other jobs, so concurrent jobs cannot both pass the unused-approval check. Run these checks and protect their state outside the agent’s control, then record the attempt’s outcome without reopening the authorization for reuse.
Treat timeouts carefully. A missing success response does not necessarily mean nothing was published. If an attempt’s result is uncertain, keep its authorization unavailable and reconcile the registry state, release-job records, and any receipt before issuing a new authorization. If publication succeeded, verify the retrievable artifact and record completion. If reconciliation establishes that nothing was published, a new authorization can permit another attempt; unresolved uncertainty is not permission to retry.
Plan for a mistaken release
Assign a response owner before granting publication authority, with a documented path for the relevant registry and ecosystem. Deleting or restricting a package cannot be assumed to remove copies already downloaded, cached, or mirrored.
The response may require notifying consumers, publishing a corrected version, or revoking exposed credentials. Available actions depend on the registry and what was distributed. That limit supports verification before publishing, not a prohibition on automation.
Try a five-minute permission check
Choose one package and trace four things: who can merge its source, who can access its publishing credential, who approves its artifact, and who can change the release workflow.
Then ask: can the agent reach publication without an independent authorization tied to the artifact? If yes, identify the permission or workflow change that closes that path.
This exercise finds obvious authority gaps. It does not replace inspection of identity-provider rules, registry settings, or the release system itself.