Commit Graph
38 Commits
Author SHA1 Message Date
Shahzad Haider 2114e77d56 Fix legacy json flag for Github and Gitlab private repos (#4386)
* fix legacy json flag for gitlab private repos

* some code

* incorporated code from main

* remove cloned repositories after the scan is complete

* enhanced the code

* comment addressed

* changed the approach for persisting the repositories for legacy json printing

* addressed comments; updated the variable names
2025-09-03 11:19:28 +05:00
Kashif Khan 07c16636eb Enable cloning repository to a specified location with retention option (#4408)
* Enabled cloning repositories to a specified path with retention option

* Fixes after testing

* resolved lint issue

* resolved comments

* enabled clone path for github basic auth
2025-08-20 18:10:02 +05:00
Sahil SilareandKashif Khan 3547a6efe1 chore: added github action custom detector name (#3417)
* [detector] feat: added rootly detector

* chore: fixed to show name in detector action on github

* Revert "[detector] feat: added rootly detector"

This reverts commit 1fcff0a807.

---------

Co-authored-by: Kashif Khan <70996046+kashifkhan0771@users.noreply.github.com>
2025-04-30 19:05:08 +05:00
Casey Tran 793c09da0f Postman source handle different JSON info for headers (#3995) 2025-03-27 19:18:47 -05:00
Kashif Khan 00ba5a6cd5 Add terminal output for analyze, if detector support it (#3959) 2025-03-05 22:57:56 -08:00
Casey Tran 9ecaf075c5 Update postman metadata (#3852)
* Updated Postman metadata fields to contain location uniqueness and took out the unused fields of global_id, field_name, and variable_type.
* Disabled body scanning for now since the only body that is scanned is the currently selected radio button but secrets can still be saved in the other unselected radio button options.
* Updated link generation for more accuracy.
* Updated tests to not use global constant.
2025-01-30 09:52:47 -06:00
Cody Rose ddc015e5ed Implement verification cache (#3801)
This PR introduces a cache that allows the scanner to avoid emitting multiple requests to verify the same credential. In practice, it doesn't seem to reduce scan time at all, but it does seem to reduce the number of calls to FromData rather drastically.

The cache is implemented as an opt-out feature that can be disabled with a new CLI flag. If we don't like this, we can change it.

The metrics collection hopefully isn't too architecture-astronauty; I wanted to create something useful here that could also accommodate future Prometheus configuration without making the implementation all stupid.
2024-12-20 13:40:29 -08:00
ahrav c3ff1794b1 Add Detector Description to JSON output (#3404) 2024-11-13 12:23:50 -08:00
Cody Rose ad15888a33 Move DecoderType into ResultWithMetadata #3502
Result.DecoderType is only ever used by ResultWithMetadata (via its embedded Result). This unnecessarily complicates the relationship between the types and adds some warts to #3457, so this PR moves DecoderType directly into the only struct which actually uses it.
2024-10-28 12:20:42 -04:00
Dustin Decker 0ce02fc827 Make connection issues less jarring (#2730)
* Make connection issues less jarring

* lint

* fix lint issue

* print just the connection issue in yellow

* update terminology
2024-04-23 14:29:38 -07:00
Richard Gomez f5025fd382 Add --results flag (#2372)
This is a follow-up to #2107 and #2335. It adds a new (hidden) --results flag that allows a user to show any combination of verified, unverified, and indeterminate secrets.
2024-03-15 10:19:31 -04:00
ahrav bbf1decb39 prevent concurrent map writes (#2399) 2024-02-07 17:45:06 -08:00
āh̳̕mͭͭͨͩ̐e̘ͬ́͋ͬ̊̓͂d fa1c5fa583 updates to plain and json printing to include verification error (#2335) 2024-01-29 11:57:28 -05:00
ahrav 279f915799 [chore] - fix error comparisons (#2142)
* fix error comparisons

* fix imports
2023-12-01 08:32:41 -08:00
ahrav 22876f8381 replace interface{} with any. (#1771) 2023-09-15 04:35:15 -07:00
Miccah dbcb888063 Update Source interface to use SourceID and JobID types (#1774)
The previous implementation used int64 for both, which can be mixed up
easily. Using distinct types adds a layer of type safety checked by the
compiler.
2023-09-14 11:28:24 -07:00
ahrav 0932ea224b [chore] - Prevent nil deref panic (#1709) 2023-08-26 20:39:50 -07:00
ahrav b1947246d9 Make prints to stdout serial. (#1597) 2023-08-02 11:38:10 -07:00
ahrav 5e7a6ca11c Concurrent detection (#1580)
* Run detection on each chunk concurrently.

* Add printer functionality.

* Add logic for dedupe.

* cleanup.

* Moddify number of notifier workers.

* Add comment.

* move consts into fxn.

* buffer resutls chan.

* fix test.

* address comments.

* return an error from Finish.

* fix test.

* fix test.

* linter.

* check err.

* address comments.
2023-07-31 11:12:08 -07:00
trufflesteeeve 1a81709726 Check to see if StructuredData exists before attempting to print it (#1346) 2023-05-18 17:42:19 -04:00
Brendan Shaklovitz 88b4a283c4 Add extra data and structured data to plain output (#1316)
* Add extra data and structured data to plain output

* Remove duplicate ExtraData output
2023-05-16 08:14:42 -07:00
Brendan Shaklovitz fad34d4dc6 git worktree scanning fix for #827 (#1315)
* Fix worktree scan by setting EnableDotGitCommonDir

* Change `PlainOpenOptions` to set `EnableDotGitCommonDir` to true.
  In every current usage of this function, it is on an already-cloned
  repository, so it should always be valid to have this set. By doing
  so, it should fix some issues with worktrees.

* Remove unused go.mod replace directives

* Remove replace directives for libraries that are not in use.
2023-05-09 08:00:47 -07:00
Yassine Ilmi a002ba9a75 Add RawV2 Results to the JSON Output (#1273)
* Add RawV2 to JSON Output

* Adding RawV2 results to Azure, Datadog and GCP Detectors
2023-04-20 16:31:53 -07:00
Dustin DeckerandMike Vanbuskirk cb454bfc05 Add GitHub Actions output (#1201)
* Add GitHub Actions output

Co-authored-by: Mike Vanbuskirk <mike.vanbuskirk@trufflesec.com>
2023-03-28 09:07:26 -07:00
Miccah 161e499142 [chore] Remove logrus from trufflehog (#1095)
* [chore] Remove logrus from trufflehog

* Minor fixes

* Fix logFatal call

* Fix logrus call
2023-02-14 17:00:07 -06:00
ahmed 2060ae1c47 Updated stdout to print results in alphabetical order for consistent output (#1032) 2023-01-19 12:58:50 -05:00
ahrav dd141fb55f [oc-147] - Add context to all git methods (#901)
* Add context to all git methods.

* remove logrus.

* Add ctx.

* Address comments.

* Add error to clone failing.

* Return error.
2022-11-03 16:36:52 -07:00
ahrav 128002885a Add decoder type to results. (#835) 2022-10-06 11:55:07 -07:00
Dustin Decker c88e84d3f0 Fix json output which was previously b64 encoding bytes instead of printing the string (#825) 2022-09-27 11:57:35 -07:00
Dustin Decker 85ed11519f fix npd for incompatible sources on json legacy output (#623) 2022-06-21 09:50:55 -07:00
Miccah 6fa2171a22 Refactor Engine to wait for workers in a Finish method (#581)
* Refactor Engine to wait for workers in a Finish method

This should allow the engine to run multiple concurrent scans if
desired before shutting down.

Additionally, this commit refactors some of the printing logic to the
output package.

* Fix tests
2022-05-25 11:35:44 -05:00
ahrav ac6fc02f36 Fix crash when scanning with json-legacy flag on a github repo. (#491) 2022-04-29 17:28:04 -07:00
Dustin Decker dd86389487 Address some linting issues (#390) 2022-04-12 22:11:34 -07:00
Bill Rich c2b4f0bc39 Include line numbers in git metadata (#97)
* Include line numbers in git metadata

* Update tests for fragments and line numbers
2022-03-22 09:27:15 -07:00
Dustin Decker 77418fb3f8 module v3 2022-02-15 18:54:47 -08:00
Dustin Decker 7e38e699f6 GitHub concurrency (#25)
* GitHub scan concurrency

* Add raw result to plain output

* Fix flakey test (still flakey)

* Fix race
2022-02-15 18:54:47 -08:00
Dustin Decker 089b5c9063 improved plain output 2022-02-15 18:54:47 -08:00
Bill Rich d5f3bd75ef Add --json-legacy flag to make output match pre-v3.0 2022-02-15 18:54:47 -08:00