Skip to content

Gecko WebCrypto admission laxness: cross-curve EC PKCS#8, OKP crv, HMAC kty — host guards + upstream reports #357

Description

@lann

Running the conformance suites under Playwright Firefox (the jco-firefox target) surfaced three classes where Gecko's WebCrypto admits key material the spec's import steps reject (and every other engine rejects). The suite pins rejection (invalid-key), so these appeared as must-reject violations on Firefox:

  1. Cross-curve EC PKCS#8: importKey("pkcs8", <P-256 key>, { name: "ECDH"|"ECDSA", namedCurve: "P-384" }) succeeds (probe/ecdh-format-roundtrips, probe/ecdsa-private-format-imports).
  2. OKP JWK crv confusion: an X25519 JWK imports as Ed25519 and vice versa (probe/sig-public-format-imports, probe/x25519-key-contract).
  3. HMAC JWK kty: a JWK with the wrong kty mints an HMAC key (probe/jwk-rejections).

Disposition: per the portability contract's resolution ladder (strategy 2 — enhance the deficient implementation with logic, never crypto), the jco host now carries shallow fail-closed admission guards for all three, in the mold of its existing requireNamedCurveSpki/requireRsaEncryptionSpki checks: a fixed-shape PKCS#8 AlgorithmIdentifier compare, and kty/crv member checks on the parsed JWK. They can only over-reject; whatever passes still gets the platform's full validation. The conformance probes above are the vector coverage, gating on every engine leg.

Remaining work this issue tracks:

  • Report the three Gecko behaviors upstream (Bugzilla), link the reports here.
  • When Gecko fixes land in the Playwright pin, consider whether the guards stay (they are cheap and uniform; likely yes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions