Skip to content

ci(security): add least-privilege workflow permissions (DAW-79) - #4

Merged
tdawe1 merged 1 commit into
mainfrom
daw-79-scdesk-security
Nov 2, 2026
Merged

tdawe1 merged 1 commit into
mainfrom
daw-79-scdesk-security

Conversation

@tdawe1

@tdawe1 tdawe1 commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Salvaged the verified but uncommitted Alert Fixer fix from the primary scdesk checkout (DAW-79), applied unchanged in this worktree. What changed:

 .github/workflows/ci.yml
+permissions:
+  contents: read

Evidence

  • Before: primary checkout had the fix uncommitted; workflow ran with default permissive token.
  • After (this worktree): workflow YAML parses OK; cargo test --workspace --exclude scdesk-pulse --exclude scdesk-journal — 57 passed, 0 failed (3+20+22+5+7 across crates, doc-tests 0).
  • gitleaks git . --log-opts=origin/main..HEAD — no leaks found.

Merge Danger

Door: two-way
Blast Radius: low — read-only token is sufficient for checkout/test jobs; add perms if a future job needs writes.

What Thomas must do

  • Review and merge this PR.
  • After merge, reset the primary checkout (~/Projects/scdesk) to discard the now-duplicated uncommitted changes there — the primary working tree was left exactly as found by this PR work.

@tdawe1 tdawe1 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review: scdesk#4 — ci(security): add least-privilege workflow permissions (DAW-79)

Verdict: approve-ready (comment only) — no blocking findings. The 3-line change does exactly what DAW-79 asks and is safe to merge.

Scope checked: git diff origin/main...HEAD is one file, .github/workflows/ci.yml (+3/-0). YAML parses; jobs are rust, tauri-check, ui.

Spec (DAW-79)

DAW-79 acceptance for scdesk is "salvage the verified security fix into a worktree PR with test evidence, leave the primary checkout for Thomas to reset". This PR matches: top-level least-privilege token, with ticket evidence (YAML parse OK; cargo test --workspace --exclude scdesk-pulse --exclude scdesk-journal 57 passed, 0 failed; gitleaks no leaks). No scope creep — nothing beyond the permissions block.

Findings

Blocking — none

Medium — none

Low / advisory

  • None that blocks merge. Cache note (info, no action needed): rust/tauri-check use Swatinem/rust-cache@v2 and ui uses actions/setup-node@v5 with cache: npm. These cache via the Actions runtime token, so top-level contents: read (unspecified scopes default to none) does not break them; worst case a future cache-save warning would be non-fatal. No actions: grant needed.

Info

  • .github/workflows/ci.yml:11-12 — permissions: contents: read is correct and sufficient. All three jobs only checkout + install toolchain/deps + run cargo test / cargo check / svelte-check. No job publishes, releases, pushes, uploads SARIF/pages, or writes back to the repo, so no additional scope (actions:, security-events:, id-token:) is needed. If a future job needs writes, add per-job permissions: rather than widening the top level.
  • .github/workflows/ci.yml:18,27,40 — actions/checkout@v5, dtolnay/rust-toolchain@stable, Swatinem/rust-cache@v2, actions/setup-node@v5 remain mutable major tags, not SHA-pinned. Pre-existing, out of scope for this diff; noting only. No secret/auth/injection surface in this diff (no secrets.*, no GITHUB_TOKEN writes, no scripted input interpolation).
  • Gengo submit path: no contact. Bounded repo search for gengo|submit finds no matches; the diff touches only CI token scope, not app code.
  • Missing tests: none required. Token scope is not unit-testable; YAML parse (yaml.safe_load, permissions == {'contents': 'read'}, 3 jobs) is the right cheap check and passes in this worktree. Optional future hardening (not this PR): actionlint or ghalint in CI.
  • Standards: no repo-published coding standards found (AGENTS.md/CLAUDE.md/CONTRIBUTING.md absent; docs/ holds product parity notes only). Against the smell baseline: 3-line additive block, no naming/duplication/envy/clumps — clean. No needless complexity.

@tdawe1

tdawe1 commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

automerge review: ✅ approve (Review (Claude) (anthropic/claude-sonnet-5-5), head e272652eb)

This PR adds a workflow-level permissions: contents: read block to .github/workflows/ci.yml. It matches the title and the DAW-79 least-privilege intent. I read the full workflow at the head commit. The three jobs (rust, tauri-check, ui) only check out code, run cargo and npm, and use cache actions. None of them write to the repo, PRs, or packages, and none use secrets. Swatinem/rust-cache and setup-node caching use the Actions cache runtime token rather than GITHUB_TOKEN scopes, so they are unaffected. CI is green on the change. It does not touch Gengo submission or upload, customer data, or secrets. It is a three-line change that is easy to revert. The 'What Thomas must do' note about resetting the primary checkout is a housekeeping step after merge and does not block approval.

severity where note
nit .github/workflows/ci.yml:11-12 The permissions block is correct at workflow level. If a job later needs writes, grant them per job and keep the top-level default at read.

@tdawe1
tdawe1 merged commit c5fb2b6 into main Nov 2, 2026
8 checks passed
@tdawe1
tdawe1 deleted the daw-79-scdesk-security branch November 2, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant