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

Using argot:ignore annotations in the taint analysis. #101

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

victornicolet
Copy link
Contributor

Annotating a line with //argot:ignore supresses findings on that line for the taint analysis.
See analysis/taint/testdata/annotations/main.go for an example.

@victornicolet victornicolet changed the title Using argot:ignore annotations in the taint analysis. Draft: Using argot:ignore annotations in the taint analysis. Oct 24, 2024
@victornicolet victornicolet marked this pull request as draft October 24, 2024 14:04
@victornicolet victornicolet changed the title Draft: Using argot:ignore annotations in the taint analysis. Using argot:ignore annotations in the taint analysis. Oct 25, 2024
@victornicolet victornicolet marked this pull request as ready for review October 25, 2024 13:15
samarth-aws
samarth-aws previously approved these changes Oct 25, 2024
@@ -120,10 +121,20 @@ func NewAnalyzerState(p *ssa.Program, pkgs []*packages.Package, l *config.LogGro
steps []func(*AnalyzerState)) (*AnalyzerState, error) {
var allContracts []Contract

// Load annotations
// Load annotations byt scanning all package's syntax
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typos

for _, pkg := range pkgs {
analysisutil.VisitPackages(pkg, func(p *packages.Package) bool {
// Don't scan stdlib for annotations!
if summaries.IsStdPackageName(p.Name) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also avoid scanning dependencies? Not sure how to identify them though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave a TODO and make an issue. Based on demand we can figure out how to implement it, but early on it's unlikely the dependencies will have annotations, and scanning is relatively fast compared to all the other analysis steps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue #102 for tracking this.

@victornicolet victornicolet merged commit 03f495c into mainline Oct 28, 2024
3 checks passed
@victornicolet victornicolet deleted the argot-ignore-annotation branch October 28, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants