-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add fork-friendly Checkmarx action for public repos (PM-19431) #25
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
Conversation
Implements solution for fork PR scanning without secrets exposure: - New checkmarx-scan-public action that doesn't checkout code - Uses Checkmarx CLI to scan remote repositories directly - Safe for use with pull_request_target in public repos - Allows fork PRs to run Checkmarx scans Solves the fork conundrum (PM-19178) where external contributors couldn't get green CI due to missing secrets access.
|
Great job! No new security vulnerabilities introduced in this pull request |
Testing PM-19431 solution for fork PR scanning: - Changed pull_request to pull_request_target - Removed main code checkout (critical for security) - Uses new checkmarx-scan-public action from sean/PM-19431-fork-friendly-checkmarx branch - This will allow fork PRs to run Checkmarx scans Note: Depends on midnightntwrk/upload-sarif-github-action#25
Signed-off-by: Squirrel <giles.cope@shielded.io>
| if [ -n "${{ inputs.additional-params }}" ]; then | ||
| SCAN_CMD="$SCAN_CMD ${{ inputs.additional-params }}" | ||
| fi | ||
|
|
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.
additional params default to '' so no need for the if:
| if [ -n "${{ inputs.additional-params }}" ]; then | |
| SCAN_CMD="$SCAN_CMD ${{ inputs.additional-params }}" | |
| fi | |
| SCAN_CMD="$SCAN_CMD ${{ inputs.additional-params }}" | |
Testing PM-19431 solution for fork PR scanning: - Changed pull_request to pull_request_target - Removed main code checkout (critical for security) - Uses new checkmarx-scan-public action from sean/PM-19431-fork-friendly-checkmarx branch - This will allow fork PRs to run Checkmarx scans Note: Depends on midnightntwrk/upload-sarif-github-action#25
Per Giles' standup feedback, the CLI was running different scan types than the original action, resulting in fewer issues being detected. Added --scan-types parameter with sast,sca,kics to ensure comprehensive security scanning matching the original behavior. This ensures fork PRs get the same security coverage as regular PRs.
|
Added fix for scan types issue mentioned in standup. The CLI was using different defaults than the GitHub Action, resulting in fewer vulnerabilities being detected. Fixed by explicitly specifying
This matches the original action's security coverage. Note: Scorecard/SCS is still not included as it requires additional tokens that fork PRs wouldn't have access to. Per @gilescope's suggestion, we can add actionlint as an alternative validation tool in a follow-up PR. @gilescope @MB-IOHK - This push has made your approvals stale. Could you please re-review? The only change is adding the scan types parameter to fix the issue Giles identified in standup. |
Per Giles' suggestion in PR #25, adding actionlint as a lightweight alternative to scorecard/SCS validation that works with fork PRs. - Downloads and runs actionlint for workflow validation - Integrates shellcheck and pyflakes for script validation - Creates GitHub annotations for discovered issues - No special tokens required (fork-friendly)
|
Thanks for the approval @MB-IOHK! @gilescope identified an issue with SCS/Scorecard for fork PRs:
Giles suggested we try using GITHUB_TOKEN instead of MIDNIGHTCI_REPO for the SCS token before making it conditional. Plan to fix in this PR:
I'll push these changes to complete PM-19431 properly. The core Checkmarx scanning works for forks, just need to fix the SCS component. |
- Add scs-repo-token input parameter with github.token fallback - Include SCS parameters in scan command when token is available - Display SCS status in scan parameters output - Use GITHUB_TOKEN for public fork PRs as suggested by Giles This completes PM-19431 by enabling Supply Chain Security scanning for fork PRs using the GitHub token which has read access to public repositories.
Use the repo-url input (which points to the fork) instead of github.repository (which always points to the base repo) for SCS scanning. This ensures SCS analyzes the correct repository when scanning fork PRs.
|
@MB-IOHK @gilescope, Thanks for your feedback about using ✅ Tested and WorkingI've successfully tested this implementation with a real fork PR: midnightntwrk/midnight-node-docker#58 What's been fixed:
Test Results:The SCS results show dashes, which is expected for midnight-node-docker (minimal dependencies, just Docker compose files). Summary:This PR now successfully implements fork-friendly Checkmarx scanning with SCS/Scorecard support, addressing the issue where |
Add documentation for the new scs-repo-token input that enables SCS/Scorecard scanning for fork PRs using github.token as default

Summary
This PR introduces a new Checkmarx action variant that enables fork PRs to run security scans on public repositories without requiring access to secrets.
Problem (PM-19178)
Solution (PM-19431)
Created
checkmarx-scan-publicaction that:pull_request_targetto access secrets safelyTechnical Approach
Instead of:
We do:
cx scan create -s <repo-url> --branch <branch>Security Model
pull_request_targetprovides secret access (runs with base branch context)Changes
checkmarx-scan-public/action.yml- New composite action for fork-friendly scanningcheckmarx-scan-public/README.md- Documentation and usage examplesTesting Plan
pull_request_targetwith new actionUsage Example
Notes