Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Conversation

@charleskorn
Copy link

This PR adds a new option to Config, MaxMarshalledBytes, which allows limiting the size of the marshalled output. By default, it is 0 and enforces no limit (ie. the same behaviour as today).

This is useful in services where marshalling a large payload could consume a large amount of memory and therefore be a denial of service vector.

I don't love that I've used panic here, but I couldn't see any other way that wouldn't cause a backwards-incompatible change, particularly custom encoders.

Running the benchmarks in benchmarks show no significant impact to performance as a result of this change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant