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

refactor: use reusable workflow for semgrep #311

Merged
merged 5 commits into from
Aug 30, 2024

Conversation

dvarasani-crest
Copy link
Contributor

@dvarasani-crest dvarasani-crest commented Aug 27, 2024

Updated the build-test-release workflow to use sast-scan owned by product security team instead of using custom implementation.
Ref: https://splunk.atlassian.net/browse/ADDON-72309

Test workflow run: https://github.com/splunk/splunk-add-on-for-servicenow/actions/runs/10596615468
Tested on PR: https://github.com/splunk/splunk-add-on-for-servicenow/pull/751

Workflow is not tested for the failure scenario because we need to have blocker findings by the semgrep in order to fail the workflow. Currently all rules are in monitor mode so any findings by the semgrep will be non-blocker resulting in semgrep stage to pass everytime.
Discussion with the semgrep team: https://splunk.slack.com/archives/C011ELTV7FG/p1724923496371529

@dvarasani-crest dvarasani-crest marked this pull request as ready for review August 27, 2024 09:27
@dvarasani-crest dvarasani-crest requested a review from a team as a code owner August 27, 2024 09:27
@mkolasinski-splunk mkolasinski-splunk added this to the Release v4.17 milestone Aug 30, 2024
Copy link
Contributor

@mkolasinski-splunk mkolasinski-splunk left a comment

Choose a reason for hiding this comment

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

LGTM.
Regarding GHAS and failing job when blocking issues are found - let's postpone on that once we figure out possible solutions.
@pawel-dabro are you also fine with releasing this change?

edit: @dvarasani-crest please extend description of the PR with issues with triggering true positives and limitations of failing job that you faced

@kdoroszko-splunk
Copy link
Contributor

kdoroszko-splunk commented Aug 30, 2024

Have you seen this error in the test run:
image
The workflow is not valid. .github/workflows/build-test-release.yml (Line: 25, Col: 3): Error calling workflow 'splunk/addonfactory-workflow-addon-release/.github/workflows/reusable-build-test-release.yml@chore/use-reusable-workflow-for-semgrep'. The nested job 'semgrep' is requesting 'actions: write, attestations: write, deployments: write, discussions: write, issues: write, pages: write, pull-requests: write, repository-projects: write, security-events: write, id-token: write', but is only allowed 'actions: read, attest[...] ?

@dvarasani-crest
Copy link
Contributor Author

Have you seen this error in the test run: image The workflow is not valid. .github/workflows/build-test-release.yml (Line: 25, Col: 3): Error calling workflow 'splunk/addonfactory-workflow-addon-release/.github/workflows/reusable-build-test-release.yml@chore/use-reusable-workflow-for-semgrep'. The nested job 'semgrep' is requesting 'actions: write, attestations: write, deployments: write, discussions: write, issues: write, pages: write, pull-requests: write, repository-projects: write, security-events: write, id-token: write', but is only allowed 'actions: read, attest[...] ?

This error was observed when I tried to add upload_result: true in the semgrep action which also requires to add permissions: write-all. I have reverted that change and it should be working fine now.
Latest test workflow run after reverting those changes: https://github.com/splunk/splunk-add-on-for-servicenow/actions/runs/10596615468/job/29463986478

@mkolasinski-splunk
Copy link
Contributor

mkolasinski-splunk commented Aug 30, 2024

Have you seen this error in the test run: image The workflow is not valid. .github/workflows/build-test-release.yml (Line: 25, Col: 3): Error calling workflow 'splunk/addonfactory-workflow-addon-release/.github/workflows/reusable-build-test-release.yml@chore/use-reusable-workflow-for-semgrep'. The nested job 'semgrep' is requesting 'actions: write, attestations: write, deployments: write, discussions: write, issues: write, pages: write, pull-requests: write, repository-projects: write, security-events: write, id-token: write', but is only allowed 'actions: read, attest[...] ?

@kdoroszko-splunk It's strange that this issue is reported there; Just to be sure I triggered another wf and looks good:
https://github.com/splunk/splunk-add-on-for-servicenow/actions/runs/10629744350

@mkolasinski-splunk mkolasinski-splunk merged commit d875027 into develop Aug 30, 2024
6 checks passed
@mkolasinski-splunk mkolasinski-splunk deleted the chore/use-reusable-workflow-for-semgrep branch August 30, 2024 09:35
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 2024
@srv-rr-github-token
Copy link

🎉 This PR is included in version 4.17.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants