Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
permissions:
contents: write
id-token: write
Comment on lines +29 to +31

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 security Publishing permissions span full matrix

The job-level contents: write and id-token: write permissions apply to pull-request, non-publishing, Windows, and macOS executions even though OIDC login and release operations are restricted to the main/Ubuntu publishing path. Scoping these capabilities to a dedicated publishing job would reduce the impact of compromised actions or unintended pipeline behavior.

How this was verified: The permissions are assigned to the matrix job, while the OIDC-dependent login is gated to main, publishing enabled, and Ubuntu.

Knowledge Base Used: Build and CI

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


steps:
- name: Free Disk Space (Ubuntu)
Expand Down Expand Up @@ -151,12 +154,19 @@ jobs:
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']);
core.exportVariable('ACTIONS_RESULTS_URL', process.env['ACTIONS_RESULTS_URL']);

- name: NuGet login
if: ${{ github.ref == 'refs/heads/main' && github.event.inputs.publish-packages == 'true' && matrix.os == 'ubuntu-latest' }}
uses: NuGet/login@v1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 security Publishing action uses mutable tag

NuGet/login@v1 can resolve to different executable code without a repository-reviewed change, while this step receives the NuGet identity and can request an OIDC token. Pinning the action to a reviewed commit would make changes to this security-sensitive publishing dependency explicit.

How this was verified: The publishing step references the mutable v1 tag and runs with NUGET_USER plus job-level OIDC permission.

Knowledge Base Used: Build and CI

id: login
with:
user: ${{ secrets.NUGET_USER }}

- name: Run Pipeline
uses: ./.github/actions/execute-pipeline
with:
admin-token: ${{ secrets.ADMIN_TOKEN }}
environment: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Development' }}
nuget-apikey: ${{ secrets.NUGET__APIKEY }}
nuget-apikey: ${{ steps.login.outputs.NUGET_API_KEY }}
publish-packages: ${{ (github.event.inputs.publish-packages || false) && matrix.os == 'ubuntu-latest' }}

- name: Upload Diagnostic Logs
Expand Down
Loading