-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Resolve for #4882] feat: add regex validation for secret key #4883
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?
[Resolve for #4882] feat: add regex validation for secret key #4883
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Greptile Summary
Confidence Score: 2/5
Important Files Changed
|
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.
Additional Comments (3)
-
frontend/src/components/utilities/parseSecrets.ts, line 106-187 (link)logic:
parseYamlis missing the sameVALID_KEY_REGEXvalidation that was added toparseDotEnvandparseJson. Users can still import YAML files with invalid secret keys, bypassing the validation.Add validation after line 126:
const [, key, rawValue] = keyMatch; if (!VALID_KEY_REGEX.test(key)) { i += 1; continue; } let value = rawValue.trim();
-
frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretDropzone/SecretDropzone.tsx, line 371-385 (link)logic: CSV import via
finishMappedMatrixImportdoesn't validate secret keys againstVALID_KEY_REGEX. Users can import CSV files with invalid keys like Unicode characters or special symbols, bypassing the validation implemented in this PR. -
frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretDropzone/PasteSecretEnvModal.tsx, line 44-62 (link)style: When secrets are silently filtered out due to invalid keys (via
parseDotEnv/parseJson), users receive a generic error "No secrets found" without knowing that some keys were rejected. Consider showing how many keys were filtered and which ones were invalid.
2 files reviewed, 5 comments
Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format
...rc/pages/secret-manager/SecretDashboardPage/components/CreateSecretForm/CreateSecretForm.tsx
Show resolved
Hide resolved
|
Hey team 👋, Would appreciate a quick review 🙏 |
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.
Additional Comments (1)
-
frontend/src/pages/secret-manager/SecretDashboardPage/components/CreateSecretForm/CreateSecretForm.tsx, line 89-110 (link)logic: Form allows submitting invalid secret keys despite showing warnings. The validation should block submission if
!VALID_KEY_REGEX.test(key)to prevent creating incompatible secrets. Add validation to the zod schema or prevent form submission when invalid.
3 files reviewed, 5 comments
Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format
Description 📣
Resolves #4882
Improves secret key validation for .env, .json, .yml, and manual entry.
Blocks Unicode and special-character keys and shows warning tooltips.
Ensures secret keys remain compatible with AWS, Docker, Kubernetes, and other platforms.
Only allow ASCII-safe keys:
A–Z a–z 0–9 . _ -
Invalid keys should be rejected or highlighted with a tooltip warning.
Type ✨
Tests 🛠️
Image
Image