-
Notifications
You must be signed in to change notification settings - Fork 13
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
Simplify seed creation/validation commands #1202
Conversation
2ca2fd8
to
bdc8214
Compare
@brave/griffin-maintainers ptal |
bdc8214
to
2040f36
Compare
BTW, we don't have a protection against duplicating some things:
This is also considered only as a format error:
|
4ba7ac8
to
308ee06
Compare
[puLL-Merge] - brave/brave-variations@1202 DescriptionThis PR refactors and consolidates the seed tools, particularly focusing on the study validation and seed creation processes. It combines multiple commands into a single ChangesChanges
Possible Issues
Security HotspotsNo significant security hotspots were identified in this change. The modifications primarily focus on code organization and error handling, which don't directly impact security. However, as with any significant refactoring, thorough testing should be performed to ensure that all functionality, including any security-related checks, continues to work as expected. |
308ee06
to
353b2b4
Compare
const errors: string[] = []; | ||
|
||
for (const file of files) { | ||
const filePath = path.join(studiesDir, file); |
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.
reported by reviewdog 🐶
[semgrep] Detected possible user input going into a path.join
or path.resolve
function. This could possibly lead to a path traversal vulnerability, where the attacker can access arbitrary files stored in the file system. Instead, be sure to sanitize or validate user input first.
Source: https://semgrep.dev/r/javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Cc @thypon @kdenhartog
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.
I'm not seeing anyway that someone could produce a file traversal vulnerability with this. readdir returns an array of the current files in the directory and excludes the usage of '.' and '..'
. This seems fine to me.
Removed unnecessary commands, reworked validation logic to always return errors as array of strings instead of throwing.