Repository navigation
Resolve the reachability facts file against the target path - #420
Merged
Oskar Haarklou Veileborg (BarrensZeppelin) merged 3 commits intoOct 22, 2026
Merged
Oskar Haarklou Veileborg (BarrensZeppelin) merged 3 commits into
Oskar Haarklou Veileborg (BarrensZeppelin) merged 3 commits into
Conversation
Oskar Haarklou Veileborg (BarrensZeppelin)
requested a review
from a team
as a code owner
October 22, 2026 08:45
Oskar Haarklou Veileborg (BarrensZeppelin)
requested a review
from Martin Torp (mtorp)
October 22, 2026 08:52
Coana runs with its working directory set to --target-path, so a relative --reach-output-file lands there, but the CLI looked for it relative to its own working directory. When the two differed (as in the Docker image), reading the scan ID logged a spurious "Facts file not found" warning, --only-facts-file submitted a file that didn't exist, and --reach-use-only-pregenerated-sboms silently left the facts file out of the upload. Resolve the path once in run_reachability_analysis and use the returned report_path everywhere.
Oskar Haarklou Veileborg (BarrensZeppelin)
force-pushed
the
oskar/reach-facts-file-target-path
branch
from
October 22, 2026 08:57
e98b263 to
c0925dc
Compare
Oskar Haarklou Veileborg (BarrensZeppelin)
requested a review
from Benjamin Barslev Nielsen (barslev)
October 22, 2026 09:26
Martin Torp (mtorp)
approved these changes
Oct 22, 2026
Martin Torp (mtorp)
left a comment
Contributor
There was a problem hiding this comment.
Good catch ✅
Oskar Haarklou Veileborg (BarrensZeppelin)
merged commit Oct 22, 2026
2ddf83d
into
main
32 checks passed
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.
Coana runs with its working directory set to
--target-path, so a relative--reach-output-file(default.socket.facts.json) is written inside the target directory.output.pyandalert_selection.pyalready join the target path when they read it, but three places resolved it against the CLI's own working directory instead. Whenever the two differ, as they usually do in the Docker image (--target-path /scan, working directory/app):Facts file not found: .socket.facts.jsonwarning, andResults written to:named the wrong path;--only-facts-filesubmittedos.path.abspath(".socket.facts.json"), a file that doesn't exist;--reach-use-only-pregenerated-sbomsfailed itsos.path.existscheck and silently left the facts file out of the upload.run_reachability_analysisnow resolves the path once withos.path.join(target_directory, output_path), the same ruleoutput.pyuses, so an absolute path passes through unchanged. It returns the result asreport_path, whichsocketcli.pynow uses for both submission modes. The Coana command line is unchanged.The fake Coana in
tests/unit/test_reachability.pynow writes the facts file to its--socket-modepath, as the real one does. A new test runs the analysis from a working directory other than the target and checks bothreport_pathand the scan ID, for relative and absolute output paths; the relative case fails without the fix. The twosocketcli.pycall-site changes have no dedicated tests, because that logic sits insidemain_code()and nothing drives it today.I found the warning while running a reachability full scan in the Docker image for #419. I have not rerun that scan with this fix.
Expected reviewer effort: Full code review
Note
Medium Risk
Changes which file path is submitted and logged for reachability runs; fixes broken Docker flows but incorrect paths could still affect scan uploads if join semantics were wrong.
Overview
Fixes reachability facts file path handling when the CLI’s working directory differs from
--target-path(e.g. Docker:/appvs/scan). Coana already writes relative--reach-output-filepaths under the target directory; this PR makes the Python CLI resolve that location consistently before reading the scan ID and submitting files.run_reachability_analysisnow joinstarget_directorywithoutput_path(absolute paths unchanged), uses that for_extract_scan_id, and returns it asreport_path.socketcli.pyusesresult['report_path']for--only-facts-fileand--reach-use-only-pregenerated-sbomsinstead of resolving against the CLI cwd.Unit tests update the fake Coana wrapper to write the facts file like production and add coverage for relative and absolute output paths when cwd ≠ target.
Reviewed by Cursor Bugbot for commit e98b263. Configure here.