You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "dxbjavid (via GitHub)" <gi...@apache.org> on 2026/06/03 06:05:06 UTC

[PR] return null for malformed input in UrlDecoderStringLookup [commons-text]

dxbjavid opened a new pull request, #749:
URL: https://github.com/apache/commons-text/pull/749

   UrlDecoderStringLookup.lookup only catches UnsupportedEncodingException, so a malformed percent-escape like ${urlDecoder:%} lets URLDecoder.decode throw IllegalArgumentException straight out of StringSubstitutor.replace on the default interpolator. The sibling decoder lookups already swallow that: FunctionStringLookup catches IllegalArgumentException and returns null, so ${base64Decoder:!} just resolves to nothing. Catch it here too and return null so malformed untrusted input decodes consistently.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] return null for malformed input in UrlDecoderStringLookup [commons-text]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #749:
URL: https://github.com/apache/commons-text/pull/749#issuecomment-4971567615

   I'll need to review the whole package to avoid a one-off solution... this week.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] return null for malformed input in UrlDecoderStringLookup [commons-text]

Posted by "dxbjavid (via GitHub)" <gi...@apache.org>.
dxbjavid commented on PR #749:
URL: https://github.com/apache/commons-text/pull/749#issuecomment-4965769199

   any further thoughts?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Return null for malformed input in UrlDecoderStringLookup [commons-text]

Posted by "dxbjavid (via GitHub)" <gi...@apache.org>.
dxbjavid commented on PR #749:
URL: https://github.com/apache/commons-text/pull/749#issuecomment-5020310133

   Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] return null for malformed input in UrlDecoderStringLookup [commons-text]

Posted by "dxbjavid (via GitHub)" <gi...@apache.org>.
dxbjavid commented on PR #749:
URL: https://github.com/apache/commons-text/pull/749#issuecomment-4616374496

   had a proper read through the package before replying. on bad input the lookups split into two camps:
   
   - value transforms that squelch to null so the interpolator can fall through to a default: base64Decoder/base64Encoder via FunctionStringLookup (catches IllegalArgumentException), resourceBundle (MissingResourceException), dns and inetAddress (UnknownHostException), constant (Exception).
   - operational lookups that deliberately surface failures as IllegalArgumentException: script, url, file, properties, xml. those load or run something so propagating reads as correct, and i've left all of them untouched.
   
   urlDecoder belongs in the first camp next to its closest sibling base64Decoder, which already returns null on malformed input. at the moment it's the odd one out: it handles the UnsupportedEncodingException path but lets URLDecoder.decode's IllegalArgumentException on a bad percent-escape (${urlDecoder:%}) propagate straight out of StringSubstitutor.replace, whereas ${base64Decoder:!} just resolves to nothing. the patch only brings urlDecoder in line with that, so nothing in the propagate camp changes.
   
   i also checked urlEncoder for symmetry, but URLEncoder.encode doesn't throw IllegalArgumentException on arbitrary input so it doesn't need the same guard.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Return null for malformed input in UrlDecoderStringLookup [commons-text]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory merged PR #749:
URL: https://github.com/apache/commons-text/pull/749


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] return null for malformed input in UrlDecoderStringLookup [commons-text]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #749:
URL: https://github.com/apache/commons-text/pull/749#issuecomment-4615950381

   This needs further study since the all lookups in this package might handle certain exception inconsistently while others should propagate exceptions (and already do).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org