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.
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
Feature/gale local ocr #671
Feature/gale local ocr #671
Changes from 25 commits
9a45cd9
58eacbf
be9cabe
5ee0a99
973dbbc
1d5fbee
d9c73fb
6170366
f4926cc
7e2af1b
c017179
e7e1ee3
c84d75b
e6c64d6
f16d3d5
463dc4d
b8513ef
1a94dd0
5f28589
f377789
4cbe4bf
ef6b224
f2e3a11
debf92e
3d70d8c
c8e4b0a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that the constructed file path is contained within a safe root directory. This can be achieved by normalizing the path using
os.path.normpath
and then checking that the normalized path starts with the root directory. This approach will prevent path traversal attacks by ensuring that the final path does not escape the intended directory.os.path.normpath
.ocr_dir
).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.
This copilot suggestion is interesting, I wasn't familiar with
normpath
. This shouldn't happen in our code the way we're using the new method, although the check shouldn't hurt. I wonder if usingos.path.join
helps any instead of using the f-string to construct the path.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.
Yeah, using
os.path.join
seems like a better idea to me.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.
nice!