Repository navigation
fix: harden entrypoint output handling in fullsend action #230
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,7 +99,17 @@ runs: | |
| echo "::error::fullsend entrypoint did not print an artifact directory on stdout" | ||
| exit 1 | ||
| fi | ||
| echo "artifact_dir=${ARTIFACT_DIR}" >> "${GITHUB_OUTPUT}" | ||
| # Validate path is absolute and within expected boundaries. | ||
| if [[ "${ARTIFACT_DIR}" != /* ]]; then | ||
| echo "::error::fullsend entrypoint returned a non-absolute path: ${ARTIFACT_DIR}" | ||
| exit 1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No path canonicalization A path like ARTIFACT_DIR="$(realpath -m "${ARTIFACT_DIR}")"The |
||
| fi | ||
| # Use heredoc delimiter to prevent GITHUB_OUTPUT injection via newlines. | ||
| { | ||
| echo "artifact_dir<<FULLSEND_EOF" | ||
| echo "${ARTIFACT_DIR}" | ||
| echo "FULLSEND_EOF" | ||
| } >> "${GITHUB_OUTPUT}" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delimiter injection / no newline validation The static More fundamentally, Suggested fix (both layers): # Reject paths with newlines/CRs
if [[ "${ARTIFACT_DIR}" =~ $'\n' || "${ARTIFACT_DIR}" =~ $'\r' ]]; then
echo "::error::fullsend entrypoint returned a path containing control characters"
exit 1
fi
# Use a randomized delimiter
DELIMITER="FULLSEND_EOF_$(head -c 16 /dev/urandom | xxd -p)"
{
echo "artifact_dir<<${DELIMITER}"
echo "${ARTIFACT_DIR}"
echo "${DELIMITER}"
} >> "${GITHUB_OUTPUT}"The newline rejection is the most important fix — it neutralizes delimiter collision as a secondary effect. |
||
|
|
||
| - name: Upload fullsend artifacts | ||
| uses: actions/upload-artifact@v4 | ||
|
|
||
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.
Untrusted input in
::error::annotationARTIFACT_DIRcomes from CLI stdout and is untrusted. Interpolating it directly into a::error::workflow command could allow workflow command injection (e.g., if the value contains::sequences or encoded newlines).Suggested fix — log the value separately instead of interpolating it into the annotation: