Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-receive does not print filenames with spaces correctly #273

Closed
agateau-gg opened this issue Jun 22, 2022 · 0 comments · Fixed by #298
Closed

pre-receive does not print filenames with spaces correctly #273

agateau-gg opened this issue Jun 22, 2022 · 0 comments · Fixed by #298
Labels
status:confirmed This issue has been reviewed and confirmed type:bug Something isn't working
Milestone

Comments

@agateau-gg
Copy link
Collaborator

agateau-gg commented Jun 22, 2022

GitGuardian Shield Version

  • 1.12.0

Command executed

ggshield secret scan pre-receive

Describe the bug

  • Unpack this zip file, it contains a git repository with this content:
    • biggerpython_server copie 11.py: a file with spaces in its name. Contains a secret.
    • startscan.sh: a script to reproduce the bug. It calls ggshield secret scan pre-receive with the right stdin content.
  • Run startscan.sh

The output looks like this:

$ ./startscan.sh 
Scanning Commits  [####################################]  100%

commit 9e0b342414884fc68e8939504545c479524c38dd
Author: Aurelien Gateau <aurelien.gateau@gitguardian.com>
Date: Wed Jun 22 14:52:35 2022 +0200

🛡️  ⚔️  🛡️  1 incident has been found in file pie

(...)

As you can see the file name is wrong.

Expected behavior

File name should be printed correctly, like ggshield secret scan path 'biggerpython_server copie 11.py' does:

secrets-engine-version: 2.69.0

🛡️  ⚔️  🛡️  1 incident has been found in file /home/agateau/tmp/prereceive-filename-bug-example/biggerpython_server copie 11.py
(...)
@agateau-gg agateau-gg added type:bug Something isn't working status:confirmed This issue has been reviewed and confirmed labels Jun 22, 2022
@agateau-gg agateau-gg added this to the 1.13.0 milestone Jul 13, 2022
agateau-gg added a commit that referenced this issue Jul 15, 2022
…273)

This bug caused crashes in `scan pre-receive` and `scan repo`.

Refactors the parser to use a stricter way to extract the filename. As a
result, test data in test_scannable.py had to be adjusted because their
diff files were wrong.

Fixes #273
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:confirmed This issue has been reviewed and confirmed type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant