Skip to content

Find, verify, and analyze leaked credentials

add secretID to chunk (#2242)

ahrav64c736536417
diff --git a/pkg/sources/github/github.go b/pkg/sources/github/github.go
index a3a354d6d..27777dd08 100644
--- a/pkg/sources/github/github.go
+++ b/pkg/sources/github/github.go
@@ -1516,7 +1516,7 @@ func (s *Source) scanTargets(ctx context.Context, targets []sources.ChunkingTarg
func (s *Source) scanTarget(ctx context.Context, target sources.ChunkingTarget, chunksChan chan *sources.Chunk) error {
metaType, ok := target.QueryCriteria.GetData().(*source_metadatapb.MetaData_Github)
if !ok {
- return fmt.Errorf("unable to cast metadata type for targetted scan")
+ return fmt.Errorf("unable to cast metadata type for targeted scan")
}
meta := metaType.Github
@@ -1547,6 +1547,7 @@ func (s *Source) scanTarget(ctx context.Context, target sources.ChunkingTarget,
SourceName: s.name,
SourceID: s.SourceID(),
JobID: s.JobID(),
+ SecretID: target.SecretID,
Data: []byte(res),
SourceMetadata: &source_metadatapb.MetaData{
Data: &source_metadatapb.MetaData_Github{Github: meta},
diff --git a/pkg/sources/sources.go b/pkg/sources/sources.go
index 8ed48129b..c6ab88f7e 100644
--- a/pkg/sources/sources.go
+++ b/pkg/sources/sources.go
@@ -24,6 +24,9 @@ type Chunk struct {
SourceID SourceID
// JobID is the ID of the job that the Chunk originated from.
JobID JobID
+ // SecretID is the ID of the secret, if it exists.
+ // Only secrets that are being reverified will have a SecretID.
+ SecretID int64
// SourceType is the type of Source that produced the chunk.
SourceType sourcespb.SourceType
// SourceMetadata holds the context of where the Chunk was found.
@@ -43,6 +46,8 @@ type Chunk struct {
type ChunkingTarget struct {
// QueryCriteria represents specific parameters or conditions to target the chunking process.
QueryCriteria *source_metadatapb.MetaData
+ // SecretID is the ID of the secret.
+ SecretID int64
}
// Source defines the interface required to implement a source chunker.