Skip to content

Potential fix for code scanning alerts: Workflow does not contain permissions#1164

Merged
mprins merged 4 commits intomainfrom
alert-autofix-450
Feb 19, 2026
Merged

Potential fix for code scanning alerts: Workflow does not contain permissions#1164
mprins merged 4 commits intomainfrom
alert-autofix-450

Conversation

@mprins
Copy link
Copy Markdown
Contributor

@mprins mprins commented Feb 18, 2026

Potentialfixforhttps://github.com/Tailormap/tailormap-viewer/security/code-scanning/450

Tofix the problem, give the event_file job its own explicit, least-privilege permissions block so it does not inherit broad defaults. Because this job only needs to read the workflow event JSON from the checkout/context and upload it as an artifact, it only requires contents: read. It does not modify code, issues, or PRs.

Concretely, in .github/workflows/test-and-deploy.yml, inside the event_file job (around lines 100–108), add a permissions: section with contents: read. Place it at the same indentation level as runs-on: and steps:. No imports or other files are needed, and no behavior of the job changes; it simply restricts the GITHUB_TOKEN for this job.

resolve:

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

@mprins mprins self-assigned this Feb 18, 2026
@mprins mprins added the infrastructure CI and build process related label Feb 18, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 18, 2026

Test Results

  1 files  ±0  226 suites  ±0   8m 30s ⏱️ +22s
601 tests ±0  601 ✅ ±0  0 💤 ±0  0 ❌ ±0 
695 runs  ±0  695 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit af6c899. ± Comparison against base commit f42ef90.

♻️ This comment has been updated with latest results.

…ain permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@mprins mprins changed the title Potential fix for code scanning alert no. 450: Workflow does not contain permissions Potential fix for code scanning alerts: Workflow does not contain permissions Feb 19, 2026
mprins and others added 3 commits February 19, 2026 09:50
…ain permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ain permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@mprins mprins marked this pull request as ready for review February 19, 2026 09:01
Copilot AI review requested due to automatic review settings February 19, 2026 09:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to address GitHub code scanning alerts about missing/overly broad GITHUB_TOKEN permissions by adding explicit permissions blocks to workflows/jobs.

Changes:

  • Add workflow-level permissions: contents: read to test-and-deploy.yml.
  • Add job-level permissions: contents: read to the event_file job in test-and-deploy.yml.
  • Add workflow-level permissions: contents: read to deploy-embed-test.yml.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/test-and-deploy.yml Adds explicit permissions at workflow and event_file job level to satisfy code scanning.
.github/workflows/deploy-embed-test.yml Adds explicit workflow-level permissions (contents: read).
Comments suppressed due to low confidence (1)

.github/workflows/test-and-deploy.yml:5

  • PR description says the change is limited to adding a job-level permissions block to event_file in test-and-deploy.yml, but this also adds workflow-level permissions and updates an additional workflow (deploy-embed-test.yml). Either update the PR description to match the actual changes or narrow the changes to what’s described.
permissions:
  contents: read

name: 'Test and deploy'

permissions:
contents: read
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The new workflow-level permissions: contents: read applies to all jobs that don’t define their own permissions. This workflow uses actions/upload-artifact in the test and event_file jobs, which requires actions access; with only contents: read those uploads are likely to fail. Consider either (a) adding actions: write to the jobs that upload artifacts (and keep workflow-level permissions empty or minimal), or (b) broadening the workflow-level permissions to include what those jobs need.

Suggested change
contents: read
contents: read
actions: write

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/test-and-deploy.yml
@mprins mprins merged commit 4017080 into main Feb 19, 2026
20 checks passed
@mprins mprins deleted the alert-autofix-450 branch February 19, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure CI and build process related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants