Skip to content

Commit e02e2f6

Browse files
committed
Redesign and reimplement the slice out of bounds check using SSA code representation
Signed-off-by: Cosmin Cojocar <[email protected]>
1 parent e1278f9 commit e02e2f6

File tree

8 files changed

+461
-510
lines changed

8 files changed

+461
-510
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# gosec - Golang Security Checker
33

4-
Inspects source code for security problems by scanning the Go AST.
4+
Inspects source code for security problems by scanning the Go AST and SSA code representation.
55

66
<img src="https://securego.io/img/gosec.png" width="320">
77

analyzer.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,7 @@ func (gosec *Analyzer) Process(buildTags []string, packagePaths ...string) error
231231
return fmt.Errorf("parsing errors in pkg %q: %w", pkg.Name, err)
232232
}
233233
gosec.CheckRules(pkg)
234-
if on, err := gosec.config.IsGlobalEnabled(SSA); err == nil && on {
235-
gosec.CheckAnalyzers(pkg)
236-
}
234+
gosec.CheckAnalyzers(pkg)
237235
}
238236
}
239237
}
@@ -377,8 +375,10 @@ func (gosec *Analyzer) CheckAnalyzers(pkg *packages.Package) {
377375
continue
378376
}
379377
if result != nil {
380-
if aissue, ok := result.(*issue.Issue); ok {
381-
gosec.updateIssues(aissue, false, []issue.SuppressionInfo{})
378+
if passIssues, ok := result.([]*issue.Issue); ok {
379+
for _, iss := range passIssues {
380+
gosec.updateIssues(iss, false, []issue.SuppressionInfo{})
381+
}
382382
}
383383
}
384384
}

0 commit comments

Comments
 (0)