-
Notifications
You must be signed in to change notification settings - Fork 0
Encrypt OAuth tokens before storing in database #2
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: main
Are you sure you want to change the base?
Conversation
Co-authored-by: rob-at-cortex <50111225+rob-at-cortex@users.noreply.github.com>
…ssues Co-authored-by: rob-at-cortex <50111225+rob-at-cortex@users.noreply.github.com>
Co-authored-by: rob-at-cortex <50111225+rob-at-cortex@users.noreply.github.com>
|
lets use the user id as part of the encryption key as well @copilot |
rob-at-cortex
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.
lets add the user id to part of the encryption key as well @copilot
|
@rob-at-cortex Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
|
lets add the user id to part of the encryption key as well @copilot |
|
@rob-at-cortex Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
OAuth
access_tokenandrefresh_tokenvalues are now encrypted using AES-256-GCM before persisting to the Payload database Users collection. Decryption is automatic on retrieval.Changes
crypto.ts: New module withencryptToken()anddecryptToken()using AES-256-GCMPAYLOAD_SECRETvia SHA-256iv:authTag:encryptedData(hex-encoded)configuration.ts: Encrypts tokens inupsertAccount()before database writegetAccessToken.ts: Decrypts tokens on read, re-encrypts refreshed tokens before writedocs/token-encryption.md: Documents encryption method, security considerations, and migration strategyExample
Encryption/decryption is transparent to consumers:
Security
PAYLOAD_SECRETenv var; changing it invalidates existing encrypted tokensOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.