Skip to content

Conversation

@salome-voltz
Copy link
Collaborator

@salome-voltz salome-voltz commented Oct 20, 2025

Context

Ggshield crashes on scanning non-seekable files, to reproduce (only on linux):

> cd test_folder/
> ln -s /proc/self/mounts ./mtab
> ls -l mtab #verify if the symbolic link is correctly set up
> ggshield secret scan path ./mtab

Should return:

Scanning... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% 0 / 1

Error: [Errno 22] Invalid argument

Explicitly skip them with a message:
image

@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.94%. Comparing base (f92b323) to head (5681156).
⚠️ Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
ggshield/verticals/secret/secret_scanner.py 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1133      +/-   ##
==========================================
- Coverage   91.96%   91.94%   -0.02%     
==========================================
  Files         144      144              
  Lines        6174     6196      +22     
==========================================
+ Hits         5678     5697      +19     
- Misses        496      499       +3     
Flag Coverage Δ
unittests 91.94% <75.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@salome-voltz salome-voltz force-pushed the salomevoltz/scrt-5971-ggshield-runs-into-oserror-errno-22-invalid-argument-when branch from b85664e to 92cc9f1 Compare October 20, 2025 16:12
@salome-voltz salome-voltz self-assigned this Oct 21, 2025
@salome-voltz salome-voltz marked this pull request as ready for review October 21, 2025 12:19
@salome-voltz salome-voltz requested a review from a team as a code owner October 21, 2025 12:19
try:
byte_size = fp.seek(0, SEEK_END)
except OSError:
raise NonSeekableFileError("File does not support seeking operations")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove the error message: it's never shown.

Copy link
Collaborator

@agateau-gg agateau-gg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Can you squash and merge?

@salome-voltz salome-voltz force-pushed the salomevoltz/scrt-5971-ggshield-runs-into-oserror-errno-22-invalid-argument-when branch from 9fbc396 to 5681156 Compare October 23, 2025 14:44
@salome-voltz salome-voltz merged commit ef0d64e into main Oct 23, 2025
28 of 31 checks passed
@salome-voltz salome-voltz deleted the salomevoltz/scrt-5971-ggshield-runs-into-oserror-errno-22-invalid-argument-when branch October 23, 2025 14:50
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.

2 participants