Make Expressions max length configurable (fixes #2916)#3422
Merged
velo merged 1 commit intoJun 19, 2026
Merged
Conversation
The maximum length of a single template expression was hard-coded to 10000 characters in feign.template.Expressions, throwing IllegalArgumentException for anything longer with no way to opt out. Make the limit configurable through the "feign.template.expression.maxLength" system property (default 10000), and allow disabling the check entirely by setting it to a non-positive value. Fixes OpenFeign#2916 Signed-off-by: seonwoo_jung <79202163+seonwooj0810@users.noreply.github.com>
velo
approved these changes
Jun 19, 2026
velo
left a comment
Member
There was a problem hiding this comment.
The default expression length guard stays unchanged, and the new system property is additive for users who need to tune or disable it explicitly. The ExpressionsTest additions cover the default, configured, and disabled cases, and the patch does not introduce a compatibility or security concern.
Merged
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.
Fixes #2916
Problem
feign.template.Expressionshard-codes the maximum length of a single template expression toMAX_EXPRESSION_LENGTH = 10000. Any expression longer than that fails withIllegalArgumentException: expression is too long. Max length: 10000, with no way to raise or disable the limit. As noted in the issue, applications that legitimately need longer expressions have no escape hatch.Change
feign.template.expression.maxLengthsystem property, defaulting to10000(unchanged behavior).0(or any non-positive value) disables the length check entirely, as requested in the issue.The constant was used in a single place (
Expressions.create), so the change is self-contained and the default keeps existing behavior intact.Tests
Added
ExpressionsTestcases:tooLongExpressionFailsWithDefaultLimit— default 10000 limit still rejects over-long expressions.maxExpressionLengthIsConfigurable— a custom limit is honored (Max length: 5).lengthCheckCanBeDisabled— with the property set to0, an expression beyond the default limit is accepted.Verification done: built and ran
./mvnw -pl core -am test -Dtest=ExpressionsTest(7/7 pass) and validated formatting with the project'sgit-code-format-maven-plugin:validate-code-format. All commits are DCO signed-off.