Skip to content

Enhance error messaging and cleanup in license check and project reso… - #23

Merged
ACodingPhilosopher merged 2 commits into
mainfrom
fix/pr22-hardening-followup
Jul 21, 2026
Merged

Enhance error messaging and cleanup in license check and project reso…#23
ACodingPhilosopher merged 2 commits into
mainfrom
fix/pr22-hardening-followup

Conversation

@SondreFjaertoft

Copy link
Copy Markdown
Contributor

fixen fra copilot

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Improves the robustness of GitHub Actions workflow command logging and temporary-file handling in the Dependency-Track project resolver and license inventory scan.

Changes:

  • Added escape_workflow_value to percent-encode workflow command payloads (e.g., ::warning::) in both the resolver script and the license-check action.
  • Added an EXIT trap in the license-check action to centralize cleanup of temporary files.
  • Escaped DT_PROJECT_NAME when included in warning annotations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
resolve-dt-project/resolve-project.sh Escapes warning prefix/message to safely emit ::warning:: workflow commands.
dt-license-check/action.yml Adds workflow-command escaping, introduces temp-file cleanup trap, and escapes project name in warnings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +82 to +89
cleanup_temp_files() {
rm -f "${PAGE_FILE:-}" "${DETAIL_FILE:-}" "${UNIQUE_LICENSES_FILE:-}" \
"${DT_LICENSES_FILE:-}" "${DT_LICENSES_HEADERS_FILE:-}" \
"${NORMALIZED_FILE:-}" "${COMPONENTS_FILE:-}"
if [[ -n "${COMPONENTS_FILE:-}" ]]; then
rm -f "${COMPONENTS_FILE}.next"
fi
}

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

dt-license-check/action.yml:91

  • cleanup_temp_files runs under set -e while an ERR trap is installed. If any rm fails (e.g., permission/IO issues), it can trigger the ERR trap during cleanup and emit a misleading warning / overwrite outputs. Make the cleanup best-effort by preventing rm failures from propagating.
            if [[ -n "$f" ]]; then rm -f "$f"; fi
          done
          if [[ -n "${COMPONENTS_FILE:-}" ]]; then
            rm -f "${COMPONENTS_FILE}.next" || true
          fi

@ACodingPhilosopher
ACodingPhilosopher merged commit 4de44a9 into main Jul 21, 2026
1 check passed
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.

3 participants