-
Notifications
You must be signed in to change notification settings - Fork 12
fix(sdk): parse npm 12 pack JSON when publishing the runtime #1218
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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 | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: arul28/ADE
Length of output: 6153
🏁 Script executed:
Repository: arul28/ADE
Length of output: 6047
🌐 Web query:
GitHub Actions GITHUB_OUTPUT duplicate output names multiline output file parser last value wins💡 Result:
In GitHub Actions, when you write multiple values to the
GITHUB_OUTPUTenvironment file with the same key, the behavior generally follows a "last value wins" approach, where the final value defined for that key becomes the one accessible in the step's outputs [1]. Technical context regarding this behavior: 1. Mechanism: When you useecho "{name}={value}" >> "$GITHUB_OUTPUT", you are appending to a file on the runner [2][3]. The GitHub Actions runner processes this file at the end of the step to determine the final output values available in the workflow context [4]. Because the file is processed as a sequential list of assignments, if a key is defined multiple times, the final assignment overrides any previous ones [1]. 2. Multiline Outputs: To safely handle multiline strings, you must use the heredoc syntax, which is specifically designed to prevent truncation and parsing issues [3]. The syntax requires a unique delimiter: {name}<<{delimiter} {value} {delimiter} Using this structure ensures the entire multiline block is captured correctly as a single value [3]. 3. Parser Behavior vs. Tooling: While the "last value wins" behavior is observed when manually appending to$GITHUB_OUTPUT, developers should avoid relying on this as a core design pattern if possible. It is distinct from how YAML parsers (used for the workflow file itself) handle duplicate keys—which can sometimes be rejected entirely by linters likeactionlint[5]—or how internal API-based tools (like the Actions toolkitcore.setOutput) generate their outputs [6][7]. Using the officialactions/toolkit(e.g.,core.setOutput) is generally recommended, as it automatically handles the generation of unique delimiters to prevent key/value collisions and potential injection attacks [6][7].Citations:
🌐 Web query:
site:github.com/actions/runner FileCommandManager SetOutputFileCommand duplicate key last value wins💡 Result:
When using the file-based
SetOutputFileCommandin GitHub Actions (by appending to the file path specified in the$GITHUB_OUTPUTenvironment variable), the runner processes keys sequentially as they appear in the file [1][2]. If you set the same output key multiple times within a single step, the implementation ofSetOutputFileCommanditerates through the parsed key-value pairs and performs a dictionary update for each pair [1]. Consequently, the last value assigned to a specific key in the file will overwrite any previous values, resulting in a "last value wins" behavior [1][3]. This applies to both the standardkey=valueformat and when using heredoc syntax for multiline strings [2]. Note that while the runner processes these sequentially within a single step, subsequent steps or different contexts may have different lifecycle behaviors [4][5].Citations:
Injection (CWE-78): Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Reachability: External · Exploitability: Moderate
Pass the version through
env:and validate the complete input.A multiline tag can pass the line-oriented
grepcheck and create duplicateversion=entries inGITHUB_OUTPUT. The runner uses the last entry, which can inject shell syntax when the output is interpolated intorun:. Use"$VERSION"and reject multiline values with Bash’s[[ ... =~ ... ]]check.🧰 Tools
🪛 zizmor (1.29.0)
[info] 177-177: code injection via template expansion (template-injection): may expand into attacker-controllable code
(template-injection)
🤖 Prompt for AI Agents
Sources: MCP tools, Linters/SAST tools