You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add permissions support to trust commands (#9248)
## 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
- #9201
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/lib/content/commands/npm-trust.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,17 @@ The `[package]` argument specifies the package name. If omitted, npm will use th
28
28
29
29
Each trust relationship has its own set of configuration options and flags based on the OIDC claims provided by that provider. OIDC claims come from the CI/CD provider and include information such as repository name, workflow file, or environment. Since each provider's claims differ, the available flags and configuration keys are not universal—npm matches the claims supported by each provider's OIDC configuration. For specific details on which claims and flags are supported for a given provider, use `npm trust <provider> --help`.
30
30
31
+
### Permissions
32
+
33
+
When creating a trust relationship, you must specify at least one permission flag to indicate which operations the trusted publisher is allowed to perform:
34
+
35
+
*`--allow-publish`: Allows the trusted publisher to run `npm publish` for the package.
36
+
*`--allow-stage-publish`: Allows the trusted publisher to run `npm stage` for the package. The alias `--allow-staged-publish` is also accepted.
37
+
38
+
At least one of these flags is required when creating a trust configuration. You can specify both to grant both permissions.
39
+
40
+
### Provider Options
41
+
31
42
The required options depend on the CI/CD provider you're configuring. Detailed information about each option is available in the [managing trusted publisher configurations](https://docs.npmjs.com/trusted-publishers#managing-trusted-publisher-configurations) section of the npm documentation. If a provider is repository-based and the option is not provided, npm will use the `repository.url` field from your `package.json`, if available.
32
43
33
44
Currently, the registry only supports one configuration per package. If you attempt to create a new trust relationship when one already exists, it will result in an error. To replace an existing configuration:
0 commit comments