Skip to content

feat: credential rotation for OAuth apps#178

Merged
24c02 merged 6 commits into
hackclub:mainfrom
System-End:oauth-creds-rotate
Feb 26, 2026
Merged

feat: credential rotation for OAuth apps#178
24c02 merged 6 commits into
hackclub:mainfrom
System-End:oauth-creds-rotate

Conversation

@System-End
Copy link
Copy Markdown
Contributor

Adds the ability to rotate client secret and API key for OAuth apps.

Developer-facing

App owners can rotate credentials from /developer/apps/:id via 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 the rotate_credentials? policy.

Details

  • Adds Program#rotate_credentials! — regenerates secret and program_key, leaves uid (client ID) unchanged
  • Changes are tracked automatically via paper_trail
  • i18n strings added for the developer UI

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.
Copilot AI review requested due to automatic review settings February 12, 2026 03:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_credentials member routes for backend programs and developer apps.
  • Introduced Program#rotate_credentials! and controller actions to rotate secret + 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.

Comment thread app/models/program.rb Outdated
Comment thread app/controllers/developer_apps_controller.rb Outdated
Comment thread app/controllers/backend/programs_controller.rb Outdated
Comment thread app/controllers/backend/programs_controller.rb Outdated
Comment thread config/routes.rb Outdated
Comment thread config/routes.rb Outdated
Comment thread app/policies/program_policy.rb Outdated
@24c02 24c02 merged commit e04d3e1 into hackclub:main Feb 26, 2026
1 of 2 checks passed
@System-End System-End deleted the oauth-creds-rotate branch March 5, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants