Skip to content

Commit 4cc20bc

Browse files
committed
fix: set LC_ALL=C.UTF-8 for crypto scanner container
The scanner container inherits the host locale, which can default to ASCII and cause opengrep to fail with UnicodeDecodeError. Pass LC_ALL=C.UTF-8 to podman run to ensure UTF-8 decoding. Also guard the CBOM commit in rebase.sh behind the scan's exit status so we only commit when the scan actually succeeds.
1 parent 3aab804 commit 4cc20bc

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎scripts/auto-rebase/crypto_scan.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ cp -a "${REPOROOT}/etcd/cmd" "${SCAN_DIR}/etcd-cmd"
6666
cp -a "${REPOROOT}/etcd/vendor" "${SCAN_DIR}/etcd-deps"
6767

6868
if ! podman run --rm \
69+
-e LC_ALL=C.UTF-8 \
6970
-v "${SCAN_DIR}:/workspace:z" \
7071
"${SCANNER_IMAGE}" \
7172
/workspace > "${CBOM_OUTPUT}"; then

‎scripts/auto-rebase/rebase.sh‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,14 +1341,15 @@ rebase_to() {
13411341
# Generate CBOM (Cryptographic Bill of Materials)
13421342
if [[ "${SKIP_CRYPTOSCAN:-}" != "true" ]]; then
13431343
title "## Generating CBOM (Cryptographic Bill of Materials)"
1344-
./scripts/auto-rebase/crypto_scan.sh
1345-
if [[ -n "$(git status -s cbom-microshift.json sbom-microshift-crypto.spdx.json)" ]]; then
1346-
echo "Updating CBOM"
1347-
git add cbom-microshift.json sbom-microshift-crypto.spdx.json
1348-
git commit -m "update cbom"
1349-
else
1350-
echo "No changes to CBOM."
1351-
fi
1344+
if ./scripts/auto-rebase/crypto_scan.sh; then
1345+
if [[ -n "$(git status -s cbom-microshift.json sbom-microshift-crypto.spdx.json)" ]]; then
1346+
echo "Updating CBOM"
1347+
git add cbom-microshift.json sbom-microshift-crypto.spdx.json
1348+
git commit -m "update cbom"
1349+
else
1350+
echo "No changes to CBOM."
1351+
fi
1352+
fi
13521353
fi
13531354

13541355
title "# Removing staging directory"

0 commit comments

Comments
 (0)