Skip to content

ci: restrict GITHUB_TOKEN to least privilege and add security policy - #1

Draft
fablab503-collab wants to merge 4 commits into
mainfrom
claude/wizardly-lamport-6gvcqe
Draft

fablab503-collab wants to merge 4 commits into
mainfrom
claude/wizardly-lamport-6gvcqe

Conversation

@fablab503-collab

Copy link
Copy Markdown
Owner

Summary

  • build.yml: the default token is now contents: read. Only package-ios and package-mac get contents: write, because they upload release assets.
  • issues.yml: permissions: {}. The cooldown action uses its own COOLDOWN_TOKEN and doesn't need the default token.
  • Adds SECURITY.md with the hardening baselines.

Audit notes (no change needed)

  • The base64 --decode steps write secrets to files (-o). They don't print them to the logs.
  • There are no pull_request_target or wildcard branch triggers. Fork PRs get a read-only token and no secrets.
  • Something to watch: if IS_SELF_HOSTED_RUNNER is set, fork PRs would run on the self-hosted runner.

Generated by Claude Code

Default the build workflow to contents: read and grant contents: write
only to the two jobs that upload release assets. The issues workflow
uses its own COOLDOWN_TOKEN, so it needs no GITHUB_TOKEN scopes.

Assisted-by: Claude:claude-opus-5-5

Copy link
Copy Markdown
Owner Author

Build Sysroot (arm64, visionos) fails, and the cause is not this PR's change.

  • The job stops in scripts/build_dependencies.sh check_env with 'six' not found in your Python 3 installation. That happens about 10s in, before any build work.
  • main is already red the same way: run 40285169331, Build Sysroot (arm64, macos).
  • This PR only adds permissions: blocks and SECURITY.md. Token scopes don't affect pip or Python, so they can't cause this.

Likely root cause (not verified, since it needs a macOS runner): on the macos-26 image, pip3 install --user … in "Install Requirements" installs into a different Python than the python3 the script later runs. Homebrew's llvm/meson can pull in a newer python@3.x. A possible fix, outside this PR's scope:

-          pip3 install --break-system-packages --user six pyparsing pyyaml setuptools distlib mako
+          python3 -m pip install --break-system-packages --user six pyparsing pyyaml setuptools distlib mako

No re-run yet: the run is still in progress, and this failure is deterministic.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Correction to my earlier comment: the real cause is that the Install Requirements step is always skipped on hosted runners. It compares the quoted output 'macos-26' to macos-26. It's not a pip3/python3 mismatch. The fix is in #2. Once #2 is merged, merge main into this branch to re-run CI.


Generated by Claude Code

The configuration job emits the runner as a quoted JSON string
('macos-26') for fromJSON() in runs-on, but Install Requirements
compared that raw string to env.RUNNER_IMAGE (macos-26). They never
matched, so on GitHub-hosted runners the step was always skipped and
build_dependencies.sh failed with "'six' not found". Self-hosted
runners still parse to an array and keep skipping the step.

Assisted-by: Claude:claude-opus-5-5
With Install Requirements now running on hosted runners, the sysroot
build gets to Mesa's host build, which fails at meson.build:2092 with
'Dependency "SPIRV-Tools" not found'. llvmspirvlib is already found via
Homebrew's pkg-config, so add the matching spirv-tools formula.

Assisted-by: Claude:claude-opus-5-5

Copy link
Copy Markdown
Owner Author

I copied the two CI fixes from #2 into this PR (7ecc334, 038fccc). On #2, 10 of the 11 Build Sysroot jobs are now green on hosted runners, and the last one is still running. Once #2 merges, these commits will match main, so this PR's own diff stays the permissions change plus SECURITY.md.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Heads-up: with the ported sysroot fix, this PR's Build UTM jobs will hit the next blocker, which is described on #2. The source needs the iOS 27 SDK, and no GitHub-hosted image has Xcode 27 yet. That failure has nothing to do with this PR's permissions change. It needs a self-hosted runner with Xcode 27, or a newer hosted image.


Generated by Claude Code

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.

2 participants