Skip to content

Commit

Permalink
some infer paths are relative?
Browse files Browse the repository at this point in the history
  • Loading branch information
kenohassler committed Mar 19, 2024
1 parent 0fce701 commit 39fb5b6
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,11 @@ def _format(self, string: str) -> SASTFlags:
vuln = flag["bug_type"]

# remove the temp prefix from the path, but keep the rest
fparts = Path(file).parts
assert fparts[0] == "/" and fparts[1] == "tmp"
tmp_source = Path(fparts[0] + fparts[1]) / fparts[2] / fparts[3]
file = str(Path(file).relative_to(tmp_source))
if Path(file).is_absolute():
fparts = Path(file).parts
assert fparts[0] == "/" and fparts[1] == "tmp", f"file not in /tmp: {file}"
tmp_source = Path(fparts[0] + fparts[1]) / fparts[2] / fparts[3]
file = str(Path(file).relative_to(tmp_source))

flags.add(SASTFlag(tool, file, line, vuln))

Expand Down

0 comments on commit 39fb5b6

Please sign in to comment.