Repository navigation
fix(model): ImposterDefinition.read throws on "ca": null (rift#1576 / Mountebank exports) - #347
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rift 0.24.0 prints
"ca": nullon every view and?replayable=trueexport of an https imposter without a CA (rift#1576), as Mountebank 2.9.5 already does.ImposterDefinition.readhanded that JSON null toCaCertificates.read, which threwWireFormatException. So on the pinned engine,Imposter.definition(), StubRef stub reads and recordings of every https imposter failed, as didImposterDefinitions.fromJsonon such an export.Change
careads as absent and is not written back. Null and absent decode the same in the engine (TlsHeader.cais anOption). A non-nullcaof the wrong type is still refused.ciphersstays unmodeled and passes throughextraunchanged. The engine keeps it but doesn't apply it.ImposterDefinitionJavadoc documents both. There's no CHANGELOG in this repo.Tests
ImposterClientAuthModelTest(+4): a verbatim rift 0.24.0 https export reads withcaabsent andciphersinextra, and writes back with nocakey; a whole multi-imposter export parses;"ca": 5is still refused. Before the fix, all but the last threwWireFormat 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.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