Skip to content
Merged
Show file tree
Hide file tree
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 @@ -49,5 +49,9 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi

if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi
Comment on lines +53 to +55

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 | 🟠 Major

Preserve the runner status while collecting the PDF.

All twelve wrappers can skip PDF collection when the chaos runner fails because errexit terminates the script first. kubevirt-outage also overwrites its captured failure status.

  • ci-operator/step-registry/redhat-chaos/application-outages/console/redhat-chaos-application-outages-console-commands.sh#L53-L55: capture the runner status with || rc=$?, collect artifacts, then exit with rc.
  • ci-operator/step-registry/redhat-chaos/container-scenarios/etcd-hangup/redhat-chaos-container-scenarios-etcd-hangup-commands.sh#L49-L51: capture the runner status before artifact collection.
  • ci-operator/step-registry/redhat-chaos/hog-scenarios/io/redhat-chaos-hog-scenarios-io-commands.sh#L50-L52: capture the runner status before artifact collection.
  • ci-operator/step-registry/redhat-chaos/kubevirt-outage/redhat-chaos-kubevirt-outage-commands.sh#L78-L80: remove the later rc=$? that resets the failure status.
  • ci-operator/step-registry/redhat-chaos/network-chaos/redhat-chaos-network-chaos-commands.sh#L49-L51: capture the runner status before artifact collection.
  • ci-operator/step-registry/redhat-chaos/node-disruptions/master-outage/redhat-chaos-node-disruptions-master-outage-commands.sh#L113-L115: capture the runner status before artifact collection.
  • ci-operator/step-registry/redhat-chaos/pod-scenarios/etcd-disruption/redhat-chaos-pod-scenarios-etcd-disruption-commands.sh#L74-L76: capture the runner status before artifact collection.
  • ci-operator/step-registry/redhat-chaos/power-outage/redhat-chaos-power-outage-commands.sh#L94-L96: capture the runner status before artifact collection.
  • ci-operator/step-registry/redhat-chaos/service-disruption/redhat-chaos-service-disruption-commands.sh#L48-L50: capture the runner status before artifact collection.
  • ci-operator/step-registry/redhat-chaos/syn-flood/redhat-chaos-syn-flood-commands.sh#L48-L50: capture the runner status before artifact collection.
  • ci-operator/step-registry/redhat-chaos/time-scenarios/redhat-chaos-time-scenarios-commands.sh#L51-L53: capture the runner status before artifact collection.
  • ci-operator/step-registry/redhat-chaos/zone-outage/redhat-chaos-zone-outage-commands.sh#L82-L84: capture the runner status before artifact collection.
🧰 Tools
🪛 ast-grep (0.45.0)

[warning] 53-53: Writing to or reading from a hardcoded, predictable path under /tmp is vulnerable to symlink and TOCTOU attacks: a local attacker can pre-create the file (or a symlink pointing elsewhere) and hijack or corrupt the contents. Generate a unique, unpredictable temporary file with mktemp instead, e.g. tmpfile="$(mktemp)" (or mktemp -d for directories) and reference "$tmpfile".
Context: /tmp/report.out.pdf
Note: [CWE-377] Insecure Temporary File.

(predictable-tmp-file-bash)

🪛 Shellcheck (0.11.0)

[info] 54-54: Double quote to prevent globbing and word splitting.

(SC2086)

📍 Affects 12 files
  • ci-operator/step-registry/redhat-chaos/application-outages/console/redhat-chaos-application-outages-console-commands.sh#L53-L55 (this comment)
  • ci-operator/step-registry/redhat-chaos/container-scenarios/etcd-hangup/redhat-chaos-container-scenarios-etcd-hangup-commands.sh#L49-L51
  • ci-operator/step-registry/redhat-chaos/hog-scenarios/io/redhat-chaos-hog-scenarios-io-commands.sh#L50-L52
  • ci-operator/step-registry/redhat-chaos/kubevirt-outage/redhat-chaos-kubevirt-outage-commands.sh#L78-L80
  • ci-operator/step-registry/redhat-chaos/network-chaos/redhat-chaos-network-chaos-commands.sh#L49-L51
  • ci-operator/step-registry/redhat-chaos/node-disruptions/master-outage/redhat-chaos-node-disruptions-master-outage-commands.sh#L113-L115
  • ci-operator/step-registry/redhat-chaos/pod-scenarios/etcd-disruption/redhat-chaos-pod-scenarios-etcd-disruption-commands.sh#L74-L76
  • ci-operator/step-registry/redhat-chaos/power-outage/redhat-chaos-power-outage-commands.sh#L94-L96
  • ci-operator/step-registry/redhat-chaos/service-disruption/redhat-chaos-service-disruption-commands.sh#L48-L50
  • ci-operator/step-registry/redhat-chaos/syn-flood/redhat-chaos-syn-flood-commands.sh#L48-L50
  • ci-operator/step-registry/redhat-chaos/time-scenarios/redhat-chaos-time-scenarios-commands.sh#L51-L53
  • ci-operator/step-registry/redhat-chaos/zone-outage/redhat-chaos-zone-outage-commands.sh#L82-L84
