Conversation
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
|
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
Reviewer's GuideAdds a new GitHub Actions workflow that runs Microsoft Security DevOps on master branch pushes, pull requests, and a weekly schedule, then uploads SARIF results to the repository’s Security tab. Sequence diagram for new Microsoft Defender For Devops CI workflow executionsequenceDiagram
actor Developer
participant GitHubRepo
participant GitHubActions
participant Runner_windows_latest as Runner_windows_latest
participant MSDOAction as Microsoft_Security_DevOps_Action
participant CodeQLUpload as CodeQL_Upload_SARIF_Action
participant SecurityTab as GitHub_Security_Tab
Developer->>GitHubRepo: push_to_master_or_open_PR
GitHubRepo->>GitHubActions: trigger_workflow_defender_for_devops
GitHubActions->>Runner_windows_latest: start_job_MSDO
Runner_windows_latest->>Runner_windows_latest: actions_checkout_v4
Runner_windows_latest->>Runner_windows_latest: actions_setup_dotnet_v4_with_5_0_x_and_6_0_x
Runner_windows_latest->>MSDOAction: run_msdo_action
MSDOAction-->>Runner_windows_latest: sarifFile_output_path
Runner_windows_latest->>CodeQLUpload: upload_sarif_with_sarif_file_output
CodeQLUpload->>SecurityTab: store_and_display_SARIF_results
SecurityTab-->>Developer: show_security_scan_findings
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- Consider pinning the GitHub Actions (
actions/checkout,actions/setup-dotnet,microsoft/security-devops-action,github/codeql-action/upload-sarif) to specific commit SHAs rather than version tags to reduce the risk of breaking changes in your security pipeline. - The workflow is configured to trigger only on the
masterbranch; double-check that this matches your default branch name (oftenmain) or update the branch filters accordingly. - You are installing both .NET 5.0 and 6.0 even though 5.0 is end-of-life; if MSDO does not require 5.0 specifically, simplifying to only supported versions (e.g., 6.0) will reduce setup time and maintenance overhead.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider pinning the GitHub Actions (`actions/checkout`, `actions/setup-dotnet`, `microsoft/security-devops-action`, `github/codeql-action/upload-sarif`) to specific commit SHAs rather than version tags to reduce the risk of breaking changes in your security pipeline.
- The workflow is configured to trigger only on the `master` branch; double-check that this matches your default branch name (often `main`) or update the branch filters accordingly.
- You are installing both .NET 5.0 and 6.0 even though 5.0 is end-of-life; if MSDO does not require 5.0 specifically, simplifying to only supported versions (e.g., 6.0) will reduce setup time and maintenance overhead.
## Individual Comments
### Comment 1
<location path=".github/workflows/defender-for-devops.yml" line_range="19" />
<code_context>
+# and provide permission before this can report data back to azure.
+# Read the official documentation here : https://learn.microsoft.com/en-us/azure/defender-for-cloud/quickstart-onboard-github
+
+name: "Microsoft Defender For Devops"
+
+on:
</code_context>
<issue_to_address>
**nitpick (typo):** Minor naming consistency issue with "Devops" vs the canonical "DevOps".
This product is officially named “Microsoft Defender for DevOps” (see docs and Azure/GitHub UI). Please update the workflow name to match so it’s easier to recognize and search for.
```suggestion
name: "Microsoft Defender for DevOps"
```
</issue_to_address>
### Comment 2
<location path=".github/workflows/defender-for-devops.yml" line_range="35-44" />
<code_context>
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: |
+ 5.0.x
+ 6.0.x
+ - name: Run Microsoft Security DevOps
+ uses: microsoft/security-devops-action@v1.6.0
+ id: msdo
+ - name: Upload results to Security tab
+ uses: github/codeql-action/upload-sarif@v3
+ with:
+ sarif_file: ${{ steps.msdo.outputs.sarifFile }}
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Pin third-party actions to specific commit SHAs instead of version tags for better supply-chain security.
Floating tags like `@v4`, `@v3`, or `@v1.6.0` can point to different code over time, creating an untracked supply‑chain risk. Please pin each third‑party action here to a specific commit SHA (and optionally add a comment with the corresponding version for clarity).
Suggested implementation:
```
steps:
# actions/checkout@v4
- uses: actions/checkout@<COMMIT-SHA-FOR-actions/checkout-v4>
# actions/setup-dotnet@v4
- uses: actions/setup-dotnet@<COMMIT-SHA-FOR-actions/setup-dotnet-v4>
with:
dotnet-version: |
5.0.x
6.0.x
- name: Run Microsoft Security DevOps
# microsoft/security-devops-action@v1.6.0
uses: microsoft/security-devops-action@<COMMIT-SHA-FOR-microsoft/security-devops-action-v1.6.0>
id: msdo
- name: Upload results to Security tab
# github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@<COMMIT-SHA-FOR-github/codeql-action-v3>
with:
sarif_file: ${{ steps.msdo.outputs.sarifFile }}
```
To fully implement the hardening recommendation, you should replace each `<COMMIT-SHA-FOR-…>` placeholder with the actual immutable commit SHA that corresponds to the currently used tag:
1. For each action:
- Go to its GitHub repository (e.g., `https://github.com/actions/checkout`).
- Switch to the tag you are currently using (`v4`, `v4`, `v1.6.0`, `v3` respectively).
- Copy the full commit SHA shown for that tag.
2. Substitute the placeholders with those SHAs, keeping the comments that document which tag the SHA corresponds to.
This keeps the workflow behavior identical while pinning the supply chain to specific, auditable revisions.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…ain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary by Sourcery
CI: