-
Notifications
You must be signed in to change notification settings - Fork 463
feat: Docs for client secret rotation #2424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
068aa3d to
5e927b3
Compare
|
Javascript integration test failure seems like a CI issue and unrelated to these changes |
|
@wassimoo @unatasha8 would you kindly take a look at this pls? |
19afb45 to
29299a0
Compare
vinckr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm :) fixed some layout issues
| ## Rotate OAuth2 client secret | ||
|
|
||
| OAuth2 client secret rotation allows you to change a client's secret without downtime. When you rotate a secret, the old secret | ||
| remains valid until you explicitly clean it up, allowing you to update all services using the client credentials without service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| remains valid until you explicitly clean it up, allowing you to update all services using the client credentials without service | |
| remains valid until you remove it, allowing you to update all your services without service |
|
|
||
| ##### How secret rotation works | ||
|
|
||
| 1. Rotate the secret: Generate a new secret for the client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 1. Rotate the secret: Generate a new secret for the client | |
| 1. Generate a new secret for the client service |
| ##### How secret rotation works | ||
|
|
||
| 1. Rotate the secret: Generate a new secret for the client | ||
| 2. Both secrets work: Old and new secrets both authenticate until cleanup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| 1. Rotate the secret: Generate a new secret for the client | ||
| 2. Both secrets work: Old and new secrets both authenticate until cleanup | ||
| 3. Update services: Update your applications to use the new secret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 3. Update services: Update your applications to use the new secret | |
| 3. Update your client services to use the new secret |
| 1. Rotate the secret: Generate a new secret for the client | ||
| 2. Both secrets work: Old and new secrets both authenticate until cleanup | ||
| 3. Update services: Update your applications to use the new secret | ||
| 4. Cleanup: Manually remove old rotated secrets once all services are updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 4. Cleanup: Manually remove old rotated secrets once all services are updated | |
| 4. After you test the client services can authenticate with the new secret, manually remove the old secret. |
|
|
||
| ##### Clear rotated secrets | ||
|
|
||
| Once all services have been updated to use the new secret, you can remove the old rotated secrets to revoke access using the old |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Once all services have been updated to use the new secret, you can remove the old rotated secrets to revoke access using the old | |
| Once all services are updated to use the new secret, remove the old secret to revoke access using the old |
| ##### Clear rotated secrets | ||
|
|
||
| Once all services have been updated to use the new secret, you can remove the old rotated secrets to revoke access using the old | ||
| credentials: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| credentials: | |
| secret: |
| -H "Authorization: Bearer ory_pat_..." | ||
| ``` | ||
|
|
||
| After cleanup, only the current secret will be valid. Old secrets will no longer authenticate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| After cleanup, only the current secret will be valid. Old secrets will no longer authenticate. | |
| After removing the old secret, only the current (new) secret is valid. The old secret can no longer authenticate. |
| id: clientId | ||
| }) | ||
|
|
||
| // Old secrets are now revoked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Old secrets are now revoked | |
| // Old secret is now revoked. |
|
|
||
| echo "New secret: $NEW_SECRET" | ||
|
|
||
| # 3. Update your applications with the new secret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # 3. Update your applications with the new secret | |
| # 3. Update your client servcies with the new secret |
| -u "$CLIENT_ID:$NEW_SECRET" \ | ||
| -d "grant_type=client_credentials" | ||
|
|
||
| # 5. Once all services are updated, clean up old secrets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # 5. Once all services are updated, clean up old secrets | |
| # 5. Once all client services are updated, remove the old secret |
|
|
||
| :::tip Zero-downtime credential rotation | ||
|
|
||
| Secret rotation enables zero-downtime credential updates. Both the old and new secrets remain valid until you manually clean up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Secret rotation enables zero-downtime credential updates. Both the old and new secrets remain valid until you manually clean up | |
| Secret rotation enables zero-downtime credential updates. Both the old and new secrets remain valid until you manually remove |
| :::tip Zero-downtime credential rotation | ||
|
|
||
| Secret rotation enables zero-downtime credential updates. Both the old and new secrets remain valid until you manually clean up | ||
| the rotated secrets, allowing you to update all your services without service interruption. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| the rotated secrets, allowing you to update all your services without service interruption. | |
| the old secret, allowing you to update all your client services without service interruption. |
|
|
||
| :::warning Security best practice | ||
|
|
||
| Rotated secrets remain valid indefinitely until you explicitly clean them up. Always remove old rotated secrets once your |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Rotated secrets remain valid indefinitely until you explicitly clean them up. Always remove old rotated secrets once your | |
| Secrets remain valid indefinitely until you explicitly remove them. Always remove old secrets once your |
| :::warning Security best practice | ||
|
|
||
| Rotated secrets remain valid indefinitely until you explicitly clean them up. Always remove old rotated secrets once your | ||
| migration is complete to ensure that compromised credentials cannot be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| migration is complete to ensure that compromised credentials cannot be used. | |
| secret rotation process is complete to ensure that compromised credentials cannot be used. |
|
|
||
| :::warning Security best practice | ||
|
|
||
| Rotated secrets remain valid indefinitely until you explicitly clean them up. Always remove old rotated secrets once your |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"secrets remain valid indefinitely" Are you sure? Don't they have a validity date?
Deepak just added this feature: "The SAML connection includes a valid_to attribute, which is an array of expiry dates for the signing certificates associated". This might not directly link to your code as it's for SAML... but wanted to point it out to you.
| 3. Update services: Update your applications to use the new secret | ||
| 4. Cleanup: Manually remove old rotated secrets once all services are updated | ||
|
|
||
| ##### Rotate client secret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ##### Rotate client secret | |
| ##### Rotate OAuth2 client secret |
| -H "Authorization: Bearer ory_pat_..." | ||
| ``` | ||
|
|
||
| The response includes the new `client_secret`. Save this value immediately - it will not be shown again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where should this be saved? Is there a secure location it should be saved to?
| </Tabs> | ||
| ```` | ||
|
|
||
| ##### Clear rotated secrets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ##### Clear rotated secrets | |
| ##### Remove old secret |
unatasha8
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, keep to singular for 'secret' if the process is one at a time. Pick one to use client(s), client service(s), service(s), application(s) etc. I tried to change all to client services.
Related Issue or Design Document
Docs updates for client secret rotation
Checklist
If this pull request addresses a security vulnerability,
I confirm that I got approval (please contact security@ory.com) from the maintainers to push the changes.
Further comments