feat: credential rotation for OAuth apps#178
Merged
Merged
Conversation
Add rotate_credentials! to Program model to regenerate secret and program_key. Expose via backend programs controller behind the rotate_credentials? policy (program managers + super admins only).
App owners can now rotate their client secret and API key from /developer/apps/:id. Scoped to owned apps via set_app.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds credential rotation for OAuth apps (Program records backed by oauth_applications) so developers can rotate secrets from the developer UI and authorized admins can rotate from the backend program page.
Changes:
- Added
rotate_credentialsmember routes for backend programs and developer apps. - Introduced
Program#rotate_credentials!and controller actions to rotatesecret+program_key. - Added developer-facing i18n strings and a rotate button/confirmation on the developer app show page (plus backend UI link gated by policy).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| config/routes.rb | Adds member POST routes for rotate_credentials on backend programs and developer apps. |
| config/locales/en.yml | Adds i18n strings for rotate button, confirmations, hints, and success notice in developer UI. |
| app/views/developer_apps/show.html.erb | Adds “Rotate Secret & API Key” button with confirmation + hint. |
| app/views/backend/programs/show.html.erb | Adds backend “rotate secret & api key” action link gated by policy. |
| app/policies/program_policy.rb | Adds rotate_credentials? authorization gate. |
| app/models/program.rb | Adds rotate_credentials! to regenerate secret and program key. |
| app/controllers/developer_apps_controller.rb | Adds rotate_credentials action for owned developer apps. |
| app/controllers/backend/programs_controller.rb | Adds rotate_credentials action for backend program admins. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8638873 to
9aee1e8
Compare
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.
Adds the ability to rotate client secret and API key for OAuth apps.
Developer-facing
App owners can rotate credentials from
/developer/apps/:idvia a Rotate Secret & API Key button with a confirmation dialog. Scoped to owned apps only.Backend admin
Program managers and super admins can rotate credentials from
/backend/programs/:id, gated behind therotate_credentials?policy.Details
Program#rotate_credentials!— regeneratessecretandprogram_key, leavesuid(client ID) unchangedpaper_trail