Skip to content

feat: add permissions support to trust commands#9248

Open
reggi wants to merge 1 commit intolatestfrom
reggi/trust-permissions
Open

feat: add permissions support to trust commands#9248
reggi wants to merge 1 commit intolatestfrom
reggi/trust-permissions

Conversation

@reggi
Copy link
Copy Markdown
Contributor

@reggi reggi commented Apr 16, 2026

Summary

Adds permission flags to trust create operations. Users must now specify at least one of --allow-publish or --allow-stage-publish (alias: --allow-staged-publish) when creating trust configurations.

Changes

  • Add --allow-publish and --allow-stage-publish flags to all trust provider commands (GitHub, GitLab, CircleCI)
  • Require at least one permission flag when creating trust configurations
  • Include permissions in the request body and display output
  • Add PERMISSIONS constants for permission values
  • Update tests and completion snapshots for new flags

Related

Add --allow-publish and --allow-stage-publish flags to trust create
operations. At least one permission flag is now required when
establishing trust configurations.

- Add PERMISSIONS constants for permission values
- Add --allow-staged-publish as alias for --allow-stage-publish
- Include permissions in request body and display output
- Update tests and completion snapshots for new flags

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@reggi reggi requested a review from a team as a code owner April 16, 2026 19:15
Comment thread lib/trust-cmd.js
Comment thread lib/trust-cmd.js
module.exports = TrustCommand
module.exports.NPM_FRONTEND = NPM_FRONTEND
module.exports.trustDefinitions = trustDefinitions
module.exports.PERMISSIONS = PERMISSIONS
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we exporting this?

Comment thread lib/trust-cmd.js
const allowStagePublish = flags['allow-stage-publish'] || flags['allow-staged-publish']

if (!allowPublish && !allowStagePublish) {
throw new Error('Trust Relationships require permission access to run specific commands such as `npm stage` and `npm publish` please provide `--allow-stage-publish` or `--allow-publish` to proceed.')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message style doesn't match the short declarative pattern used elsewhere in this file

Suggested change
throw new Error('Trust Relationships require permission access to run specific commands such as `npm stage` and `npm publish` please provide `--allow-stage-publish` or `--allow-publish` to proceed.')
throw new Error(''At least one permission flag is required (--allow-publish, --allow-stage-publish)'')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants