Repository navigation
Updates to generated filenames - #4043
Merged
Merged
Conversation
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
…th traversal concerns. 1) Removed the basedir check in inspec_profile as unnecessary on top of the checks that we are already doing. 2) Added checks (in some cases might be an overabundance of caution) for any filenames that were not directly supplied by the user or us the code authors. 3) Reworked convertfullnametopath function and renamed it to basenane and then used it everywhere instead of path.basenane which as explained in the comment is flawed in some of the ways/places we use this function. The rename is cause that's the actual behavior that was being done. 4) Slightly extended the checkSuffix function and use it in some more places. Additionally ensure that the checkSuffix call happens on the outside of any of the basename calls. 4) Linting Signed-off-by: Amndeep Singh Mann <[email protected]>
Signed-off-by: Amndeep Singh Mann <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Amndeep7
previously requested changes
Jun 13, 2025
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
Signed-off-by: George M Dias <[email protected]>
georgedias
commented
Jun 14, 2025
| trimmedPath.lastIndexOf('/'), | ||
| trimmedPath.lastIndexOf('\\'), | ||
| ) | ||
| return trimmedPath.slice(Math.max(0, lastSeparatorIndex + 1)) |
Contributor
Author
There was a problem hiding this comment.
I don't think we need the Math.max here as the slice() method already handles out-of-range indices gracefully (e.g., slicing from 0 if lastSeparatorIndex is -1).
Suggest changing to this:
// Return the substring after the last separator, or the entire string if no separator is found
return trimmedPath.slice(lastSeparatorIndex + 1);
georgedias
commented
Jun 14, 2025
georgedias
left a comment
Contributor
Author
There was a problem hiding this comment.
PR should now be ready.
Signed-off-by: Amndeep Singh Mann <[email protected]>
…curacy when directly provided the empty string or a string consisting of separators that would eventually be processed into the empty string Signed-off-by: Amndeep Singh Mann <[email protected]>
|
Amndeep7
approved these changes
Jun 15, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Fixed potential path traversal issues