npm / protobufjs
protobufjs
What changed in protobufjs 7 to 8, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
11 breaking24 security18 new APIs and options4 performance2 behavior and defaults3 tooling89 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initprotobufjs 8122 changes
Breaking changes 7
Bytes field defaults are now Base64-encoded in toObject output.
Truncated 64-bit varints are now consistently rejected during decoding.
Unknown fields are discarded by default.
Removes the postinstall script.
fromObject now consistently rejects a null message argument.
Converters now treat fixed64 values as unsigned.
Setting __proto__ in the Message constructor is no longer allowed.
Security 20
Overflowing length prefixes are now rejected.
Parsing for ProtoJSON and Text Format has been hardened.
EOF during options parsing is now handled.
Adds support for hardened prototype properties.
protobufjs: Text Format string map parsing can mutate returned map object prototype
protobufjs : Schema-derived names can shadow runtime-significant properties
An option lets developers discard unknown fields.
protobufjs: Denial of service through unbounded Any expansion during JSON conversion
Rejects malformed field tag varints.
Hardens handling of parser input.
protobufjs: Denial of Service via unbounded recursive JSON descriptor expansion
Input handling is hardened.
protobuf.js: Code generation gadget after prototype pollution
protobuf.js: Code injection through bytes field defaults in generated toObject code
protobuf.js: Denial of service from crafted field names in generated code
protobuf.js: Process-wide denial of service through unsafe option paths
protobuf.js: Prototype injection in generated message constructors
protobufjs has overlong UTF-8 decoding
Recursion depth is limited in Reader.prototype.skipType.
Invalid characters are filtered from the type name to address CVE-2026-41242.
New APIs and options 9
Edition 2026 is now supported.
Decoding now supports utf8_validation.
Adds a spec-compliant protojson extension.
RPC metadata is exposed on service methods.
Exposes the Field rule declaration.
BigInt conversions are supported.
Adds zero-copy serialization into existing buffers.
Adds a textformat extension.
Adds support for Edition 2024.
Performance 4
Packed varint reads are optimized.
Writer allocations are optimized.
The encoder architecture was reworked and additional fast paths were added.
Slightly optimizes generated code.
Behavior and default changes 2
The CLI now resolves imports from the current working directory by default.
Unknown fields can now roundtrip.
Tooling 3
Generated typings are improved, affecting the types available to developers using protobufjs.
Adds an optional protoc-gen-pbjs plugin.
pbts supports .cjs and .mjs extensions.
Fixes and other changes 77
Parsing now supports character, octal, and hex string escapes.
Custom enum JSON names are now supported.
Recursion in Any.fromObject is limited.
Decoding now respects declared lengths.
Symbol visibility is preserved.
The first enum alias from JSON descriptors is preserved.
Loose UTF-8 decoding also uses TextDecoder.
Codegen formatters preserve negative zero.
toObject preserves non-finite defaults.
Numeric defaults are parsed according to the field type.
Numeric descriptor defaults are parsed according to the field type.
Aggregate objects in option arrays are now parsed.
Any type URLs in aggregate options are now parsed.
Bracketed special field names are now parsed in options.
CLI declaration imports now match generated modules.
Enum options are now applied regardless of declaration order.
Map fields inside groups are now parsed.
Repeated message-valued fields within map entries are now merged.
Array element union precedence is now preserved in pbts output.
Bundled definitions now preserve proto names.
Repeated NullValue elements are now accepted when parsing ProtoJSON.
The CLI now handles extensions during sparse generation.
Parsed json_name is now preserved in field options.
Feature defaults are resolved before lazy code generation.
Truncated declarations are rejected without throwing a TypeError.
Any type_url lookups are filtered to message types.
Implements open/closed enum semantics.
Supports runtimes without ICU.
Avoids materializing ProtoJSON well-known type defaults.
Node ESM named imports are supported from CommonJS entrypoints.
Explicit URLs are preserved during path resolution.
Renamed reflection objects are removed by identity.
The CLI preserves indentation in multiline declarations.
The CLI consistently waits for pbts output before exiting for JSDoc.
Descriptor metadata needed by protoc-gen-pbjs is preserved.
Converters support null-prototype plain objects.
Avoids name collisions in generated code.
Uses patched Catharsis for pbts.
The CLI now handles derived names consistently.
Nested type resolution is preferred over the global fallback.
Coerces int32 values before writer sizing.
Aligns reserved range semantics.
Registers empty common in the light build.
Omitted long map values are decoded as Long.
Improves message return typings.
Omits proto3 synthetic oneofs from toObject output.
Preserves writer state when using static encodeDelimited.
Corrects utility helper typings.
Preserves an explicit enum zero when it is not the default.
Reads non-minimal 32-bit varints correctly.
Accepts URL-safe base64 input.
Boolean values are decoded from full varints.
Common definitions can also be resolved by file name.
Improves compatibility with Deno and Bun.
Improves interoperability for descriptor extensions.
Generated TypeScript classes include properties for extensions.
Validates field and group tags while decoding.
Fields are decoded by their full wire tag.
Implicit scalar defaults are omitted during encoding.
Aligns json-module output with static-module output.
Missing map message values decode as empty messages.
Restores first-match namespace lookup.
Decoding applies last-value-wins semantics to oneof fields.
Optional module lookups are now bundler-safe.
Corrects the TypeScript types for parsedOptions.
Supports proto2 extension groups.
Scalar map keys are handled consistently.
Singular message fields are merged while decoding.
Truncated strings are consistently rejected.
Accepts import declarations after other declarations in protobuf files.
Line numbers are corrected when using alternate comment mode.
Empty repeated options are parsed.
Proto definitions can contain empty statements.
Generated output no longer includes @exports for enums.
The group end tag is forwarded during lazy decode.
ES6 wrapper imports in static-module output are corrected.
Guards the oneof index for non-Type parents.
protobufjs 729 changes
Breaking changes 4
Encoding of empty Buffers changed.
fromObject no longer initializes oneof members.
Support for Node 4, 6, 8, and 10 was dropped; developers must use a supported Node.js version.
The command line tool moved to the protobufjs-cli package, so CLI users must use the new package.
Security 4
Miscellaneous utilities were hardened; the notes do not specify which utilities or the effects.
Parser hardening was backported to the 7.x release line.
CLI fixes were backported to the 7.x line.
Input hardening fixes were backported to the 7.x line.
New APIs and options 9
Added the alt-comment CLI option.
Added support for buffer configuration.
Added support for parsing complex options.
Generated code now provides a getTypeUrl method.
message.getTypeUrl can now provide a custom typeUrlPrefix.
Added the --no-service option for the pbjs static target.
Added the null-defaults option.
Added support for proto3 optional fields.
Added configurable Root.prototype.fetch.
Fixes and other changes 12
Preserves null conversion behavior for fieldless messages.
Fixed ES6 enum exports.
Fixed type_url handling for google.protobuf.Any.
Fixed handling of map entries with an omitted key or value.
parsedOptions now appears in method JSON representations.
An optional semicolon is now allowed where an optional comma is accepted.
The library no longer fails when process is unavailable.
Proto3 optional scalars now default to null in the reflection API.
Fixed support for options using repeated_value arrays.
setProperty no longer changes the prototype.
Fixed UTF-8 to UTF-16 decoding for surrogate pairs.
Windows UNC paths can now be resolved and normalized.