Repository navigation
Add safedep workload commands for providers, trust rules and exchanges - #80
Merged
Merged
Conversation
The workload commands need WorkloadAdminService and its messages, which the build 20261120125025-1b99964cacca holds. The grpc and protocolbuffers modules move to that build. The CLI does not use the connectrpc module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
The workload commands show server errors with the same text as the policy commands: the status message without the service prefix, and each field violation with a readable field path. Sibling command packages cannot import each other, so the helpers move to internal/rpcerror. The policy package keeps its document paths and duration text on top of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
Admins need a CLI for workload identity, so a GitHub Actions job can call SafeDep Cloud with no API key. The new commands call WorkloadAdminService: - safedep workload provider list - safedep workload rule create NAME --provider PROVIDER --grant tool [--repository OWNER/NAME...] [--ref REF...] [--event EVENT...] - safedep workload rule list | show | delete - safedep workload exchange list [--denied] [--since D] [--rule RULE] rule create never picks a provider. With no --provider, or an unknown one, it fails and lists the providers of the tenant. --provider takes a provider id or KIND:ACCOUNT, as in github-actions:acme. The command prints the rule with the numeric id of each repository that the server stored, and warns when the rule covers every repository of the account. A repository that the installation cannot see fails with each repository that the server named. rule show, rule delete and exchange list --rule take a rule id or a rule name. Each leaf command has a doc page, and the README links to each one. Closes #77 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
internal/rpcerror had no test of its own, so the policy tests guarded it. The cases that do not depend on the policy document paths move to TestDescribe, which calls Describe directly. The policy tests keep the cases of the document paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
… create rule delete asks in a terminal and needs --yes with no terminal, as policy rule delete does. The question says that the CI jobs of the rule lose access to SafeDep Cloud, and that a rule with no repository covers every repository of the account. rule create takes --project-binding auto|manual and --max-lifetime from 1m to 6h. Each stays unset unless given, so the server default applies. Other fixes: - A KIND:ACCOUNT that names two providers now suggests a provider id, not the same name again. - exchange list says when --rule names no live rule and no exchange matches, because the value went to the server as a rule id. - An UNAVAILABLE on rule create shows the server message. A transport failure or a gateway also sends that code, so the text does not blame GitHub. - --repository uses the pattern, length and count limits of the API, so a value such as "acme/web app" fails at the flag. The tests cover a name on a second page of rules and of providers, the three list renderers, and rule list with a provider id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
SafeDep Report SummaryPackage Details
This report is generated by SafeDep GitHub App |
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. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 30 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Sahilb315
approved these changes
Nov 24, 2026
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.




Closes #77. Part of safedep/control-tower#1691.
An admin needs a CLI to let CI jobs call SafeDep Cloud with their GitHub Actions identity instead of an API key. These commands call
WorkloadAdminServiceon control-tower.Commands
safedep workload provider list: the workload identity providers of the tenant, with theKIND:ACCOUNTname that--providertakes, such asgithub-actions:acme.safedep workload rule create NAME --provider P --grant tool [--repository OWNER/NAME...] [--ref REF...] [--event EVENT...] [--project-binding auto|manual] [--max-lifetime DURATION].--provideris required, also for a tenant with one provider. Without it, the command fails and lists the providers.--repositorycovers every repository of the account, and the command says so.--refthat ends in/*is a prefix condition. A rule cannot mix prefix refs and full refs.--project-bindingand--max-lifetimestay unset unless given, so the server default applies.safedep workload rule list | show | delete. RULE is a rule id, or the name of a live rule.rule deleteasks for confirmation in a terminal and needs--yeswhen no terminal is present. The question says that the rule's CI jobs lose access to SafeDep Cloud, and for a rule with no repository, that it covers every repository of the account.safedep workload exchange list [--denied] [--since 7d] [--rule RULE].Lists print a table,
--output plainor--output json. A JSON list is an object with the items andnext_page_token. Each leaf command has a page indocs/.Server errors
Each refusal of
rule createhas its own message:Other changes
20261120125025-1b99964cacca, which holdsWorkloadAdminService. go.mod has no connectrpc module, so two modules move.internal/rpcerrornow holds the gRPC status text helpers that were ininternal/cmd/policy/errors.go, because command packages cannot import each other. The policy commands keep their messages and codes. Their generic test cases moved tointernal/rpcerror.Test plan
make build,go test ./...,make lint-conventions(golangci-lint v2.12.1) pass.FuzzRefCondition, rule lookup by name over many pages, the delete confirmation, the exchange filters and the output of each list.Generated by Claude Code