feat: credential rotation for OAuth apps#178
Merged
24c02 merged 6 commits intohackclub:mainfrom 2 weeks agoFeb 26, 2026
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..
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.int. |
| app/views/backend/programs/show.html.erb | Adds backend “rotate secret & api key” action link gated by policy.icy. |
| 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
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 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