-
Notifications
You must be signed in to change notification settings - Fork 23
ci: secure fork PR workflows with environment protection #1422
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
Reviewer's GuideThis PR migrates the main workflow to pull_request_target with optional manual dispatch, secures all build/test jobs under a protected “secure-build” environment requiring manual approval for forked PRs, standardizes the Podman login action to v1, and adds a new lean PR validation workflow that runs without secrets for immediate feedback. Sequence diagram for forked PRs requiring manual approval to access secretssequenceDiagram
actor Contributor
participant "GitHub Actions"
participant "secure-build environment"
Contributor->>"GitHub Actions": Open PR from fork
"GitHub Actions"->>"secure-build environment": Request access for build/test jobs
"secure-build environment"-->>"GitHub Actions": Wait for manual approval
Note over "GitHub Actions": Jobs do not run until approved
"secure-build environment"->>"GitHub Actions": Approval granted
"GitHub Actions"->>Contributor: Build/test jobs execute
Sequence diagram for PR validation workflow (immediate feedback, no secrets)sequenceDiagram
actor Contributor
participant GitHubActionsPRValidationWorkflow as "GitHub Actions: PR Validation Workflow"
Contributor->>GitHubActionsPRValidationWorkflow: Open PR
GitHubActionsPRValidationWorkflow->>Contributor: Run validation steps (build, test, vet, manifests)
GitHubActionsPRValidationWorkflow->>Contributor: Provide feedback (success/failure)
Note over GitHubActionsPRValidationWorkflow: No secrets accessed
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
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.
Hey there - I've reviewed your changes and they look great!
Blocking issues:
- An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. (link)
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `.github/workflows/main.yml:593` </location>
<code_context>
uses: redhat-actions/podman-login@v1
</code_context>
<issue_to_address>
**security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha):** An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.
*Source: opengrep*
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| - name: Log in to registry.redhat.io | ||
| uses: redhat-actions/podman-login@9184318aae1ee5034fbfbacc0388acf12669171f # v1 | ||
| uses: redhat-actions/podman-login@v1 |
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.
security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.
Source: opengrep
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
- Use pull_request_target with secure-build environment for container builds - Add PR validation workflow for immediate feedback without secrets - Require manual approval for forked PRs accessing organization secrets Signed-off-by: Tomas Turek <[email protected]>
d7c22ef to
061e11f
Compare
Summary by Sourcery
Secure forked PR workflows by using pull_request_target and protected environments, enable manual dispatch for arbitrary PR testing, and introduce a lightweight PR validation workflow for immediate feedback without secrets.
New Features:
Enhancements:
CI: