Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass chunk information in .FromData context #59

Open
rgmz opened this issue Jan 1, 2025 · 0 comments
Open

Pass chunk information in .FromData context #59

rgmz opened this issue Jan 1, 2025 · 0 comments
Labels
area/engine kind/enhancement New feature or request

Comments

@rgmz
Copy link
Owner

rgmz commented Jan 1, 2025

Continuation of trufflesecurity#2228

Something like this, except this only works for GitHub scans.

diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go
index 0e796e56b..5e20a9329 100644
--- a/pkg/engine/engine.go
+++ b/pkg/engine/engine.go
@@ -1113,6 +1113,10 @@ func (e *Engine) detectChunk(ctx context.Context, data detectableChunk, scanEnti
                detectBytesPerMatch.Observe(float64(len(matchBytes)))

                ctx, cancel := context.WithTimeout(ctx, detectionTimeout)
+               metadata := data.chunk.SourceMetadata.GetGithub()
+               ctx = context.WithValues(ctx,
+                       "link", metadata.GetLink(),
+               )
                t := time.AfterFunc(detectionTimeout+1*time.Second, func() {
                        ctx.Logger().Error(nil, "a detector ignored the context timeout", "metadata", data.chunk.SourceMetadata.GetData())
                })
@rgmz rgmz added kind/enhancement New feature or request area/engine labels Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/engine kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant