docs icon indicating copy to clipboard operation
docs copied to clipboard

feat: Docs for client secret rotation

Open SamuelDev opened this issue 10 months ago • 2 comments

Related Issue or Design Document

  • https://github.com/ory/hydra/pull/4063

Docs updates for client secret rotation

Checklist

  • [ ] I have read the contributing guidelines and signed the CLA.
  • [ ] I have referenced an issue containing the design document if my change introduces a new feature.
  • [ ] I have read the security policy.
  • [ ] I confirm that this pull request does not address a security vulnerability. If this pull request addresses a security vulnerability, I confirm that I got approval (please contact [email protected]) from the maintainers to push the changes.
  • [ ] I have added tests that prove my fix is effective or that my feature works.
  • [ ] I have added the necessary documentation within the code base (if appropriate).

Further comments

SamuelDev avatar Jan 23 '26 17:01 SamuelDev

Javascript integration test failure seems like a CI issue and unrelated to these changes

SamuelDev avatar Jan 23 '26 17:01 SamuelDev

@wassimoo @unatasha8 would you kindly take a look at this pls?

alnr avatar Feb 11 '26 15:02 alnr

Pushed 056df20 to address @unatasha8's review. Summary of what changed, including three places where I did not apply a suggestion literally — flagging those so you can push back.

Applied

  • Singular "secret" throughout, and "client service(s)" used consistently, per the general note.
  • "Clear rotated secrets" → "Remove old secret"; "cleanup" wording removed everywhere.
  • The two admonitions and the workflow example comments now use the agreed terminology.

Bug found while editing

All four curl examples used /admin/clients/{id}/secret/rotate (singular). The implemented route is /admin/clients/{id}/secrets/rotate (plural) — see client/handler.go and the OpenAPI spec in ory-corp/cloud#10632. Every example on this page would have returned 404. Fixed.

Answers to the open questions

  • "Where should this be saved?" (line 160) — the text now says Ory shows the value only once and to store it in the secret store the client services read from (a secrets manager or an encrypted environment configuration).
  • "'Secrets remain valid indefinitely' — are you sure? Don't they have a validity date?" (line 260) — confirmed correct. Rotated secrets are stored in the rotated_secrets column with no expiry field and no TTL; they stay valid until explicitly deleted. That is exactly why the warning admonition exists. This is unlike the SAML valid_to attribute you mentioned, which is a different feature.

Deviations from the literal suggestions

  1. Ordering of "How secret rotation works" — the suggestion moves "Both old and new secrets authenticate" to step 3, after "Update your client services". That would imply the dual-validity window starts once you update your services. It actually starts the moment you rotate. I kept the dual-validity statement attached to step 1 and added your "test before removing" step as step 3:
    1. Generate a new secret for the client service. Both the old and the new secret authenticate from this point on.
    2. Update your client services to use the new secret.
    3. Test that the client services can authenticate with the new secret.
    4. Manually remove the old secret. Only the new secret authenticates from this point on.
  2. ##### Rotate OAuth2 client secret — left as ##### Rotate client secret. The ## heading directly above is already "Rotate OAuth2 client secret", so the suggestion would create two identical headings and an ambiguous #rotate-oauth2-client-secret-1 anchor.
  3. "servcies" in the step-3 suggestion is a typo; used "services".

Happy to take any of these the other way — say the word.

alnr avatar Jul 09 '26 13:07 alnr

Superseeded by https://github.com/ory/docs/pull/2682.

Feature will land in the coming days. Thanks @SamuelDev and sorry for the long turnaround.

alnr avatar Jul 21 '26 11:07 alnr