🤖 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/redhat-chaos/application-outages/console/redhat-chaos-application-outages-console-commands.sh`
around lines 53 - 55, Preserve the chaos runner exit status while collecting PDF
artifacts in all wrappers: in
ci-operator/step-registry/redhat-chaos/application-outages/console/redhat-chaos-application-outages-console-commands.sh
(53-55),
container-scenarios/etcd-hangup/redhat-chaos-container-scenarios-etcd-hangup-commands.sh
(49-51), hog-scenarios/io/redhat-chaos-hog-scenarios-io-commands.sh (50-52),
network-chaos/redhat-chaos-network-chaos-commands.sh (49-51),
node-disruptions/master-outage/redhat-chaos-node-disruptions-master-outage-commands.sh
(113-115),
pod-scenarios/etcd-disruption/redhat-chaos-pod-scenarios-etcd-disruption-commands.sh
(74-76), power-outage/redhat-chaos-power-outage-commands.sh (94-96),
service-disruption/redhat-chaos-service-disruption-commands.sh (48-50),
syn-flood/redhat-chaos-syn-flood-commands.sh (48-50),
time-scenarios/redhat-chaos-time-scenarios-commands.sh (51-53), and
zone-outage/redhat-chaos-zone-outage-commands.sh (82-84), capture the runner
failure with `|| rc=$?`, collect artifacts, then exit with rc; in
kubevirt-outage/redhat-chaos-kubevirt-outage-commands.sh (78-80), remove the
later rc=$? assignment so the captured failure is not overwritten.

echo "Finished running application outages scenarios"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,10 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi

if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi

echo "Finished running container scenarios"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,10 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi
Comment on lines +49 to +51

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.

🩺 Stability & Availability | 🟠 Major

Preserve report collection on runner failure.

errexit prevents all three copy blocks from running when prow_run.sh fails. Capture the runner status, copy the report, and restore the runner status with exit "$rc".

  • ci-operator/step-registry/redhat-chaos/hog-scenarios/cpu/redhat-chaos-hog-scenarios-cpu-commands.sh#L49-L51: Apply the failure-safe runner sequence.
  • ci-operator/step-registry/redhat-chaos/hog-scenarios/memory/redhat-chaos-hog-scenarios-memory-commands.sh#L51-L53: Apply the failure-safe runner sequence.
  • ci-operator/step-registry/redhat-chaos/pod-network-chaos/redhat-chaos-pod-network-chaos-commands.sh#L50-L52: Apply the failure-safe runner sequence.
🧰 Tools
🪛 ast-grep (0.45.0)

[warning] 49-49: Writing to or reading from a hardcoded, predictable path under /tmp is vulnerable to symlink and TOCTOU attacks: a local attacker can pre-create the file (or a symlink pointing elsewhere) and hijack or corrupt the contents. Generate a unique, unpredictable temporary file with mktemp instead, e.g. tmpfile="$(mktemp)" (or mktemp -d for directories) and reference "$tmpfile".
Context: /tmp/report.out.pdf
Note: [CWE-377] Insecure Temporary File.

(predictable-tmp-file-bash)

🪛 Shellcheck (0.11.0)

[info] 50-50: Double quote to prevent globbing and word splitting.

(SC2086)

📍 Affects 3 files
  • ci-operator/step-registry/redhat-chaos/hog-scenarios/cpu/redhat-chaos-hog-scenarios-cpu-commands.sh#L49-L51 (this comment)
  • ci-operator/step-registry/redhat-chaos/hog-scenarios/memory/redhat-chaos-hog-scenarios-memory-commands.sh#L51-L53
  • ci-operator/step-registry/redhat-chaos/pod-network-chaos/redhat-chaos-pod-network-chaos-commands.sh#L50-L52
🤖 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/redhat-chaos/hog-scenarios/cpu/redhat-chaos-hog-scenarios-cpu-commands.sh`
around lines 49 - 51, Preserve report collection when prow_run.sh fails by
applying the failure-safe runner sequence in
ci-operator/step-registry/redhat-chaos/hog-scenarios/cpu/redhat-chaos-hog-scenarios-cpu-commands.sh:49-51,
ci-operator/step-registry/redhat-chaos/hog-scenarios/memory/redhat-chaos-hog-scenarios-memory-commands.sh:51-53,
and
ci-operator/step-registry/redhat-chaos/pod-network-chaos/redhat-chaos-pod-network-chaos-commands.sh:50-52:
capture the runner return status without triggering errexit, execute all
report-copy blocks, then exit with the captured status via exit "$rc".

echo "Finished running memory hog scenario"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,10 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi
echo "Finished running io hog scenario"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi

echo "Finished running memory hog scenario"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,10 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi
echo "Finished running kubevirt outage chaos disruption"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,10 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi
echo "Finished running network chaos"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,10 @@ if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi

echo "Finished running node disruptions"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,10 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi
echo "Finished running pod-network chaos"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,10 @@ if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi

echo "Return code: $rc"
exit $rc
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,10 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi
echo "Finished running power outages"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi
echo "Done running the test!"
echo "Return code: $rc"
exit $rc
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@ rc=$?
if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi
echo "Finished running syn-flood chaos"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,10 @@ if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi

echo "Finished running time scenario"
echo "Return code: $rc"
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,10 @@ if [[ $TELEMETRY_EVENTS_BACKUP == "True" ]]; then
cp /tmp/events.json ${ARTIFACT_DIR}/events.json
fi


if [[ -f /tmp/report.out.pdf ]]; then
cp /tmp/report.out.pdf ${ARTIFACT_DIR}/kraken.report.pdf
fi

echo "Finished running zone outages"
echo "Return code: $rc"