Skip to content

fix(runtime): typed-array own-property fallback shadows secret-key buffer metadata (#4363 regression)#4399

Merged
proggeramlug merged 1 commit into
mainfrom
fix-secret-key-ta-shadow-4363
Jun 4, 2026
Merged

fix(runtime): typed-array own-property fallback shadows secret-key buffer metadata (#4363 regression)#4399
proggeramlug merged 1 commit into
mainfrom
fix-secret-key-ta-shadow-4363

Conversation

@proggeramlug
Copy link
Copy Markdown
Contributor

Summary

Main regression fix. #4363 (typed array own properties) added a typed-array own-property block at the top of js_object_get_field_by_name that, for a Uint8Array-backed buffer, return JSValue::undefined() for any key it doesn't recognize. A KeyObject's secret-key backing buffer is a Uint8Array, so its type / symmetricKeySize / asymmetricKey* metadata — resolved by the KeyObject block later in the same function — was shadowed and read back as undefined.

This is a deterministic failure on main HEAD (bisected to #4363): the unit test object::field_get_set::buffer_ic_miss_tests::secret_key_buffer_metadata_survives_ic_miss_for_aes_sizes fails, which fails the cargo-test gate on every open PR.

# on main (and #4363's parent passes):
test ...secret_key_buffer_metadata_survives_ic_miss_for_aes_sizes ... FAILED
panicked at field_get_set.rs: assertion `left == right` failed   (type read back as undefined, not "secret")

Fix

Fall through to the KeyObject metadata block for a secret-key buffer instead of returning the typed-array undefined fallback. Plain typed arrays are unchanged (still return undefined for unknown keys).

Validation

cargo test --release -p perry-runtime --lib: 979 passed, 0 failed (was 979 passed, 1 failed). The AES test passes both alone and in the full suite.

Found while diagnosing why an unrelated PR's cargo-test was red — the failure was this pre-existing main regression, not that PR.

…et-key buffer metadata

#4363 (typed array own properties) added a typed-array own-property block at
the top of js_object_get_field_by_name that, for a Uint8Array-backed buffer,
returns undefined for any key it doesn't recognize. A KeyObject's secret-key
backing buffer is a Uint8Array, so its type / symmetricKeySize / asymmetricKey*
metadata (resolved by the KeyObject block later in the same function) was
shadowed and read back as undefined — a deterministic regression that fails
the secret_key_buffer_metadata_survives_ic_miss_for_aes_sizes unit test on
main (and every PR's cargo-test).

Fix: fall through to the metadata block for a secret-key buffer instead of
returning the typed-array undefined fallback. Plain typed arrays are
unchanged (still return undefined for unknown keys).

cargo test -p perry-runtime --lib: 979 passed, 0 failed (was 1 failed).
@proggeramlug proggeramlug merged commit cd4cf03 into main Jun 4, 2026
12 of 13 checks passed
@proggeramlug proggeramlug deleted the fix-secret-key-ta-shadow-4363 branch June 4, 2026 14:12
proggeramlug added a commit that referenced this pull request Jun 4, 2026
Mark harmonyos/ink smokes continue-on-error; re-tag from main with the #4399 AES fix. See CHANGELOG v0.5.1122.
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.

1 participant