trufflehog/pkg/analyzer
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
..
analyzers [analyze] Add Analyzer for SourceGraph (#3173) 2024-09-06 12:40:47 -07:00
config [analyze] Implement Analyzer interface for github (#3110) 2024-07-26 14:47:03 -07:00
generate_permissions Support for kebab case and dot notation in permission generation tool (#3222) 2024-08-15 10:07:42 -07:00
pb/analyzerpb Analyze (#3099) 2024-07-25 12:06:05 -07:00
proto Analyze (#3099) 2024-07-25 12:06:05 -07:00
tui [analyze] Bandaid solution for occasional slow startups (#3191) 2024-08-06 22:24:58 -07:00
cli.go Analyzer capitalization (#3188) 2024-08-06 17:00:40 -07:00
README.md Support for kebab case and dot notation in permission generation tool (#3222) 2024-08-15 10:07:42 -07:00

Implementing Analyzers

Defining the Permissions

Permissions can be defined in:

  • lower snake case as permission_name:access_level
  • kebab case as permission-name:read
  • dot notation as permission.name:read

The Permissions are initially defined as a yaml file.

At the top of the analyzer implementation you specify the go generate command.

You can install the generator with go install github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/generate_permissions.

Then you can run go generate ./... to generate the Permission types for the analyzer.

The generated Permission types are to be used in the AnalyzerResult struct when defining the Permissions and in your code.