Skip to content

test(output): make paths absolute#2034

Merged
another-rex merged 6 commits into
google:mainfrom
ackama:output/add-working-directory-case
Jul 16, 2025
Merged

test(output): make paths absolute#2034
another-rex merged 6 commits into
google:mainfrom
ackama:output/add-working-directory-case

Conversation

@G-Rath
Copy link
Copy Markdown
Collaborator

@G-Rath G-Rath commented Jul 7, 2025

We expect the source information given to output to always be an absolute path, but our internal fixtures are currently using relative paths, so this changes that.

Note that this is about making the existing snapshots accurate to our current output even if that isn't something we like - if anyone feels something should be changed as a result of this, please file an issue

@G-Rath G-Rath force-pushed the output/add-working-directory-case branch from c0166de to ffe6a69 Compare July 8, 2025 00:34
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.07%. Comparing base (6e5607b) to head (10df4ac).
⚠️ Report is 464 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2034      +/-   ##
==========================================
- Coverage   66.09%   66.07%   -0.02%     
==========================================
  Files         172      172              
  Lines       16214    16214              
==========================================
- Hits        10716    10713       -3     
- Misses       4848     4850       +2     
- Partials      650      651       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@G-Rath G-Rath force-pushed the output/add-working-directory-case branch 5 times, most recently from 9824188 to f35f535 Compare July 8, 2025 21:08
@G-Rath
Copy link
Copy Markdown
Collaborator Author

G-Rath commented Jul 8, 2025

@another-rex so I think I've got this sorted for the output package, but it looks like container scanning does pass through relative paths:

image

This seems to be by design e.g. for lib/apk/db/installed, that is the exact path being checked for by the os/apk extractor, which makes sense as the Path property is meant to be relative to the Root - so if we're saying output should always be given absolute paths, we might need to have the container path sort that out...

That shouldn't be a blocker for this though so I can create an issue and we can go from there - there's also the question on if we want to include any runtime or test-only checks to help catch this in future

(since I'm about to remove the check, here's a link to the run: https://github.com/google/osv-scanner/actions/runs/16154653469/job/45594387172?pr=2034)

@G-Rath G-Rath force-pushed the output/add-working-directory-case branch 3 times, most recently from e7f2858 to d95a0c8 Compare July 8, 2025 22:53
@G-Rath G-Rath requested review from another-rex, cuixq and hogo6002 July 9, 2025 00:19
@G-Rath G-Rath marked this pull request as ready for review July 9, 2025 00:19
@G-Rath G-Rath force-pushed the output/add-working-directory-case branch from d95a0c8 to 774edaa Compare July 10, 2025 00:29
@another-rex
Copy link
Copy Markdown
Collaborator

It should be a simple fix, as all container scanning should be relative to root, we just need to add a loop in ScanContainer to add / to all Locations that pop out of ScanContainer.

@another-rex
Copy link
Copy Markdown
Collaborator

Or try setting StoreAbsolutePath to be true in the config for ScanContainer() call.

@G-Rath G-Rath force-pushed the output/add-working-directory-case branch from 774edaa to 332246b Compare July 14, 2025 04:44
@another-rex
Copy link
Copy Markdown
Collaborator

Need to merge and rerun the snapshots, because of #2064

@G-Rath G-Rath force-pushed the output/add-working-directory-case branch from 332246b to 10df4ac Compare July 16, 2025 04:24
@another-rex another-rex merged commit 3fcff0e into google:main Jul 16, 2025
16 checks passed
@another-rex another-rex deleted the output/add-working-directory-case branch July 16, 2025 04:41
herdiyana256 added a commit to herdiyana256/osv-scanner that referenced this pull request May 15, 2026
herdiyana256 added a commit to herdiyana256/osv-scanner that referenced this pull request May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants