Skip to content

Commit 4bbe9f1

Browse files
dmihalcik-virtruCoopAgent
andauthored
fix(ci): DSPX-3499 skip PQC key config when platform lacks PQC support (#3594)
## Summary When the xtest workflow calls `start-up-with-containers` with `pqc-enabled: true` against an older platform ref (e.g. `v0.9.0`), the platform crashes on startup: ``` open kas-xwing-private.pem: no such file or directory ``` **Root cause:** `init-temp-keys.sh` (from the `pqc-enabled` tag) runs `go run ./service/cmd/keygen` to generate PQC key files, but older platform versions don't have that command — so the key files are never created. The action then unconditionally injects PQC keyring/cryptoProvider entries pointing to those missing files. Even if the files were somehow present, older platforms don't support `hpqt:*` key types at all. **Fix:** Guard all PQC configuration behind a `kas-xwing-private.pem` file-existence check: 1. **`test/start-up-with-containers/action.yaml`** - Split `hpqt:*` algorithms out of the `>= 0.7.1` version gate in "Map the config to the keys" — only add them to `allowed_algorithms` when the key files exist - Add an early-exit guard in "Enable PQ" step that emits a `::warning` and skips PQC config when key files are absent 2. **`test/start-additional-kas/action.yaml`** - Override `PQC_ENABLED=false` before the yq command when key files don't exist, so the `with(select(...))` block naturally skips PQC entries **Addresses:** https://github.com/opentdf/platform/actions/runs/27224175116/job/80411765728?pr=3592 ## Test plan - [ ] Re-run the xtest matrix for `v0.9.0` — platform should start successfully without PQC keys - [ ] Verify `main` (or any PQC-capable ref) still gets PQC keys configured as before - [ ] Confirm `::warning` annotation appears in the Actions log for older refs <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Enhanced automated testing workflows with improved validation checks for cryptographic key files and platform-specific algorithm compatibility, ensuring reliable test execution across deployment scenarios and reducing configuration errors. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: CoopAgent <coopagent@users.noreply.github.com>
1 parent 8d446b3 commit 4bbe9f1

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

test/start-additional-kas/action.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ runs:
145145
LOG_TYPE: ${{ inputs.log-type }}
146146
with:
147147
run: |
148+
# Disable PQC if key files weren't generated by the platform
149+
if [[ "${PQC_ENABLED}" == "true" && ! -f kas-xwing-private.pem ]]; then
150+
echo "PQC enabled but key files not found; disabling PQC for ${KAS_NAME}" 1>&2
151+
export PQC_ENABLED=false
152+
fi
148153
yq e '
149154
(.server.port = env(KAS_PORT))
150155
| (.mode = ["kas"])

test/start-up-with-containers/action.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ runs:
192192
allowed_algorithms=(ec:secp256r1 rsa:2048)
193193
if echo $PLATFORM_VERSION | awk -F. '{ if ($1 > 0 || ($1 == 0 && $2 > 7) || ($1 == 0 && $2 == 7 && $3 >= 1)) exit 0; else exit 1; }'; then
194194
# For versions 0.7.1 and later, we allow rsa:4096 ec:secp384r1 ec:secp521r1
195-
allowed_algorithms+=(rsa:4096 ec:secp384r1 ec:secp521r1 hpqt:xwing hpqt:secp256r1-mlkem768 hpqt:secp384r1-mlkem1024)
195+
allowed_algorithms+=(rsa:4096 ec:secp384r1 ec:secp521r1)
196+
fi
197+
# Only allow PQC algorithms if the platform generated PQC key files
198+
if [[ ! -f kas-xwing-private.pem ]]; then
199+
printf "PQC key files not found; skipping PQC configuration (platform may not support PQC key types)\n" 1>&2
200+
exit 0
196201
fi
197202
keyring='[{"kid":"ec1","alg":"ec:secp256r1"},{"kid":"r1","alg":"rsa:2048"}]'
198203
keys='[{"kid":"e1","alg":"ec:secp256r1","private":"kas-ec-private.pem","cert":"kas-ec-cert.pem"},{"kid":"ec1","alg":"ec:secp256r1","private":"kas-ec-private.pem","cert":"kas-ec-cert.pem"},{"kid":"r1","alg":"rsa:2048","private":"kas-private.pem","cert":"kas-cert.pem"}]'
@@ -245,6 +250,10 @@ runs:
245250
shell: bash
246251
if: ${{ inputs.pqc-enabled == 'true' }}
247252
run: |
253+
if [ ! -f kas-xwing-private.pem ]; then
254+
echo "PQC key files not found; skipping PQC configuration (platform may not support PQC key types)" 1>&2
255+
exit 0
256+
fi
248257
yq e '
249258
(.services.kas.preview.hybrid_tdf_enabled = true)
250259
| (.services.kas.keyring += [{"kid":"x1","alg":"hpqt:xwing"},{"kid":"h1","alg":"hpqt:secp256r1-mlkem768"},{"kid":"h2","alg":"hpqt:secp384r1-mlkem1024"}])

0 commit comments

Comments
 (0)