Skip to content

Commit

Permalink
Potential fix for code scanning alert no. 22: Uncontrolled data used …
Browse files Browse the repository at this point in the history
…in path expression

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 493d96c commit 2b550f3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions freezing/web/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ def _get_cached(key: str, compute):

content = compute()
cache_file.parent.mkdir(parents=True, exist_ok=True)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
if not str(cache_file).startswith(str(Path(cache_dir).resolve()) + os.sep):
raise Exception("Invalid cache file path")
cache_file.write_bytes(content)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.

return content
Expand Down

0 comments on commit 2b550f3

Please sign in to comment.