Commit graph

2689 commits

Author SHA1 Message Date
Zachary Rice
b78be6d935
hit em w/ a min (#3316) 2024-09-23 11:07:39 -05:00
ahrav
97fd2f80ee
[fix] - Add Size Method to BufferedReadSeeker and Refactor Context Timeout Handling in HandleFile (#3307) 2024-09-23 06:21:07 -07:00
Miccah
77dc2720a8
Update GitHub enumeration to report unique filtered values (#3292)
The reported values should match the values populated in s.repos.
2024-09-18 14:30:10 -07:00
Miccah
b2da2a6a5c
[analyze] Add client filter to detect successful unsafe HTTP requests (#3305)
* Move analyzer client to its own file

* Add analyzer client filter to detect successful unsafe HTTP requests

* Close response body in test
2024-09-18 10:31:21 -07:00
Miccah
401bc4687b
Instrument GitHub source with a ChunkReporter (#3296) 2024-09-16 09:57:09 -07:00
Dustin Decker
7e78ca385f
Add user agent suffix feature flag (#3297)
* Add user agent suffix feature flag

* unecessary concat
2024-09-13 15:20:43 -07:00
Miccah
213bf7e4fd
Fix GitHub analyzer panic on empty organization name (#3295) 2024-09-13 11:31:31 -07:00
tiaoxizhan
07dc95dd58
Fix slice initialization error (#3293) 2024-09-13 06:14:51 -07:00
Abdul Basit
dc9c9a30b3
[analyze] Add analyzer interface for Shopify (#3226)
* implement analyzer interface for shopify

* fixed shopify analyzer according to new code and generated permissions

* shopify analyzer test added

* [chore]
- key validations
- linked analyzer with detectors

* [chore]
- moved redundant initialize to global.

* [chore]
moved expected output of test in json file to neat the code.

* [Fixes]
- Fixed permission and category resource issue in shopify analyzer
- corrected test for shopify analyzer

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-12 11:53:42 -07:00
Abdul Basit
57e58123f1
[analyze] Add Analyzer for Mailgun (#3206)
* implement analyzer interface, add unit test and link with detector for mailgun

* [chore] moved expected output of test in json file to neat the code.
corrected variable name for test in detector bucket

* append domain id in fully qualified name of domain resources

* [Fixes]
domains will be added as resource in bindings and permissions.
updated the test.

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-12 11:48:46 -07:00
Abdul Basit
b0318a9edb
[analyze] Add Analyzer for MySQL (#3193)
* implement analyzer interface for mysql

* add integration test for mysql analyzer

* linked detectors with analyzers for jdbc and mysql
validation for connection string in analyzer

* refactored secretInfoToAnalyzerResult func

* generated permissions for mysql analyzer

* [chore]
- optimization in execution flow
- use test-container library for analyze test.

* added host in secret info struct
simplified the mysql test due to huge structure

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-12 11:48:34 -07:00
Miccah
e89190f3ed
Instrument GitHub source with a UnitReporter (#3284)
* Fix GitHub integration test

* Instrument GitHub source with a UnitReporter

The reporter is currently unused, but is the first step to support
scanning while enumerating.

* Update GitHub unit tests
2024-09-12 10:28:37 -07:00
dylanTruffle
029f03e7bd
adding pypi v1 support (#3289)
Co-authored-by: Dylan Ayrey <dxa4481@rit.edu>
2024-09-11 21:39:01 -07:00
dylanTruffle
d201e54305
adding pypi detector (#3287)
* adding pypi detector

* update test and use helper

---------

Co-authored-by: Dylan Ayrey <dxa4481@rit.edu>
Co-authored-by: Dustin Decker <dustin@trufflesec.com>
2024-09-11 19:17:17 -07:00
Dustin Decker
70c6bb5634
feature flag additional refs (#3282) 2024-09-10 15:51:41 -07:00
Richard Gomez
b7411d2922
Clarify "no decoder found for chunk" log message (#3001)
* chore(engine): clarify trace log message

* chore(engine): fix merge conflicts
2024-09-10 13:58:40 -05:00
Zachary Rice
2fb90295ce
update aha keyword (#3281) 2024-09-10 13:07:27 -05:00
ahrav
5dad5a738b
[chore] - remove unused method and function (#3089)
* remove unused method

* delete more unused stuff
2024-09-10 12:35:49 -05:00
Ankush Goel
0feca62469
Jira Email fix (#3061) 2024-09-10 12:27:55 -05:00
Valentin B.
075f8c67a5
fix(git): config normalization for git sources (#3278)
When normalizing the git source config, the base and head refs should be normalized to commit hashes, in case
a branch or tag name was used. The `resolveAndSetCommit` function was returning a boolean value which should
indicate whether the input ref was changed from its original value. While this is in itself not a problem,
the caller (`normalizeConfig`) was using this boolean as an error marker, and returning early in case of `false`.

This meant that if the config was already containing a commit hash for the base or head ref, `resolveAndSetCommit`
would set the flag to `false` and `normalizeConfig` would early return erreneously. This caused the logic to find
the ancestor commit to be skipped which caused the bug in the issue #3220.

Since the `resolveAndSetCommit` function was only used in `normalizeConfig`, the signature has been changed to only
return the commit object and an error. The check for early return in `normalizeConfig` now instead relies on the
commit object being `nil` to indicate a failure to resolve the ref.

Refs: #3220
2024-09-10 12:12:57 -05:00
Daniel Teixeira
f24f62832b
Add detector for Nvidia NGC Personal Keys (#3280)
* Add detector for Nvidia NGC Personal Keys

* Update nvapi.go to use `nvapi-` as the keyword
2024-09-10 08:36:33 -07:00
Nash
17f6c98119
GitHub source logger clean up (#3269)
* GitHub source logger clean up

* applied pr comments

* applied pr comments

* applied pr comments

* applied PR review comments
2024-09-09 15:44:56 -04:00
Abdul Basit
93d09c78b4
[analyze] Add Analyzer for Postgres (#3192)
* implement analyzer interface for postgres

* added unit test for postgres analyzer

* refactored code in postgres analyzer

* generate permissions for postgres analyzer

* renamed variable

* [chore] corrected the variable name.

* appended hostname to distinguish the resources.
updated the test.

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-06 12:42:55 -07:00
Abdul Basit
a43d451c4d
[analyze] Add Analyzer for SourceGraph (#3173)
* implement analyzer interface for sourcegraph

* created permission for sourcegraph
test for sourcegraph.
added email in resource metadata.

* handling of missing keys in map

* linked sourcegraph detector to analyzer

* update the fullyqualidied name of resource to make it unique.
updated the test.

* add current user email in metadata

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-06 12:40:47 -07:00
Abdul Basit
4cab071032
[analyze] Add Analyzer for Asana (#3139)
* impelmented analyzer interface with data models for Asana

* add unit test for asana analyzer

* link asana detector with analyzer

* added permission for asana
linked detector with only positive cases.

* to make test cleaner moved want json in external file.
Moreover without sorting test will not be able to compare.

* use general functions to avoid code duplication.
optimize app permission making logic.

* [fix] assigned bindings to results.

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-06 12:37:45 -07:00
Abdul Basit
f235b8a442
[analyze] Add Analyzer for Slack (#3207)
* implement analyzer interface for slack

* slack analyzer adjusted for new changes in main, unit test added

* link detector with analyzer for slack

* added generated permissions for slack analyzer

* generate permission fix, keep dot in permissions intact

* removed scope from permission and put it metadata.

* [chore]
moved expected output of test in json file to neat the code.
added team id in fully qualified name of user resource.
check permissions before adding it in bindings.

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-06 12:33:06 -07:00
Abdul Basit
c449129d75
[analyze] Improve SquareUp analyzer and Implemented test (#3231)
* square analyzer fix  assign team members to unbounded resources - unit test for square analyzer

* refactoring

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-06 12:32:52 -07:00
Abdul Basit
5d7e6fc2fa
[analyze] Add Analyze interface for Mailchimp (#3225)
* implement analyzer interface for mailchimp

* link detector with analyzer for mailchimp

* fix analyzer type

* add mailchimp analyzer test

* [chore] appended string to make fulllyqualifiedname as unique.

* [chore]
moved expected output of test in json file to neat the code.
removed PII information in metadata.

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-05 16:33:47 -07:00
Abdul Basit
becc2c4010
[analyze] Add analyze interface for Bitbucket (#3224)
* impelmented analyzer interface with data models for Bitbucket

* Added bitbucket permissions in yaml
add ids to keep resources distinguishable.

* [chore]
moved expected output of test in json file to neat the code.
corrected the fully qualified name for repository resources.

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-05 16:04:35 -07:00
Abdul Basit
899f59fbb4
[analyze] Add Analyzer for Sendgrid (#3174)
* implement analyzer interface for sendgrid

* add unit test for sendgrid analyzer

* fixed sendgrid detector.
linked analyzer with sendgrid detector.
handling if key not found in map

* category as resource.
if subcategory is present then subcategory will become resource with parent category

* corrected test and remove hardcoded boolean for printing in sendgrid

* incorporate code refactoring and suggestion for FullyQualifiedName for subcategory by Miccah.

* generate permissions for sendgrid analyzer

* [NIT] rather than updating the global scopes variable, ProcessPermission will return new list of categories with Permission and eliminate those which are not in generated one.

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-04 15:50:32 -07:00
Abdul Basit
d6e1627f16
[analyze] Add Analyzer for Opsgenie (#3181)
* implement analyzer interface for opsgenie and add unit tests

* Add analyzer interface for opsgenie

linked detector  with analyzers
fixed test cases.

* generate permissions for opsgenie and change scope names to lowercase for consistency

* fixed unboundedresources slice issue.
username as fullqualifiedname

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-04 15:50:19 -07:00
Abdul Basit
5ce1578a6f
[analyze] Add analyzer for Postman (#3180)
* implement analyzer interface for postman and add unit test

* analyzer interface inplementation for postman

linked detector with analyzer for postman
add permission for postman

* [fix] linter in postman

* considered Miccah comments about fullyqualifiedName and code refactoring.

* moved want result to expected output file.

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-09-04 15:40:12 -07:00
Dustin Decker
db0108f731
Make worker multipliers configurable (#3267) 2024-09-04 11:36:26 -07:00
0x1
7eb5b5b12c
add rotation links (#3257) 2024-09-04 10:45:04 -04:00
Dustin Decker
6bbb683ead
Reduce high freq keywords (#3265) 2024-09-03 16:58:46 -07:00
Dustin Decker
8999eab89d
Add central feature flags (#3264)
* Add central feature flags

* use atomic

* tidy
2024-09-03 15:54:41 -07:00
Hon
f52d8e872d
Add huggingface tui config (#3060)
* add huggingface tui config

* update readme

* undo auto format
2024-09-03 12:54:39 -07:00
Shreyas Sriram
15faaba61c
Add Robinhood Crypto detector (#3254)
* Add Robinhood Crypto detector

* Address comment - use single keyword
2024-08-29 14:05:52 -07:00
ahrav
06bbd6fd49
Update buffer (#3255) 2024-08-29 13:40:26 -07:00
Cody Rose
dbc1464c63
Download files when reverifying (#3252)
The previous implementation of targeted file scanning pulled patches out of commit data, which didn't work for binary files (because GitHub doesn't return patches for them). This PR changes the system to always just download the requested file and scan it, which means we get binary file support.
2024-08-29 16:10:11 -04:00
Hon
247b56ad0b
update rotation guide link for teams (#3248) 2024-08-26 14:34:18 -07:00
Nash
69f5d9b76d
Th 899 postman panic issue (#3245)
* Fixed the checks for local exported data

* Fixed the check for local export files

* Fixed the check for local export files

* Fixed the check for local export files

* Merge branch 'main' into th-899-postman-panic-issue

* minor changes in the tests

* test update

* test
2024-08-26 14:46:05 -04:00
Cody Rose
3b0b2909ca
Strip leading +/- from github target diffs (#3244)
The GitHub source generates chunks for targeted scans differently than it does for "normal" scans. One difference was the presence of leading + and - characters, which can interfere with detection in some cases.
2024-08-23 15:21:58 -04:00
Cody Rose
8f299ff8cd
Skip filtration for targeted scans #3243
There is a scenario in which results filtration is known to cause problems, and this PR disables it in that scenario. (It should cause problems more generally, but lacking any concrete cases of that, I want to tread lightly.)
2024-08-23 10:59:07 -04:00
Cody Rose
f39a5254ff
Customize results cleaning (using smuggled interface) (#3235)
We have identified some cases in which the results "cleaning" logic (the logic that eliminates superfluous results) should not run. In order to allow this, we need to expose the cleaning logic to the engine. This PR does so by doing these things:

- Create a CustomResultsCleaner interface that can be implemented by detectors that want to use custom cleaning logic
- Implement this interface for the aws and awssessionkey detectors (and remove their previous invocation of their custom cleaning logic)
- Modify the engine to invoke this logic (conditionally)

This PR also removes the "custom" cleaning logic for the opsgenie, razorpay, and twilio detectors, because it was added erroneously.

This is an alternative implementation of #3233.
2024-08-21 09:42:20 -04:00
Dustin Decker
fe5624c709
Improve domain / url handling in detectors (#3221)
* Strip path and params and use new client

* update clients

* additional client updates

* revert client
2024-08-15 11:34:28 -07:00
Abdul Basit
e8a297f13b
Support for kebab case and dot notation in permission generation tool (#3222)
* support for fullstop and hypen in permissions.yaml

* updated the readme.
2024-08-15 10:07:42 -07:00
Miccah
3db9ed7c74
[chore] Fix lint errors (#3218)
* [chore] Fix lint errors under analyzer package

* Fix lint error in source manager test

* Use Sprint instead of Sprintf where appropriate
2024-08-14 13:49:24 -07:00
Miccah
c381e901cc
[analyze] Fix GitHub token expiration parsing (#3205)
* [analyze] Fix GitHub token expiration parsing

* Update test
2024-08-14 10:13:05 -07:00
Miccah
baf642e264
[analyze] Capture the hierarchy of GitHub permissions (#3127) 2024-08-14 10:12:38 -07:00
Miccah
97f8a4834b
Add metrics for command invocation (#3185) 2024-08-13 08:50:36 -07:00
0x1
8cf1ec2824
remove two letter keyword (#3210) 2024-08-13 09:09:36 -05:00
Cody Rose
9718ec6a51
Capture decoding time metric (#3209)
We're trying to track down some slowness.
2024-08-09 15:19:16 -04:00
ahrav
a966a47b63
[bug] - Correctly Handle Large Files in BufferedReadSeeker (#3203)
* handle large files correctly

* return if http get fails
2024-08-08 12:07:45 -07:00
Cody Rose
239f35921d
Log when a detector ignores the timeout (#3201)
If a detector ignores the configured timeout it is probably because of I/O blocking, which degrades the efficiency of the detector worker pool when it happens a lot. In the worst case, a detector that fully hangs will zombify its worker, causing really bad performance problems. When this happens, we don't really have a good way to notice other than seeing scan throughput drop suspiciously. This PR adds explicit logging when detection takes longer than it should so we have a better chance of catching this.

(This problem theoretically can spring up anywhere, in any worker, but the detector fleet is vast, uses network I/O, and is implemented by a much larger group of people, so this sort of problem is much more likely to slip into detector implementations than anywhere else in the codebase. We could generalize this mechanism, but I don't want to make that investment before seeing if this smaller change captures the information we need.)
2024-08-08 14:58:23 -04:00
Miccah
39f5f547e1
[analyze] Fix double-print in postgres analyzer (#3199)
* [analyze] Fix double-print in postgres analyzer

* Continue on error in github analyzer
2024-08-07 16:10:43 -07:00
Miccah
bf2afc9751
[analyze] Deduplicate finegrained GitHub permissions (#3196) 2024-08-07 11:22:29 -07:00
Dustin Decker
fc4829a387
Fixes for a few finegrained token issues (#3194)
* Fixes a few finegrained issues

* remove some code
2024-08-07 07:48:00 -07:00
Miccah
7730fc826b
[analyze] Bandaid solution for occasional slow startups (#3191)
* [analyze] Bandaid solution for occasional slow startups

* Speed up shutdown

* Add link to upstream issue

---------

Co-authored-by: Dustin Decker <dustin@trufflesec.com>
2024-08-06 22:24:58 -07:00
Hon
ab8c843fec
Analyzer capitalization (#3188)
* capitalization

* Lowercase analyze labels for the subcommand

* Canonicalize input and lowercase when matching command

* add warning

---------

Co-authored-by: Miccah Castorina <m.castorina93@gmail.com>
2024-08-06 17:00:40 -07:00
Miccah
a8777fcad9
[analyze] Add analyze option to main TUI and unhide subcommand (#3186)
This is currently a one-way operation. Once you select "analyze" you
cannot get back to the main menu.
2024-08-06 15:30:50 -07:00
Dustin Decker
29de521ed0
Improve finegrained token support (#3179) 2024-08-05 18:55:05 -07:00
Miccah
a373f6bd78
[chore] Use custom HTTP client in sendgrid analyzer (#3178) 2024-08-05 17:47:37 -07:00
Miccah
1df83f79ef
[analyze] Separate SID from token in twilio analyzer (#3177)
* [analyze] Separate SID from token in twilio analyzer

* Fix test

* Set sid in detector
2024-08-05 17:46:57 -07:00
Miccah
59fccbcf3f
Analyze TUI (#3172)
* Setup TUI entrypoint

* Setup key type selector and form pages

* Add basic confirmation component

* Add basic list selector for analyzer type

* Add form page

* Remove quit confirmation

* Add styles

* Add input text redaction

* Add log file input to form

* Fix some bugs and race conditions

* Remove unused code

* Fix filtering bug
2024-08-05 15:00:46 -07:00
Cody Rose
f26b502c2e
Auth GitHub in Init (#3131)
The GitHub source currently applies its authentication configuration as the first step of enumeration. This is incompatible with both targeted scans and scan job reports, and also means that authentication logic has to be duplicated into the validation flow. This PR moves it into Init so that it's available to targeted scans and, eventually, unit-specific scans. This also allows us to remove the copy of the old logic that was in Validate.

As part of the work I've also cleaned up the integration test suite. (Several of them were apparently disabled back when they ran on every push, but now that we're not doing that, we can re-enable them.)
2024-08-05 15:13:29 -04:00
Dustin Decker
c2e5506b95
Change log verbosity for detection errors (#3171) 2024-08-04 20:47:41 -07:00
Richard Gomez
f335d486ef
Update Zulip detector (#2897)
* fix(zulip): prevent false positives

* update extra data

---------

Co-authored-by: Dustin Decker <dustin@trufflesec.com>
2024-08-04 09:30:15 -07:00
Dustin Decker
88359addc5
update pattern (#3167) 2024-08-04 09:12:09 -07:00
Miccah
37a130fb58
[analyze] Use permission enum values in openai analyzer (#3165) 2024-08-02 16:20:45 -07:00
ahrav
0a3451a1ba
[bug] - Create a new context with timeout per request (#3163)
* Create a new context with timeout per request

* match timeout

* use context timeout

* reduce timeout
2024-08-02 14:46:37 -07:00
Miccah
f939572a43
[analyze] Fix off-by-one error in generated data structures (#3162)
* [analyze] Fix off-by-one error in generated data structures

* Generate data structures

* Fix finegrained checks
2024-08-02 14:22:22 -07:00
ahrav
c549b5bd15
[bug] - add context timeout to ssh verification (#3161)
* add context timeout to ssh verification

* fix test
2024-08-02 12:39:50 -07:00
ahrav
29613220b0
[chore] - log detector type on error (#3159)
* log detector type on error

* update error message

* update log

* update message
2024-08-02 10:54:59 -07:00
ahrav
ddb7211ded
[chore] - set custom transport for the Docker client (#3156)
* set custom transport for docker

* fix lint
2024-08-02 08:51:59 -07:00
Abdul Basit
04a13385a8
Add Analyzers interface for HuggingFace (#3140)
* implemented analyzer interface with data models for HuggingFace

* correct test for huggingface due to new addition of key in detection result.

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-08-02 08:20:11 -07:00
joeleonjr
f927076483
quick patch for cfor enumeration (#3155)
Co-authored-by: Joe Leon <joe.leon@trufflesec.com>
2024-08-02 11:12:43 -04:00
Abdul Basit
c1645e8c27
Add Analyzers interface for Square (#3141)
* implement analyzer interface for square

* linked detector with analyzer for square
fix test for square.

* code refactoring

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-08-02 08:00:25 -07:00
Dustin Decker
05e4635824
Add progress bar to CFOR (#3151)
* Add progress bar to CFOR

* unused vars

* explicitly ignore progress errors

* removed print statements

* use stderr

---------

Co-authored-by: joeleonjr <20135619+joeleonjr@users.noreply.github.com>
Co-authored-by: Joe Leon <joe.leon@trufflesec.com>
2024-08-02 07:43:59 -07:00
ahrav
fba1a8b410
[perf] - Leverage pgzip for Parallel decompression (#3149) 2024-08-02 04:11:10 -07:00
joeleonjr
7d606e2480
CFOR Commit Scanner (#3145)
* alpha feature for scanning hidden commits on github

* improvements re: git operations

* lint updates

* updating with exec block due to no gh token

* reworked logic into new source

* fixed collisions threshold flag input

* fixed IOutil issues

* removed additions from GH config

---------

Co-authored-by: Joe Leon <joe.leon@trufflesec.com>
2024-08-01 23:04:20 -04:00
Miccah
38e844f968
[chore] Only set default detectors if none are provided (#3147) 2024-08-01 17:15:06 -07:00
Dustin Decker
605d037e45
add twilio analyze relationships (#3148)
* add twilio analyze relationships

* unused struct
2024-08-01 17:04:44 -07:00
Miccah
f776b481d1
[analyze] Combine access level into permission value (#3144) 2024-08-01 11:09:59 -07:00
Abdul Basit
843120427d
Add Analyze interface to Stripe (#3132)
* implement analyzer interface for stripe

* consider cateogry as unbound resource if there is no permission with it.

* check for key existence in map.
pass on analysis info from Stripe detector.
test change to remove analysis info.

* remove Valid boolean from metadata of analyzer result

---------

Co-authored-by: Abdul Basit <abasit@folio3.com>
2024-08-01 08:23:06 -07:00
ahrav
048ec26c92
move concurrency (#3135) 2024-07-31 18:58:18 -07:00
ahrav
fd257350dd
[chore] - address linter (#3133)
* addres linter

* fix
2024-07-31 17:30:51 -07:00
Hon
555e1ceeee
Export maps from permission generation (#3137)
* Adjust permission generation to make maps exportable

* fix bug and add twilio
2024-07-31 16:49:56 -07:00
Dustin Decker
25b01019b3
Add permissions lookup tables (#3125)
* OpenAI LUT

* github LUT

* cleanup

* add test

* update

* update

* update openai

* update

* Add Analyze interface to Twilio (#3128)

* Add Analyze interface to Twilio

* add readme
2024-07-31 13:01:29 -07:00
Abdul Basit
6fccac7f3d
Separate out printing statements with anlayzer logic for SourceGraph (#3119)
* Separated printing and analyzes functionality for sourcegraph

* remove second call to fetch userinfo in sourcegraph.
2024-07-31 10:08:42 -07:00
Abdul Basit
24b7029d4d
Separate out printing statements with anlayzer logic for Stripe (#3120)
* Separated printing and analyzes functionality for stripe

* removed logging enabled check
2024-07-31 07:07:10 -07:00
Abdul Basit
a2c7219d65
Separate out printing statements with anlayzer logic for Slack (#3121)
* Separated printing and analyzes functionality for slack

* removed logging enabled check
2024-07-31 07:06:46 -07:00
Cody Rose
3ab975edb3
Update GitHub integration tests (#3124)
#1816 and #2995 both updated the GitHub source without updating its integration tests. This PR updates those tests, bringing them back into success.
2024-07-31 09:28:10 -04:00
Dustin Decker
a3d3565248
Add new canary ID (#3117) 2024-07-30 20:44:58 -07:00
Abdul Basit
67c01aee6e
Separated printing and analyzes functionality for twilio (#3118) 2024-07-30 20:44:44 -07:00
Abdul Basit
02fb3879eb
Separated printing and analyzes functionality for square (#3122) 2024-07-30 20:44:07 -07:00
Abdul Basit
acd529d9dc
Separated printing and analyzes functionality for shopify (#3123) 2024-07-30 20:43:46 -07:00
Miccah
20de56d441
Analyzer partial implementations (#3114)
* Add POC analyze sub-command

* Address lint errors

* added http logging to most analyzers

* Use custom RoundTripper with default http.Client

* [chore] Embed scopes at compile time

* [chore] Move subcommand check up to prevent printing metrics

* Create framework of interfaces, structs, and protos

* Implement Analyzer for airbrake

* Add FullAccess permission constant

* Implement Analyzer for asana

* Implement Analyzer for bitbucket

* Implement Analyzer for github

* Implement Analyzer for gitlab

* Implemente Analyzer for huggingface

* Implement Analyzer for mailchimp

* implement analyzer for mailgun

* update cli cmd

* Implement analyzer for openai

* fix timing issue on scopes

* print permissions only if restricted key

* Implement Analyzer for mysql

* enable loggin check

* fixed the formatting issue to wrap sub-errors

* implemented analyzer for opsgenie

* implemented analyzer for postgres

* use format string

* implemented analyzer for sendgrid

* simplify returning the error

* implemented analyzer for postman

* added handling of workspace error

* Update protos to match OSS

* Generate protos

* Update data structures to match OSS

* Update airbrake implementation

* Remove asana implementation

* Remove mailchimp implementation

* Update openai implementation to match OSS

* Remove gitlab implementation

* Remove huggingface implementation

* Remove bitbucket implementation

* Fix permission in airbrake

* Remove github implementation

* Remove mailgun implementation

* Cleanup compiler errors

* Implement Analyzer interface for github

* Add parents to github resources

* Add fine_grained to github metadata

* Update with changes from main

* Remove unused function stubs

---------

Co-authored-by: Joe Leon <joe.leon@trufflesec.com>
Co-authored-by: Hon <8292703+hxnyk@users.noreply.github.com>
Co-authored-by: Abdul Basit <abasit@folio3.com>
Co-authored-by: Abdul Basit <basit.mussani@gmail.com>
2024-07-30 09:13:48 -07:00
Harmon Herring
f664472da1
Include default detectors when using a config that contains detectors (#3115)
* include default detectors when config file is used

* fix test
2024-07-29 14:36:40 -07:00
Cody Rose
ed8bc501e5
Use non-canary credentials for AWS tests (#3109)
The AWS detector verifies credentials in a weird hacky way to work around some non-obvious STS behavior. This workaround does not work for canary tokens, so I updated the test secrets to use non-canary tokens. This PR updates the tests to match the secrets file changes.
2024-07-29 10:11:27 -04:00
ahrav
55fe05d0b4
fix dep versions (#3106) 2024-07-26 17:44:23 -07:00
Miccah
14e7a82fbf
[analyze] Add description and user to openai metadata (#3111)
Also rename the type from "org" to "organization" to match github.
2024-07-26 16:24:50 -07:00
Dustin Decker
c048487739
Support openai project and fine grained tokens (#3112) 2024-07-26 15:31:17 -07:00
Miccah
9d089c2188
[analyze] Implement Analyzer interface for github (#3110)
* [analyze] Implement Analyzer interface for github

* Make github repo and user enumeration configurable

* Add AnalysisInfo to github detector

* Use AnalyzeAndPrintPermissions from the CLI
2024-07-26 14:47:03 -07:00
Miccah
63568b0881
[chore] Move openai log message to proper function (#3105) 2024-07-26 10:39:13 -07:00
Miccah
8a8ef85265
Implement Analyzer interface for openai (#3101)
* Implement Analyzer interface for openai

* Use organization ID for the FQDN

* Update CLI to print openai permissions
2024-07-25 14:20:01 -07:00
Miccah
551dc6578c
[chore] Fix Versioner interface for twitter (#3104) 2024-07-25 14:17:02 -07:00
Miccah
2424683923
Analyze (#3099)
* Add POC analyze sub-command

* Address lint errors

* [chore] Embed scopes at compile time

* [chore] Move subcommand check up to prevent printing metrics

* added http logging to most analyzers

* Use custom RoundTripper with default http.Client

* Create framework of interfaces, structs, and protos

* Merge main

* Add AnalysisInfo to detectors.Result

* Hide analyze subcommand

* Update gen_proto.sh

* Update protos

* Make protos

* Update analyzer data types

* Rename argument to credentialInfo

---------

Co-authored-by: Joe Leon <joe.leon@trufflesec.com>
2024-07-25 12:06:05 -07:00
shangchenglumetro
c4aab3fb51
chore: fix some comments (#3098) 2024-07-25 10:37:13 -07:00
ahrav
ebfbd21707
[bug]- Invalid Seek for Non-Seekable Readers (#3095)
* inital work

* fix and add tests

* uncomment

* fix seek end

* use buffer pool

* revert timeout

* make linter happy

* More linting :()
2024-07-24 19:08:56 -07:00
Abdul Basit
7c0c2e9ff3
fixed crash issue if data array is empty (#3091) 2024-07-23 09:36:27 -07:00
trufflesteeeve
c01428d107
Remove onwater detector (#3088) 2024-07-22 17:00:32 -04:00
Abdul Basit
5b64e1e5a1
implemented a netsuite detector (#3068)
* implemented a netsuite detector

* implemented the netsuite detector with modified test.

* clean up go.sum by running `go mod tidy`

* implemented a netsuite detector

* implemented the netsuite detector with modified test.

* clean up go.sum by running `go mod tidy`

* Incorporated suggestion by Ahrav
	- optimized nonce generation logic.
	- use string builder as compare to concatenation.

* fix go.sum

* fix import

* fix

---------

Co-authored-by: Ahrav Dutta <ahrav.dutta@trufflesec.com>
2024-07-22 12:37:18 -07:00
ahrav
8f172b23ac
[chore] - Reduce VerificationOverlapWorkers (#3082)
* reduce worker count

* reduce detector worker count
2024-07-19 18:09:57 -07:00
ahrav
7a36e89c61
add verify check (#3079) 2024-07-19 18:09:26 -07:00
Abdul Basit
c20ca0d6a1
Added Twitter v2 Detector (#3016)
* implemented a newer version of twitter included a test.
moved old twitter detector to as V1.

* added version information in twitter test
2024-07-18 12:15:22 -04:00
ahrav
42b3a9d999
[perf] - Optimize MIME Type Detection to Reduce Allocations (#3048)
* Streaming file handling.

* cleanup

* update tests

* lint

* defer close on input io.ReadCloser's

* remove redundant mime type detection

* Reduce allocations

* fix test

* update comment

* fix seek bug

* address comment

* undo
2024-07-17 14:04:29 -07:00
ahrav
f865482025
[feat] - Streamlined File Handling with BufferedReaderSeeker (#3041)
* Streaming file handling.

* cleanup

* update tests

* lint

* defer close on input io.ReadCloser's

* fix seek bug

* fix hanging

* clarify errors

* update

* address comments

* revert

* update

* address

* add check to prevent seek without buffering

* revet

* revert

* update comment to make buffer usage more clear
2024-07-17 13:52:18 -07:00
Ankush Goel
e2e3b870b6
Atlassian Token Detector (#3065)
* atlassian token

* Update atlassian.go

Fixed version

* fixed regex
2024-07-17 12:44:39 -07:00
āh̳̕mͭͭͨͩ̐e̘ͬ́͋ͬ̊̓͂d
2a626c4dab
update package name (#3020) 2024-07-09 16:51:46 -05:00
Cody Rose
296379d5a0
Log more GitLab stuff (#3040)
Our GitLab happy path logging could use some love.

go.sum also needed a little love, for some reason.
2024-07-09 10:53:40 -04:00
Cody Rose
1a73442088
Order GitLab repos by ID (#3047) 2024-07-09 10:39:47 -04:00
ahrav
7d349ac7f3
remove dead code (#3044) 2024-07-07 08:59:40 -07:00
dylanTruffle
47535830c4
Elevenlabs detector (#3023)
* adding v1 eleven labs

* updating elevenlabs to support old and new version

* fixing status codes

* lint fixes

* adding test for v2

* adding test for v1

* return err

---------

Co-authored-by: Dylan Ayrey <dylan@Dylans-MacBook-Pro.local>
Co-authored-by: āh̳̕mͭͭͨͩ̐e̘ͬ́͋ͬ̊̓͂d <13666360+0x1@users.noreply.github.com>
2024-07-03 10:53:20 -04:00
Richard Gomez
b883645856
fix(detectors): avoid race (#3028) 2024-07-02 10:36:20 -05:00
Patrick Kaeding
4e04687712
update LaunchDarkly detector to use the caller-identity API instead of the tokens API, and instantiating an SDK (#3018) 2024-07-01 12:20:37 -07:00
joeleonjr
01a1499600
New Source: HuggingFace (#3000)
* initial spike on hf

* added in user and org enum

* adding huggingface source

* updated with lint suggestions

* updated readme

* addressing resources that require org approval to access

* removing unneeded code

* updating with new error msg for 403

* deleted unused code + added resource check in main
2024-06-27 13:22:06 -04:00
Shreyas Sriram
e9206c66bb
Add endorlabs detector (#3015)
* Add endorlabs detector

* Remove unrelated changes

* Addrss comments

* remove prefix regex

---------

Co-authored-by: Ahrav Dutta <ahrav.dutta@trufflesec.com>
2024-06-26 21:28:19 -07:00
orionooooo
b9dd330365
added "example" (#3010) 2024-06-25 14:01:22 -05:00
Abdul Basit
dddeca5224
Adding Larksuite Detectors + Tests (#3008)
* implemented larksuite detectores for tokens and api keys.
test implemented for larksuite token based detectors.

* implemented test for larksuiteapikey detector

* load credentials from GCP secret manager for larksuite api keys
2024-06-24 11:05:56 -05:00
Richard Gomez
3c20b000e1
fix(git): set GIT_DIR based on ScanOptions.Bare (#3004) 2024-06-24 07:37:45 -07:00
Cody Rose
de19a39f2c
Return targeted scan errors (#2995)
Targeted scans should return their errors so that consumers can process them. By creating a type that combines an error with a targeted secret ID, we can return these errors without having to modify the Source interface.
2024-06-21 13:50:56 -04:00
Zachary Rice
d5b9157d2b
clone more refs (#2988) 2024-06-20 09:40:03 -05:00
ahrav
347e8a6683
[feat] - Add Option to Retain False Positives During Detection (#2967)
* provide a mechanism to retain false positive findings

* update

* reorganzie

* revert comment

* update test

* typo

* fix test

* fix test

* update

* update
2024-06-18 09:40:21 -07:00
ahrav
a0618348fe
[fix] - implement MaxSecretSizeProvider for auth0managementapitoken detector (#2953)
* updates

* remove ey as a keyword
2024-06-14 14:21:17 -07:00
Cody Rose
15719c2c4f
Fix integration tests (#2970)
The recent engine changes (#2887) broke some integration tests. This PR fixes them. I also fixed an unrelated linter issue.
2024-06-14 14:30:18 -04:00
Richard Gomez
2964b3b2d2
feat(detectors): log falsepositive reason (#2969) 2024-06-14 08:26:05 -07:00
Richard Gomez
235b27964b
fix(handlers): workaround for max archive depth (#2965) 2024-06-14 08:18:05 -07:00
ahrav
523a915143
add metrics to the pipeline (#2968) 2024-06-14 07:57:52 -07:00
āh̳̕mͭͭͨͩ̐e̘ͬ́͋ͬ̊̓͂d
7bf3a9b5e2
adding eraser ai detector (#2961)
* adding eraser ai detector

* add eraser to defaults
2024-06-14 10:10:37 -04:00
ahrav
cb072603dc
Modularize scanning engine (#2887)
* POC: Modularize scanning engine.

* fix typo

* update interface name

* fix tests

* update test

* fix moar tests

* fix bug

* fixes.

* fix merge

* add detector verification overrides

* handle --no-verification flag

* support fp

* add test

* update name

* filter

* update test

* explicit use of detector

* updates
2024-06-13 13:47:09 -07:00
Richard Gomez
4addd81e29
test: fix compile errors (#2964) 2024-06-13 08:22:25 -07:00
Abdul Basit
cb4d332cbf
adding twitter + Consumer key detector (#2963)
* updated the twitter regex.

* updated regex for bearer token.

* clean up the code for existing twitter detector
added and Implemented new detector for twitter consumer key & secrets with test.
proto generated.

* string updated.

* written test for twitter consumer key detector

* reverted the file to avoid conflicts

* corrected the regex library in twitter detector
2024-06-13 09:32:24 -04:00
ahrav
bf77251543
[feat] - Update span calculation logic to use offset magnitude (#2957)
* Add a default start offset

* update

* use keywordIdx
2024-06-11 09:12:31 -07:00
ahrav
68bea576db
[fix] - Refactor Filtering Logic to Fix Known False Positive Handling in Overlapping Cases (#2946)
* Filter results for verification overlap results

* add test
2024-06-11 07:25:12 -07:00
ahrav
11b80dbdf9
[chore] - Update discordwebhook detector keyword (#2954)
* update keyword

* use stdlib var
2024-06-11 07:24:34 -07:00
Richard Gomez
6b52d5ad40
fix(maxmind): prevent npd panic (#2948) 2024-06-11 08:27:42 -04:00
Richard Gomez
ca67a8aa83
refactor(filesystem): change symlink err handling (#2941) 2024-06-10 13:05:42 -07:00
ahrav
2f7a0d0699
[bug] - Ensure BufferedFileWriter Flushes Buffer Contents to File Correctly (#2943)
* flush butter before writing to file

* revert

* remove redundant Reset

* add test case
2024-06-10 07:27:01 -07:00
Richard Gomez
3be4661f34
feat(extensions): ignore dia diagrams (#2939) 2024-06-07 07:37:33 -07:00