You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/07/20 16:53:00 UTC
[jira] [Updated] (AVRO-4313) [java] Tighten javaAnnotation string-literal validation in SpecificCompiler
[ https://issues.apache.org/jira/browse/AVRO-4313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated AVRO-4313:
---------------------------------
Labels: pull-request-available (was: )
> [java] Tighten javaAnnotation string-literal validation in SpecificCompiler
> ---------------------------------------------------------------------------
>
> Key: AVRO-4313
> URL: https://issues.apache.org/jira/browse/AVRO-4313
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Reporter: Ismaël Mejía
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The `javaAnnotation` validator in `SpecificCompiler` uses a regular expression (`PATTERN_STRING`) whose string-literal grammar accepts an unescaped quote inside the literal body. As a result a single string literal can extend past its intended closing quote and absorb arbitrary tokens, so a crafted `javaAnnotation` value can full-match the `IDENTIFIER(STRING)` shape while actually containing extra Java declarations. Because the record template emits annotation values verbatim, such a value would be written directly into the generated specific-record source.
> This tightens the string-literal grammar so the body may only contain recognized escape sequences or characters that are not a quote, backslash, or line terminator. Legitimate annotation values (for example `SuppressWarnings("unchecked")`, `Deprecated(forRemoval = true, since = "forever")`, and values with escaped quotes) continue to validate. A regression test is added.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)