chore: secure-proof workflows #108
Merged
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.
What kind of change does this PR introduce?
Proactive security hardening - implementing defense-in-depth for our preview release workflow.
What is the current behavior?
The current
preview-release.yml
workflow is secure in practice but uses a pattern that could be theoretically vulnerable if our existing safeguards were bypassed.Current workflow security analysis:
trigger: preview
)pull-requests: write
)pull_request_target
while checking out PR head codenpm ci
andnpm run build
from forks in a context with secretsImportant: Our workflow was never vulnerable to the attacks seen in the recent incident due to our security controls. However, in light of recent supply chain attacks, we're implementing additional layers of security.
What is the new behavior?
Implementing a zero-trust architecture that makes exploitation impossible even if all other safeguards fail.
New Three-Workflow Architecture:
preview-build.yml
- Executes untrusted fork code in a completely isolated environment (no secrets, minimal permissions)trigger-tests.yml
- Orchestrates testing using only artifacts (never touches fork code, has access to secrets)preview-comment.yml
- Updates PR status (read-only operations with artifacts)Security Improvements:
Key Architectural Benefits:
Additional context
Why make this change now?
Following the recent Nx supply chain attack and similar incidents in the ecosystem, we're proactively hardening our security posture. While our existing workflow was not vulnerable to the specific attack vectors used against Nx (thanks to our label requirements and lack of code injection points), we recognize that:
Risk Assessment:
Implementation Highlights:
Technical Details:
This change replaces a single 167-line workflow with three focused workflows (307 lines total) that:
pull_request_target
with fork code execution