Skip to content

feat: use STDOUT when report file not specified#1642

Merged
zricethezav merged 3 commits intogitleaks:masterfrom
bthuilot:feat/report-to-stdout
Dec 5, 2024
Merged

feat: use STDOUT when report file not specified#1642
zricethezav merged 3 commits intogitleaks:masterfrom
bthuilot:feat/report-to-stdout

Conversation

@bthuilot
Copy link
Contributor

Description:

Addresses #1312 to write report to /dev/stdout when report-path is set to "" or "-".

Checklist:

  • Does your PR pass tests?
  • Have you written new tests for your changes?
  • Have you lint your code locally prior to submission?

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>
Signed-off-by: Bryce Thuilot <bryce@thuilot.io>
Copy link
Contributor

@rgmz rgmz left a comment

Choose a reason for hiding this comment

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

Right now this causes the report to be written to STDOUT for commands like gitleaks dir /tmp/example --verbose.

I think it needs to change the ext flag so that STDOUT only happens if report-format is set by the users. Either that or reserve a special report-path like - for STDOUT.

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>
@bthuilot
Copy link
Contributor Author

@rgmz I updated it so now only - specifies STDOUT, since I think that is the most intuitive for an end user but happy to change if you think only when report-format is set

@bthuilot bthuilot requested a review from rgmz November 18, 2024 22:59
@zricethezav
Copy link
Collaborator

@bthuilot great work! I like this feature a lot

@zricethezav zricethezav merged commit f3adda0 into gitleaks:master Dec 5, 2024
@bthuilot bthuilot deleted the feat/report-to-stdout branch December 5, 2024 16:52
rgmz pushed a commit to rgmz/gitleaks that referenced this pull request Dec 5, 2024
* feat: use STDOUT when report file not specified

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>

* fix: update tests

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>

* fix: use only '-' for stdout report

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>

---------

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>
rgmz pushed a commit to rgmz/gitleaks that referenced this pull request Dec 5, 2024
* feat: use STDOUT when report file not specified

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>

* fix: update tests

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>

* fix: use only '-' for stdout report

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>

---------

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>
alayne222 pushed a commit to alayne222/gitleaks that referenced this pull request May 28, 2025
* feat: use STDOUT when report file not specified

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>

* fix: update tests

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>

* fix: use only '-' for stdout report

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>

---------

Signed-off-by: Bryce Thuilot <bryce@thuilot.io>
@rgmz rgmz mentioned this pull request Nov 17, 2025
3 tasks
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