Skip to content

test(vscode_payload): random AES keys and nonces - #184

Merged
isc-tdyar merged 1 commit into
intersystems-community:masterfrom
isc-fschwich:fix/codeql-test-keys
Nov 5, 2026
Merged

isc-tdyar merged 1 commit into
intersystems-community:masterfrom
isc-fschwich:fix/codeql-test-keys

Conversation

@isc-fschwich

Copy link
Copy Markdown
Contributor

Fixes the two critical CodeQL alerts that the Dependabot roll-up (#180) raised. Both are "hard-coded cryptographic value", on the AES key and nonce constants in tests/unit/test_vscode_payload.rs.

Why the alerts appeared now

  • The constants ([7u8; 32], [3u8; 12]) have been in the test for a long time.
  • In chore(deps): Dependabot roll-up #180, aes-gcm 0.11 deprecated from_slice, so the test helper switched to From. CodeQL follows From from the constant into the cipher.
  • They're test fixtures and nothing ships with them. The fix is still cheap, and it keeps CodeQL scanning the test code for everything else.

The fix

  • Every test seals and opens with the same key, so the actual value never mattered.
  • The key and nonce now come from the OS once per run.
  • The wrong-key test draws its own key and asserts that it differs.
  • getrandom 0.4 is now a dev-dependency of the core crate. It was already in Cargo.lock through uuid, so no crate is added.

Checks

  • clippy -D warnings, with and without testing, and fmt are clean.
  • The 24 safeStorage payload tests pass.
  • cargo deny is clean.
  • The agent and git gates pass.

CodeQL flags the fixed test key and nonce as hard-coded cryptographic values. Since the Dependabot roll-up (intersystems-community#180) the test helper builds keys with From instead of from_slice, and CodeQL follows those into the cipher. Every test seals and opens with the same key, so the value never mattered: the key and nonce now come from the OS once per run, and the wrong-key test draws its own and asserts it differs. getrandom 0.4 is a dev-dependency here; it was already in Cargo.lock through uuid.

@isc-tdyar isc-tdyar left a comment

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.

Approved. Random key and nonce per run; clears the CodeQL fixture alerts.

@isc-tdyar
isc-tdyar merged commit 103edbc into intersystems-community:master Nov 5, 2026
22 checks 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.

2 participants