feat(07-01): Importer interface and TruffleHog v3 JSON adapter
- pkg/importer/importer.go: shared Importer interface (Name, Import) - pkg/importer/trufflehog.go: TruffleHogImporter with v3 JSON decoding, detector-name normalization (OpenAI/GithubV2/AWS -> canonical ids), SourceMetadata path+line extraction for Git/Filesystem/Github - pkg/importer/testdata/trufflehog-sample.json: 3-record fixture - pkg/importer/trufflehog_test.go: Name, Import, NormalizeName, EmptyArray, InvalidJSON tests -- all passing
This commit is contained in:
57
pkg/importer/testdata/trufflehog-sample.json
vendored
Normal file
57
pkg/importer/testdata/trufflehog-sample.json
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
[
|
||||
{
|
||||
"SourceID": 1,
|
||||
"SourceName": "git-scan",
|
||||
"SourceMetadata": {
|
||||
"Data": {
|
||||
"Git": {
|
||||
"commit": "deadbeef1234",
|
||||
"file": "src/config.py",
|
||||
"repository": "https://github.com/example/repo",
|
||||
"line": 42
|
||||
}
|
||||
}
|
||||
},
|
||||
"DetectorName": "OpenAI",
|
||||
"DetectorType": 17,
|
||||
"Verified": true,
|
||||
"Raw": "sk-proj-abcdef1234567890abcdef",
|
||||
"Redacted": "sk-proj-abcd...cdef",
|
||||
"ExtraData": {}
|
||||
},
|
||||
{
|
||||
"SourceID": 2,
|
||||
"SourceName": "fs-scan",
|
||||
"SourceMetadata": {
|
||||
"Data": {
|
||||
"Filesystem": {
|
||||
"file": "/tmp/leaked.env"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DetectorName": "AnthropicV2",
|
||||
"DetectorType": 92,
|
||||
"Verified": false,
|
||||
"Raw": "sk-ant-api03-xxxxxxxxxxxxxxxx",
|
||||
"Redacted": "sk-ant-api03-xxxx",
|
||||
"ExtraData": {}
|
||||
},
|
||||
{
|
||||
"SourceID": 3,
|
||||
"SourceName": "github-scan",
|
||||
"SourceMetadata": {
|
||||
"Data": {
|
||||
"Github": {
|
||||
"link": "https://github.com/foo/bar/blob/main/a.yml",
|
||||
"repository": "https://github.com/foo/bar"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DetectorName": "AWS",
|
||||
"DetectorType": 2,
|
||||
"Verified": true,
|
||||
"Raw": "AKIAIOSFODNN7EXAMPLE",
|
||||
"Redacted": "AKIA****EXAMPLE",
|
||||
"ExtraData": {}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user