feat(cli): Unsafe update key cli - #3733
Conversation
Signed-off-by: Chris Reed <creed@virtru.com>
Signed-off-by: Chris Reed <creed@virtru.com>
Signed-off-by: Chris Reed <creed@virtru.com>
Signed-off-by: Chris Reed <creed@virtru.com>
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds an unsafe KAS key update command with mode and provider configuration validation, confirmation, SDK integration, documentation, and end-to-end tests for supported and rejected update scenarios. ChangesUnsafe KAS key update
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant KASKeyHandler
participant UnsafeSDK
CLI->>KASKeyHandler: Validate and submit unsafe update
KASKeyHandler->>UnsafeSDK: UnsafeUpdateKey(id, mode, provider config)
UnsafeSDK-->>KASKeyHandler: Updated KAS key
KASKeyHandler-->>CLI: Render updated key metadata
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request adds support for unsafely updating KAS registry keys via a new CLI command and service RPC. It enables changing key modes between 'remote' and 'public_key' and updating provider configurations for existing remote keys, while ensuring necessary safety checks and validation are in place. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. The keys were set in stone and cold, But now a change is brave and bold. With unsafe flags and careful hand, We update keys across the land. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces an unsafe key update feature (UnsafeUpdateKey) allowing administrators to switch key modes between REMOTE and PUBLIC_KEY_ONLY or update the provider configuration for existing remote keys. The changes span Protobuf definitions, database queries, service-layer logic, CLI commands, and comprehensive tests. The review feedback suggests several defensive programming enhancements to prevent potential nil pointer dereferences when handling key objects and responses, as well as adding a default case to a key mode switch statement to ensure robust validation.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
X-Test Failure Report |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
|
🤖 I have created a release *beep* *boop* --- ## [0.36.0](opentdf/platform@otdfctl/v0.35.0...otdfctl/v0.36.0) (2026-08-04) ### ⚠ BREAKING CHANGES * **policy:** GetPC does not respect manager field. ([opentdf#3752](opentdf#3752)) ### Features * **authz:** dynamic value mapping and direct entitlement e2e coverage ([opentdf#3774](opentdf#3774)) ([49c80a0](opentdf@49c80a0)) * **cli:** add an sdkfactory for optional override in otdfctl for extension ([opentdf#3793](opentdf#3793)) ([c2f2afe](opentdf@c2f2afe)) * **cli:** add dynamic value mapping CRUD commands and e2e tests ([opentdf#3768](opentdf#3768)) ([aecd265](opentdf@aecd265)) * **cli:** expose handler hook for injecting SDK options ([opentdf#3755](opentdf#3755)) ([76305b0](opentdf@76305b0)) * **cli:** Unsafe update key cli ([opentdf#3733](opentdf#3733)) ([65d888e](opentdf@65d888e)) ### Bug Fixes * **deps:** bump github.com/opentdf/platform/protocol/go from 0.36.0 to 0.39.0 in /otdfctl ([opentdf#3765](opentdf#3765)) ([a3346f8](opentdf@a3346f8)) * **deps:** bump github.com/opentdf/platform/sdk from 0.25.0 to 0.27.0 in /otdfctl ([opentdf#3773](opentdf#3773)) ([490c990](opentdf@490c990)) * **policy:** GetPC does not respect manager field. ([opentdf#3752](opentdf#3752)) ([0d3c0a0](opentdf@0d3c0a0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com> Co-authored-by: Elizabeth Healy <35498075+elizabethhealy@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [0.36.0](opentdf/platform@otdfctl/v0.35.0...otdfctl/v0.36.0) (2026-08-04) ### ⚠ BREAKING CHANGES * **policy:** GetPC does not respect manager field. ([opentdf#3752](opentdf#3752)) ### Features * **authz:** dynamic value mapping and direct entitlement e2e coverage ([opentdf#3774](opentdf#3774)) ([49c80a0](opentdf@49c80a0)) * **cli:** add an sdkfactory for optional override in otdfctl for extension ([opentdf#3793](opentdf#3793)) ([c2f2afe](opentdf@c2f2afe)) * **cli:** add dynamic value mapping CRUD commands and e2e tests ([opentdf#3768](opentdf#3768)) ([aecd265](opentdf@aecd265)) * **cli:** expose handler hook for injecting SDK options ([opentdf#3755](opentdf#3755)) ([76305b0](opentdf@76305b0)) * **cli:** Unsafe update key cli ([opentdf#3733](opentdf#3733)) ([65d888e](opentdf@65d888e)) ### Bug Fixes * **deps:** bump github.com/opentdf/platform/protocol/go from 0.36.0 to 0.39.0 in /otdfctl ([opentdf#3765](opentdf#3765)) ([a3346f8](opentdf@a3346f8)) * **deps:** bump github.com/opentdf/platform/sdk from 0.25.0 to 0.27.0 in /otdfctl ([opentdf#3773](opentdf#3773)) ([490c990](opentdf@490c990)) * **policy:** GetPC does not respect manager field. ([opentdf#3752](opentdf#3752)) ([0d3c0a0](opentdf@0d3c0a0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
Summary
Adds CLI support for unsafely updating KAS registry keys through the new
UnsafeUpdateKeyservice RPC.This introduces:
otdfctl policy kas-registry key unsafe updateremoteandpublic_keyremotekeyCLI Behavior
The new command accepts:
--id: system key ID to update--mode: target key mode, limited client-side toremoteorpublic_key--provider-config-id: provider config ID forremotemode or remote provider config updates--force: bypasses interactive unsafe confirmationRequest validation for provider config combinations is intentionally handled by the service. The CLI now validates only CLI-level concerns like required
flags, UUID parsing, and unsupported mode strings.
Testing
Updated
otdfctl/e2e/kas-keys.batsto cover:Depends On
feat(policy): Add UnsafeUpdateKey rpc.feat(policy): Add UnsafeUpdateKey implementationSummary by CodeRabbit
New Features
remoteandpublic_keymodes.Bug Fixes
Documentation