Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ AWS_SECRET_ACCESS_KEY=$(cat /usr/local/ci-secrets/konflux-devprod-rosa-credentia
export AWS_REGION=us-east-1

cd "$(mktemp -d)"
curl -sSL https://raw.githubusercontent.com/konflux-ci/tekton-integration-catalog/main/scripts/mapt/delete-mapt-clusters.sh | bash
curl -sSL https://raw.githubusercontent.com/psturc/tekton-integration-catalog/fix-mapt-deletion-script/scripts/mapt/delete-mapt-clusters.sh | bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Pin and verify the fetched script before execution.

Line 14 executes code directly from a mutable personal fork branch (curl ... | bash) while AWS credentials are exported in the same process. This creates a critical supply-chain path for credential exfiltration if that branch changes or is compromised. Use an immutable commit URL, download to disk, verify checksum/signature, then execute.

Suggested hardening
-curl -sSL https://raw.githubusercontent.com/psturc/tekton-integration-catalog/fix-mapt-deletion-script/scripts/mapt/delete-mapt-clusters.sh | bash
+SCRIPT_URL="https://raw.githubusercontent.com/psturc/tekton-integration-catalog/<PINNED_COMMIT_SHA>/scripts/mapt/delete-mapt-clusters.sh"
+SCRIPT_PATH="$(mktemp)"
+SCRIPT_SHA256="<EXPECTED_SHA256>"
+
+curl --fail --silent --show-error --location "${SCRIPT_URL}" -o "${SCRIPT_PATH}"
+echo "${SCRIPT_SHA256}  ${SCRIPT_PATH}" | sha256sum -c -
+bash "${SCRIPT_PATH}"

As per coding guidelines: “Protect sensitive information in step-registry command scripts … never echo passwords, tokens, API keys … to logs.” A mutable unpinned remote script in this credentialed context breaks that guarantee boundary.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/step-registry/konflux-ci/mapt-cleanup/konflux-ci-mapt-cleanup-commands.sh`
at line 14, The pipeline currently pipes a mutable personal-fork script directly
into bash via the `curl ... | bash` invocation for `delete-mapt-clusters.sh`,
exposing AWS creds to a supply-chain risk; change this to fetch an immutable
commit/tag URL (or release tarball), save the script to disk (do not pipe),
verify its integrity via checksum or GPG signature, and only then execute it;
additionally run the verified script in a separate least-privileged step or
environment (remove direct execution in the same process where AWS credentials
are exported) to eliminate credential exposure.

Source: Coding guidelines