-
Notifications
You must be signed in to change notification settings - Fork 561
🌱 add support for hadolint SAST #4688
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4688 +/- ##
==========================================
+ Coverage 66.80% 68.29% +1.48%
==========================================
Files 230 249 +19
Lines 16602 18904 +2302
==========================================
+ Hits 11091 12910 +1819
- Misses 4808 5133 +325
- Partials 703 861 +158 🚀 New features to boost your workflow:
|
checks/sast_test.go
Outdated
for _, tt := range tests { | ||
searchRequest := clients.SearchRequest{ | ||
Query: "github/codeql-action/analyze", | ||
Path: "/.github/workflows", | ||
} | ||
t.Run(tt.name, func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was there a driver behind redefining this in every test instead of once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I added a new test that needs another searchRequest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the duplication caught my eye initially, but I don't think it's not necessary anymore.
When the test was written 4 years ago, the SAST implementation actually used the search interface.
Lines 170 to 176 in e5a08af
// nolint | |
func codeQLInCheckDefinitions(c *checker.CheckRequest) (int, error) { | |
searchRequest := clients.SearchRequest{ | |
Query: "github/codeql-action/analyze", | |
Path: "/.github/workflows", | |
} | |
resp, err := c.RepoClient.Search(searchRequest) |
Where as today's implementation uses getSastUsesWorkflows
Lines 60 to 63 in 344a155
codeQLWorkflows, err := getSastUsesWorkflows(c, "^github/codeql-action/analyze$", checker.CodeQLWorkflow) | |
if err != nil { | |
return data, err | |
} |
which searches the files locally
Lines 169 to 172 in 344a155
err := fileparser.OnMatchingFileContentDo(c.RepoClient, fileparser.PathMatcher{ | |
Pattern: ".github/workflows/*", | |
CaseSensitive: false, | |
}, searchGitHubActionWorkflowUseRegex, &workflowPaths, usesRegex) |
If you uncomment the mock line, nothing panics/breaks, so I say we just get rid of it all the search requests/responses in this test
// mockRepoClient.EXPECT().Search(tt.searchRequest).Return(tt.searchresult, nil).AnyTimes()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy to do that, but let me clean up this test in a separate PR to not mix things together? I have reverted my changes in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm other than the few comments
This pull request has been marked stale because it has been open for 10 days with no activity |
Signed-off-by: Adam Korczynski <[email protected]>
Signed-off-by: Adam Korczynski <[email protected]>
Signed-off-by: Adam Korczynski <[email protected]>
What kind of change does this PR introduce?
(Is it a bug fix, feature, docs update, something else?)
feature
What is the current behavior?
Scorecard does not support hadolint SAST.
What is the new behavior (if this is a feature change)?**
Scorecard supports hadolint SAST.
Which issue(s) this PR fixes
Partially fixes #2318 (comment)
Special notes for your reviewer
Does this PR introduce a user-facing change?