-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Making API keys completely write only for the frontend #608
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Block saves/renames while value is masked to prevent persisting “[ENCRYPTED]”.
If a user renames or saves without editing, you’ll POST/PUT the literal placeholder, corrupting the real secret. Guard early.
for (const cred of customCredentials) { if (cred.hasChanges || cred.isNew) { if (!cred.key) { showToast('Key name cannot be empty', 'error'); hasErrors = true; continue; } + // Prevent persisting the placeholder for backend-encrypted items + if (cred.isFromBackend && cred.is_encrypted && cred.value === '[ENCRYPTED]') { + showToast(`Edit ${cred.key} to provide a new value before saving or renaming.`, 'warning'); + hasErrors = true; + continue; + }Optionally, also disable key renames for masked items (prevents confusion):
Also applies to: 153-210
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.
No way to save something without editing it first
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.
So we are good here
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.
@coleam00 You're right that the
hasChangesflag only gets set when specific fields are modified. However, there's still a potential edge case I was concerned about:If a user renames the key of a masked credential (changes
cred.key), that setshasChanges = true, but the value remains[ENCRYPTED]. Then when they save, the system would attempt to persist that placeholder string as the actual credential value.Looking at the code:
So while you can't save without some edit, you could potentially save after just renaming the key, which would be problematic.
That said, if this scenario seems unlikely in practice or if you prefer to handle it differently (like showing a more targeted error when it happens), I understand. The core security goal of not exposing decrypted values is already achieved.
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.
@coleam00 You're absolutely right! Looking at the code flow more carefully:
hasChanges: falsehasChanges || isNewis truehasChanges: true, the credential must be edited viaupdateCredential()"[ENCRYPTED]"placeholder and setsisFromBackend: falseSo there's indeed no pathway to save the placeholder - the existing logic already prevents this issue. Thanks for the clarification!
🐰✨ happy rabbit ears perk up with understanding
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!