Skip to content

fix(model): ImposterDefinition.read throws on "ca": null (rift#1576 / Mountebank exports) - #347

Merged
EtaCassiopeia merged 1 commit into
masterfrom
fix/rift-341-ca-null
Oct 27, 2026
Merged

EtaCassiopeia merged 1 commit into
masterfrom
fix/rift-341-ca-null

Conversation

@EtaCassiopeia

Copy link
Copy Markdown
Collaborator

rift 0.24.0 prints "ca": null on every view and ?replayable=true export of an https imposter without a CA (rift#1576), as Mountebank 2.9.5 already does. ImposterDefinition.read handed that JSON null to CaCertificates.read, which threw WireFormatException. So on the pinned engine, Imposter.definition(), StubRef stub reads and recordings of every https imposter failed, as did ImposterDefinitions.fromJson on such an export.

Change

  • A JSON-null ca reads as absent and is not written back. Null and absent decode the same in the engine (TlsHeader.ca is an Option). A non-null ca of the wrong type is still refused.
  • ciphers stays unmodeled and passes through extra unchanged. The engine keeps it but doesn't apply it.
  • ImposterDefinition Javadoc documents both. There's no CHANGELOG in this repo.

Tests

  • ImposterClientAuthModelTest (+4): a verbatim rift 0.24.0 https export reads with ca absent and ciphers in extra, and writes back with no ca key; a whole multi-imposter export parses; "ca": 5 is still refused. Before the fix, all but the last threw WireFormat ca: expected a JSON array, got null.
  • ImposterClientAuthIT: definition() of a live https imposter, on both lanes.

Verification (local, JDK 21, rift 0.24.0)

  • rift-java-core: 1011 tests green.
  • Spawn conformance: 190 run, 0 failed. Embedded ImposterClientAuthIT: green.

Downstream: none required. rift-scala gets this through rift-java; rift-go and rift-node don't model ca.

Closes #341

🤖 Generated with Claude Code

rift 0.24.0 and Mountebank print "ca": null on an https imposter without one
(rift#1576). ImposterDefinition.read passed that JSON null to
CaCertificates.read, which wanted an array, so definition(), stub reads and
recordings of every https imposter threw WireFormatException on the pinned
engine. A null ca now reads as absent and is not written back; null and
absent decode the same in the engine. A ca of any other wrong type is still
refused, and ciphers keeps riding extra unchanged.

Closes #341
@EtaCassiopeia
EtaCassiopeia merged commit dd8c169 into master Oct 27, 2026
16 checks passed
@EtaCassiopeia
EtaCassiopeia deleted the fix/rift-341-ca-null branch October 27, 2026 14:50
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.

fix(model): ImposterDefinition.read throws on "ca": null (rift#1576 / Mountebank exports)

1 participant