Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 133e937cfd | |||
| 45ebafff61 | |||
| 79cae3b82b |
@@ -86,7 +86,7 @@ trufflehog s3 --bucket=<bucket name> --only-verified
|
||||
+ All I see is `🐷🔑🐷 TruffleHog. Unearth your secrets. 🐷🔑🐷` and the program exits, what gives?
|
||||
+ That means no secrets were detected
|
||||
+ Why is the scan is taking a long time when I scan a GitHub org
|
||||
+ Unathenticated GitHub scans have rate limits. To improve your rate limits, include the `--token` flag with a personal access token
|
||||
+ Unauthenticated GitHub scans have rate limits. To improve your rate limits, include the `--token` flag with a personal access token
|
||||
+ It says a private key was verified, what does that mean?
|
||||
+ Check out our Driftwood blog post to learn how to do this, in short we've confirmed the key can be used live for SSH or SSL [Blog post](https://trufflesecurity.com/blog/driftwood-know-if-private-keys-are-sensitive/)
|
||||
|
||||
@@ -130,7 +130,7 @@ docker run -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo ht
|
||||
#### **Apple M1 users**
|
||||
|
||||
The `linux/arm64` image is better to run on the M1 than the amd64 image.
|
||||
Even better is running the native darwin binary avilable, but there is not container image for that.
|
||||
Even better is running the native darwin binary available, but there is no container image for that.
|
||||
|
||||
```bash
|
||||
docker run --platform linux/arm64 -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keys
|
||||
|
||||
+34
-4
@@ -181,7 +181,7 @@ func (e *Engine) detectorWorker(ctx context.Context) {
|
||||
for originalChunk := range e.chunks {
|
||||
for chunk := range sources.Chunker(originalChunk) {
|
||||
atomic.AddUint64(&e.bytesScanned, uint64(len(chunk.Data)))
|
||||
fragStart, mdLine := fragmentFirstLine(chunk)
|
||||
fragStart, _ := fragmentFirstLine(chunk)
|
||||
for _, decoder := range e.decoders {
|
||||
var decoderType detectorspb.DecoderType
|
||||
switch decoder.(type) {
|
||||
@@ -229,13 +229,15 @@ func (e *Engine) detectorWorker(ctx context.Context) {
|
||||
if e.filterUnverified {
|
||||
results = detectors.CleanResults(results)
|
||||
}
|
||||
newChunk := chunk
|
||||
for _, result := range results {
|
||||
if isGitSource(chunk.SourceType) {
|
||||
offset := FragmentLineOffset(chunk, &result)
|
||||
*mdLine = fragStart + offset
|
||||
newChunk = deepCopyGitChunk(chunk)
|
||||
offset := FragmentLineOffset(newChunk, &result)
|
||||
newChunk.SourceMetadata.Data.(*source_metadatapb.MetaData_Git).Git.Line = fragStart + offset
|
||||
}
|
||||
result.DecoderType = decoderType
|
||||
e.results <- detectors.CopyMetadata(chunk, result)
|
||||
e.results <- detectors.CopyMetadata(newChunk, result)
|
||||
|
||||
}
|
||||
if len(results) > 0 {
|
||||
@@ -314,3 +316,31 @@ func fragmentFirstLine(chunk *sources.Chunk) (int64, *int64) {
|
||||
}
|
||||
return *fragmentStart, fragmentStart
|
||||
}
|
||||
|
||||
// deepCopyGitChunk will copy a Git chunk down to the source metadata. Nothing
|
||||
// will be shared between the new and original chunks
|
||||
func deepCopyGitChunk(chunk *sources.Chunk) *sources.Chunk {
|
||||
originalMetaData := chunk.SourceMetadata.Data.(*source_metadatapb.MetaData_Git)
|
||||
newMetaData := source_metadatapb.MetaData_Git{
|
||||
Git: &source_metadatapb.Git{
|
||||
Commit: originalMetaData.Git.Commit,
|
||||
File: originalMetaData.Git.File,
|
||||
Email: originalMetaData.Git.Email,
|
||||
Repository: originalMetaData.Git.Repository,
|
||||
Timestamp: originalMetaData.Git.Timestamp,
|
||||
Line: originalMetaData.Git.Line,
|
||||
},
|
||||
}
|
||||
newChunk := &sources.Chunk{
|
||||
SourceName: chunk.SourceName,
|
||||
SourceID: chunk.SourceID,
|
||||
SourceType: chunk.SourceType,
|
||||
SourceMetadata: &source_metadatapb.MetaData{
|
||||
Data: &newMetaData,
|
||||
},
|
||||
Data: make([]byte, len(chunk.Data)),
|
||||
Verify: chunk.Verify,
|
||||
}
|
||||
copy(newChunk.Data, chunk.Data)
|
||||
return newChunk
|
||||
}
|
||||
|
||||
@@ -408,7 +408,9 @@ func (s *Git) gitChunk(ctx context.Context, diff gitparse.Diff, fileName, email,
|
||||
newChunkBuffer := bytes.Buffer{}
|
||||
lastOffset := 0
|
||||
for offset := 0; originalChunk.Scan(); offset++ {
|
||||
line := originalChunk.Bytes()
|
||||
line := make([]byte, len(originalChunk.Bytes())+1)
|
||||
copy(line, originalChunk.Bytes())
|
||||
line[len(line)-1] = byte('\n')
|
||||
if len(line) > sources.ChunkSize || len(line)+newChunkBuffer.Len() > sources.ChunkSize {
|
||||
// Add oversize chunk info
|
||||
if newChunkBuffer.Len() > 0 {
|
||||
|
||||
Reference in New Issue
Block a user