-
Notifications
You must be signed in to change notification settings - Fork 114
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
Migrate to semgrep-agent #4430
Closed
Closed
Migrate to semgrep-agent #4430
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
866b604
try agent
msorens 16dedb2
Move to private pipeline for security
msorens 3c2580d
Add explicit workdir
msorens 5a342e7
bump timeout
msorens a4bc31a
Copy default .semgrepignore
msorens f6237a0
Add chef customizations to .semgrepignore
msorens 60d5fb9
Do not fail the build for now
msorens fb52aa5
Check directory just to be safe
msorens c4b0145
PR bonus: Tidy up Makefiles
msorens c496f36
Rename directory per semgrep convention
msorens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -eou pipefail | ||
|
||
SEMGREP_TOKEN=$(vault kv get -field token secret/semgrep) | ||
SEMGREP_ID=$(vault kv get -field id secret/semgrep) | ||
|
||
export SEMGREP_TOKEN | ||
export SEMGREP_ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copied from https://github.com/returntocorp/semgrep-action/blob/develop/src/semgrep_agent/templates/.semgrepignore | ||
# Note that these are for semgrep-agent ONLY; command line semgrep does NOT use this file. | ||
|
||
# Ignore git items | ||
.gitignore | ||
.git/ | ||
:include .gitignore | ||
|
||
# Common large directories | ||
node_modules/ | ||
build/ | ||
dist/ | ||
vendor/ | ||
env/ | ||
.env/ | ||
venv/ | ||
.venv/ | ||
*.min.js | ||
|
||
# Common test directories | ||
test/ | ||
tests/ | ||
|
||
# Semgrep rules folder | ||
.semgrep | ||
|
||
# Chef customizations | ||
third_party/ | ||
*_test.go | ||
*.pb.go | ||
*.bindata.go | ||
*.spec.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,10 @@ GOLANGCILINTTARBALL:=golangci-lint-$(GOLANGCILINTVERSION)-$(PLATFORM).tar.gz | |
|
||
LINTERARGS?=./... | ||
|
||
# Semgrep by default respects .gitignore; these are additive: | ||
SEMGREP_IGNORE := --exclude third_party --exclude *_test.go --exclude *.pb.go --exclude *.bindata.go | ||
SEMGREP_CONFIG := https://semgrep.dev/p/r2c-ci | ||
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR bonus: Eliminate lots of duplication |
||
|
||
$(REPOROOT)/cache/$(GOLANGCILINTTARBALL): | ||
curl --output $(REPOROOT)/cache/$(GOLANGCILINTTARBALL) -L https://github.com/golangci/golangci-lint/releases/download/v$(GOLANGCILINTVERSION)/$(GOLANGCILINTTARBALL) | ||
|
||
|
@@ -50,13 +54,13 @@ spell: | |
# NB: "third_party" only exists for automate-gateway, but no harm having it for other dirs here. | ||
semgrep: | ||
# uncomment if custom rules beyond automate-ui ever get added | ||
# semgrep --config $(REPOROOT)/semgrep --exclude third_party --exclude *_test.go --exclude *.pb.go --exclude *.bindata.go | ||
semgrep --config https://semgrep.dev/p/r2c-ci --exclude third_party --exclude *_test.go --exclude *.pb.go --exclude *.bindata.go | ||
# semgrep --config $(REPOROOT)/.semgrep $(SEMGREP_IGNORE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Directory change (semgrep to .semgrep) per semgrep convention. |
||
semgrep --config $(SEMGREP_CONFIG) $(SEMGREP_IGNORE) | ||
|
||
#: Security validation via semgrep; autofix where possible | ||
semgrep-and-fix: | ||
# uncomment if custom rules beyond automate-ui ever get added | ||
# semgrep --config $(REPOROOT)/semgrep --exclude third_party --exclude *_test.go --exclude *.pb.go --exclude *.bindata.go --autofix | ||
semgrep --config https://semgrep.dev/p/r2c-ci --exclude third_party --exclude *_test.go --exclude *.pb.go --exclude *.bindata.go --autofix | ||
# semgrep --config $(REPOROOT)/.semgrep $(SEMGREP_IGNORE) --autofix | ||
semgrep --config $(SEMGREP_CONFIG) $(SEMGREP_IGNORE) --autofix | ||
|
||
.PHONY: lint fmt fmt-check golang_version_check semgrep semgrep-and-fix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Need to move to the private pipeline to be able to provide token and id.