Repository navigation
0.1.3 - 2026-11-18
Breaking changes
-
Upgrade dependencies, including the public foldhash 0.2, hashbrown 0.17 and jiff 1.0 integrations. Downstream code naming those external types must use these compatibility lines.
-
Require Rust 1.100 for every feature, pin development and release tooling to Rust 1.100.0, and verify Cargo lockfile format 4 during package validation.
-
Messages selected for cleanup (
generate_zeroize(true)/zeroize=true, orzeroize_in), and the messages that contain them in the same generation step, no longer get a generatedFooOwnedViewwrapper orHasMessageViewimpl, as if they were also listed inborrowed_views_only_in. The wrapper'sfrom_ownedencoded the guarded message into ordinary, clonableBytesthat were never wiped. This also removesTimestampOwnedView,DurationOwnedView,ValueOwnedView,StructOwnedViewandListValueOwnedViewfrombuffa_types::sensitive. To migrate, replaceFooOwnedView::decode(bytes)withbuffa::sensitive::GuardedOwnedView::<FooView<'static>>::decode(&bytes, &options)(orfrom_owned(&message, &options)), which returnsGuardedViewError, and read fields throughowner.view().field; the guarded owner is notClone, does not hand outBytes, and implements no JSON itself, so serializeowner.view()instead. Code that deliberately accepts unwiped backing storage can still usebuffa::OwnedView::<FooView<'static>>. Generic code bounded onHasMessageView, such as RPC transport glue, no longer accepts these messages. A message whose guarded child is only selected in another generation step, or is an imported guarded type such asbuffa_types::sensitive::Timestamp, keeps its wrapper unless you also select it withborrowed_views_only_in.
Added
-
Add opt-in, descriptor-checked native adapter generation through typed protobuf options, Rust configuration and bounded manifests. Closed selectors reject unspecified and unknown values, preserve explicit normalization and external registrations, and provide checked conversions. Payload selectors and borrowed byte/capability adapters preserve native signatures without changing portable generation.
-
DecodeOptions::clears_on_merge_errorreports whetherclear_on_merge_erroris set. The additivewith_clear_on_merge_error(bool)setter can enable or disable the policy, including on a cloned configuration. Documentation distinguishes logical clearing, memory wiping, and input-buffer consumption. -
buffa_codegen::plugin_response_metadata()returns aCodeGeneratorResponsecarrying buffa's supported plugin features and theEDITION_PROTO2toEDITION_2024edition range. Plugins built on buffa-codegen can merge it into each success and error response with..plugin_response_metadata(); both generator binaries build their responses from it. -
json_helpers::bytes::decode_intoandbytes::max_decoded_lendecode a base64 string once into a buffer the caller provides, without allocating and accepting exactly whatbytes::deserializeaccepts, so aProtoBytesJsonpolicy can keep decoded bytes only in storage it wipes. A failure reports a fixed message ("invalid base64" or "base64 output buffer too small") and never quotes a symbol or offset from the input.
Changed
-
Remove unused pbjson-types from the Prost benchmark and stop forcing the optional chrono feature through buffa-test. The buffa-types Chrono conversion API and its explicit-feature test coverage remain available.
-
DecodeContextrecords where the message being decoded ends. The defaultMessage::merge_to_limit,Message::merge_length_delimitedand the length-delimited decode entry points record it through the newDecodeContext::with_message_end, whose argument is the number of bytes that follow the message (the samelimitthatmerge_to_limittakes), not the message's length. Hand-written code that decodes a different buffer, such as a copy or a decompressed payload, with a context it was given must callwith_message_end(0)for a buffer that holds exactly the message, or start that buffer withMessage::merge; otherwise a valid nested field near its end can be rejected withDecodeError::UnexpectedEof. Amerge_to_limitoverride should record itslimitthe same way. A directmerge_to_limitcaller can now getUnexpectedEofwhere it previously gotOkwith the buffer past its limit. -
json_helpers::bytesstreams base64 output and decodes URL-safe input once.bytes::serializewrites the encoding throughSerializer::collect_strinstead of building a heapStringof the encoded length first; the output is unchanged forserde_jsonand for any serializer whosecollect_strmatches itsserialize_str. Decoding picks the standard or URL-safe alphabet from the first symbol only one of them has and decodes once, where URL-safe input was previously decoded with the standard alphabet first and then decoded again. Accepted inputs and decoded bytes are unchanged; the error text for invalid input that contains-or_can differ. -
buffa-yamldecodes string and container positions by the kind of the YAML scalar. Following the wrong-kind diagnostics change, these positions now read the input kind as ProtoJSON does. A YAML number or bool is no longer read as text in anoptional, repeated, map or oneof string position or as aTimestamp,DurationorFieldMask, matching singular string fields; quote such scalars ("1.0"). An empty item or map value (-followed by a space, orkey:) is now null, so it is rejected as a repeated string, aFieldMask,Struct,ListValueorEmpty, or a message with a customDeserialize(a oneof or extension range) in an element or map-value position, where it previously decoded as an empty value. An empty or comment-only YAML document still decodes as the default message,Struct,ListValueorEmpty, through generated types and throughDynamicMessageSeed. Explicit empty documents (---) are rejected at structural roots. -
Execute guarded cleanup regression tests in actual wasm32-unknown-unknown modules on Node.js, in debug and optimized release builds. A pre-release allocation observer and deliberate residue controls cover vector slots, guarded collection growth and iteration, sensitive WKT strings and replacement, and map decode-error cleanup without changing application APIs.
-
Clarify the ordinary Struct cleanup guarantee and the compatibility decision to retain its public HashMap field. Add pre-deallocation regression observations for current key and nested String buffers, including spare capacity, with ordinary destruction as a negative control. Vacated table storage and previously released ordinary allocations remain outside the guarantee; secret-bearing trees require guarded ownership from ingestion. No runtime API or cleanup behavior changes.
-
Serialize guarded dynamic WKT views without constructing another owned payload tree. Preserve sorted object keys, last-duplicate semantics, representation JSON policies, diagnostics, and partial output on failure. Lazy lists validate all deferred wire children before writing and re-decode one child at a time to preserve error priority without retaining an aggregate decoded tree. Focused compatibility and allocation regressions cover eager, lazy, and owned view export.
-
Advance compatible dependency patches for bytes 1.12.2, Jiff 1.0.1, smallvec 1.16.6, zeroize 1.9.2 and the regex family across workspace and standalone lockfiles. Remove the unused normal fuzz dependency on the build-time generator, retaining its build dependency. Keep feature selections, the 0.1.3 crate family and Rust 1.100 support unchanged; retain the explicit full-capacity vector cleanup around the upgraded zeroization backend.
Fixed
-
buffa_descriptor::reflect::DynamicMessage::merge_with_optionsnow honoursDecodeOptions::clear_on_merge_error. Previously the option was silently ignored, so a failed merge, including an input over the size limit, left old and partially merged fields behind; the message is now reset to empty and keeps its descriptor. The dropped values are not wiped.DynamicMessage::mergealways uses the default options, so it never clears. -
DecodeOptions::reject_unknown_fields()now reachesDynamicMessagemap entries: an unknown field inside a map entry, and an unknown closed-enum map value that a later known value replaces, are rejected as the generated decoders reject them. Under the default options these entries still decode, and an entry that ends with an unknown closed-enum value is still preserved as an unknown field. -
A crate that hand-wrote
impl ReflectElementorimpl InspectElementfor an enum it generates must remove that impl, since codegen now emits it (a duplicate fails with E0119). Generated enums getReflectElementwhenever reflection is on, andInspectElementwhenever a cleanup generation has reflection on, whatever the enum's openness and the reflection mode. A generation that reaches an enum throughextern_pathand resolves it as closed, while its owner opened it with anopen_enums_inrule or uses bridge reflection, types repeated and map-value fields as the bare enum and previously failed to compile. Regenerate the crate that owns the enum with this release. If you cannot regenerate the owning crate, add anopen_enums_inrule for the enum to the referencing generation, so that its fields useEnumValue<E>; this also keeps unknown enum values instead of treating them as unknown fields. -
protoc-gen-reallyme-buffa-packagingerror responses now carry the advertised edition range as well as the supported features, so Buf reports the plugin's own configuration error instead of a protocol error about missing edition metadata. -
A custom bytes, string or repeated field type that is not a Rust type path, such as
_,(),[u8; 4],&'static [u8],impl Trait, is now rejected at generation time withCodeGenError::InvalidTypePath, which the plugin returns in its response. Previously it was spliced into the generated struct and failed only when the consumer crate compiled. Associated-type projections such as<A as Trait>::Band parenthesized type paths remain supported, including equivalent spelling normalization for JSON policies. Name any other type through a type alias. -
The warning for a custom field-type rule that matched no field reads the same from the plugin and from
buffa-build: it names the rule's kind and the option names instead of the internalCodeGenConfiglist, and says that only the files of the current run are checked. For a rule that names an extension field it now says that custom field-type rules do not apply to extensions, which keep their default Rust type, through the newnames_extensionfield ofCodeGenWarning::FieldTypeRuleMatchedNothing. -
A custom bytes or string field, sub-message or map entry whose declared length runs past the message that holds it is now rejected with
DecodeError::UnexpectedEofbefore it is decoded. Previously the length was checked only against the rest of the input, so adecode_length_delimitedoverride (including the guardedSecretStringand the guarded WKTs) could be handed the parent's following fields or later frames of a stream, a failed merge could keep those bytes in the field, andmax_message_sizedid not bound the window. Generated code now decodes custom string and bytes fields through the newdecode_string_to_ctxanddecode_bytes_to_ctx; code generated by an earlier release keeps the old bound for those fields until it is regenerated, so regenerate all schemas with this release. -
The
ProtoBytesJsondocs no longer suggest thatjson_helpers::bytes::deserializekeeps decoded bytes under the policy's control. It decodes into aVec<u8>that buffa allocates, drops a partly decoded buffer without wiping it on invalid input, and its error text can quote a symbol and offset from the input. A policy whosedeserialize_jsoncallsbytes::deserializeand that must wipe its plaintext should switch to a visitor that decodes with the newbytes::decode_intointo storage it wipes, as the guarded fixture inbuffa-testdoes. The docs now also list the copies no policy controls: the caller's serializer output,serde_json's scratch buffer for escaped strings andfrom_reader, andgoogle.protobuf.Anybuffering throughserde_json::Value. -
A
json_policy_typefrom another crate now works inrepeatedfields andmapvalues, and separate generation runs no longer emit conflicting impls for it. Generated code implementedProtoElemJsonfor every listed policy type used as arepeatedelement ormapvalue, which the orphan rule rejects (E0117) for a type defined in another crate, and which two runs into one crate (buf's per-directory strategy, or severalcompile()calls) each emitted (E0119); the only way out wascustom_type_impls=falsewith a hand-writtenProtoElemJsonin the type's own crate. Those fields now go through new hidden buffa with-modules that wrap the element in a buffa-owned adapter and call the policy directly, so no JSON trait impl is generated or needed for a listed type. A guarded message'ssensitive::List,sensitive::Mapor custom collection still receives each decoded element directly, and a map key whose value fails is still erased. Vtable reflection, or reflection with message cleanup, still emits per-element impls, so there the type must stay crate-local or be supplied withcustom_type_impls=false. A hand-writtenProtoElemJsonfor a listed type is no longer called by generated code and can be removed; if it did not delegate to the type's policy, those fields' JSON now follows the policy. Errors for these fields no longer quote the input: a bad integer orboolmap key reportsinvalid protobuf map key, and a bad base64 map keyinvalid base64. -
The
ProtoStringJsondocs now state that a policy used formapkeys must round-trip, and so be injective. Runtime behaviour is unchanged: a key policy that maps two keys to one string has always produced a JSON object with a repeated key, whose import keeps only the last entry and silently loses the others, and a key that does not round-trip comes back altered or fails to import. Buffa does not check either property, so review any key policy that normalizes text (for example by changing case). The contract also states more precisely that a deserialized value must carry no state beyond the bytes or text it represents. -
The JSON policy docs no longer claim that a policy governs every JSON use of a type, and codegen now warns that reflection bypasses policies. A
ProtoBytesJson/ProtoStringJsonpolicy is consulted only by the generated serde impls.DynamicMessage::try_from_messageworks on any generated message, with or without generated reflection and including messages in the cleanup profile, andDynamicMessageJSON (liketo_dynamicon a reflected message) prints a policy field as standard base64 or a plain string without calling the policy, so a policy that refuses export does not stop it and its import checks do not run; binary encoding and text format never call it either. A policy is therefore not a confidentiality boundary: keep reflective JSON, text and binary output of these messages away from sinks that must not see the values. The trait docs,json_policy_typedocs, the guide anddocs/guarded-fields.mdnow say so, and generating policy fields while JSON and reflection are both enabled producesCodeGenWarning::JsonPolicyReflectionBypass, naming the selected policy types in sorted, deduplicated order, printed bybuffa-buildas acargo:warningand by the plugin on stderr.buffa-buildand the plugin always print it, once per generation run that selects policy fields; unused rules do not warn. It is a reminder rather than a check: without reflection there is no warning, but the bypass remains. -
Preserve supported caller Serde defaults and input skips, including conditional attributes, when messages opt into cleanup. Reject unsupported input customizations with a fixed typed configuration error. Wipe transferred numeric JSON strings before release on both successful conversion and rejection without copying borrowed input.
-
Reject ordinary repeated enum null elements in both JSON modes across Vec, custom and guarded collections. Preserve the explicit NullValue exception for older generated consumers using the updated canonical WKT provider through a defaulted Enumeration marker. Repeated NullValue output changes from the old enum-name spelling to canonical null in owned and borrowed JSON; nonzero unknown numbers remain numeric. Scalar, optional, map and non-human-readable serialization retain their existing behavior. External NullValue providers require regeneration or an explicit marker override, and newly generated canonical providers require the matching runtime.
-
Keep custom string and bytes decode windows bounded after a delegated conversion fails, so recovery cannot expose following fields. Reject length prefixes that cross the enclosing message boundary even for empty payloads, while retaining valid in-frame empty values and supported noncanonical prefixes. JSON policy container tests use the runtime-selected map type with default features disabled, preserving custom-list coverage.
-
Keep shared JSON rejection visitors hygienic in downstream crates and accept 128-bit visits when the value fits the existing 64-bit integer boundary. Wider rejected integers remain redacted, and rejected owned strings and bytes retain their opt-in wiping behavior.
-
Enable std for the opt-in WKT and descriptor arbitrary features, as their generated derives require. Add isolated native and Wasm checks, including the guarded WKT combination, while retaining ordinary no_std coverage on bare-metal ARM. The feature-check script selects the repository's toolchain and configuration when called from another directory.
-
Reject reserved Windows device stems in native adapter output filenames on every host, using the existing InvalidOutput reason. Cover case variants and numbered COM/LPT ports across closed, payload and borrowed adapters while preserving ordinary filenames and default generation.
-
Allow guarded repeated children without Debug, including cleanup-selected messages with skip_debug. The list's own Debug implementation is always redacted and requires no element Debug; remove the unnecessary ProtoList bound without changing cloning, equality, ownership or cleanup. Verify owned, eager/lazy borrowed and JSON round trips, malformed input rejection and explicit cleanup, and synchronize custom-representation builder documentation.
Security
-
Wipe transferred enum JSON tokens and current lazy-view reference allocations, support borrowed inspection of standard owned text/bytes, and qualify generated cleanup constructors against consumer names. Wipe discarded reflective scalar/enum tokens and temporal parser scratch under optional cleanup, while preserving accepted ordinary string ownership.
-
Keep cleanup oneof/optional setters and binary codecs independent of consumer
Somehelpers. Reject hand-written closed NullValue markers that do not define numeric zero, including in lenient JSON mode. -
Preserve full guarded-list allocation cleanup after upgrading zeroize: erase vacated element storage after destructors run, including inactive enum payloads. Verify both explicit clearing and destruction with allocator observations.
-
Wipe the vacated element slots when zeroizing
UnknownFieldsandbuffa-typesListValue. Since zeroize 1.9.1,Vec::zeroizeno longer overwrites an element's storage after its destructor runs, so unknown-field wire types, payload buffer pointers and capacities,Valuekind tags and padding stayed in the retained buffer until it was reused or freed. Consumers of 0.1.2 whose lockfile resolved zeroize 1.9.1 are affected and should upgrade.Structentries are still moved out of their hash table without wiping the vacated buckets, which remains a best-effort limitation. -
Omit wrong-kind values from ProtoJSON decoding diagnostics. A JSON value of the wrong kind (for example a string where a bool, number, object or array is expected, or a 128-bit integer from a non-JSON deserializer) is now rejected with an error that names the JSON kind but not the value at these positions: bool and string fields, including
optional, repeated and map positions and oneof variants; the scalar, bytes and container helpers injson_helpers, includingproto_listand theenum_listhelpers; a generated message with a customDeserialize(a oneof, an extension range or cleanup selection), including the descriptor types inbuffa-descriptor;BoolValueandStringValue;Timestamp,DurationandFieldMask;Struct,ListValue,EmptyandValue; and the same positions inDynamicMessage's JSON codec. A rejected owned string or byte buffer is wiped first under buffa'szeroizefeature.
Generatedoptional boolandoptional stringfields now use the newjson_helpers::opt_boolandjson_helpers::opt_stringmodules, repeated and map fields of bool and defaultStringvalues useproto_seq(orproto_listfor a custom collection),proto_mapandproto_str_key_map, and oneof bool and string variants deserialize throughproto_boolandproto_string. Anoptionalfield of a customstring_typetherefore no longer needsserdeimpls, and a oneof variant needsSerializeonly; neither runs the type's ownDeserializeany more. Code generated by this release requires thebuffaruntime of the same release; regenerate existing bindings to pick up the changes.
Generated messages with a customDeserialize,Struct,ListValue,Empty,Timestamp,DurationandFieldMaskask a human-readable deserializer for any kind so that the visitor sees the token; other deserializers keep the typed request. The int32, uint32, int64, uint64, float, double and bytes helpers now read a 128-bit integer that fits in 64 bits as the 64-bit value it holds and reject a wider one with their fixed reason;Valueand reflective numeric visitors likewise accept values inside their existing 64-bit boundary and redact wider rejections.
Accepted JSON is unchanged, except that an object member named$serde_json::private::Number(the form in whichserde_json'sarbitrary_precisionfeature delivers a number) is now rejected as a number by these message types and byEmpty, even where unknown fields are otherwise ignored. The diagnostic for anullelement or map value is unchanged.
Still outside this change: a message with a derivedDeserializegiven a non-object, sinceserde_jsonformats the value before Buffa code runs; an element or map value of such a message type; a repeated message field given a non-array and amap<string, Message>field given a non-object;Anygiven a non-object; customstring_typeelements in repeated and map fields, which keep their ownserdeimpls; and the element visitors ofproto_enum,closed_enumand the guarded enum helpers for 128-bit integers and bytes from non-JSON deserializers. -
Omit the path from
FieldMaskJSON diagnostics. The generatedFieldMaskquoted a rejected path in its JSON errors. A malformed path in JSON input is now reported asinvalid FieldMask path, expected comma-separated lowerCamelCase paths, and a path with no JSON form (for example one decoded from binary input) is reported on output asinvalid FieldMask path, it has no proto3 JSON representation, by the generatedFieldMask, its view andDynamicMessage's JSON codec alike. Accepted paths are unchanged. -
Integrate guarded-field and owned-view cleanup hardening with fixed JSON diagnostics. Preserve reviewed custom Serde, binary-format, and legal JSON-name compatibility; guarded messages with the reserved arbitrary-precision JSON name redact failures at their typed parser boundary.
-
Apply the same Rust type-syntax normalization to guarded collection validation and emission. Parentheses, raw identifiers, turbofish and standard prelude paths can no longer disguise an ordinary Vec that releases unwiped element slots during growth. Opaque aliases and associated types remain subject to the defining crate's documented wipe-owning storage contract.
Known maintenance limitation
The optional buffa-types/chrono conversion API retains Chrono 0.4.45 for source compatibility. RUSTSEC-2026-0543 marks every Chrono version unmaintained and lists no patched release. Default runtime and WKT builds do not enable Chrono; the chrono feature and all-features builds do. Existing conversions remain available, and the warning is not suppressed. The existing jiff integration provides an alternative for consumers that can migrate.