AVRO-4313: [java] Tighten javaAnnotation string-literal validation in SpecificCompiler (#3892)

* AVRO-4313: [java] Tighten javaAnnotation string-literal validation in SpecificCompiler

The string-literal grammar used to validate javaAnnotation values accepted
an unescaped quote inside the literal body, letting a single literal span
past its intended closing quote and absorb surrounding tokens. Constrain the
body to recognized escape sequences or characters that are not a quote,
backslash, or line terminator, and add a regression test.

* AVRO-4313: Exclude all line terminators from annotation string literals

Also reject NEL, LS and PS in addition to CR and LF so an annotation value
cannot span multiple lines in the generated source.

* AVRO-4313: Make injection regression test robust to multiple outputs

Assert the injection payload is absent from every generated file and the
valid annotation is emitted in at least one, rather than requiring it in
each output file.
2 files changed
tree: a6df1277ad22b980fc543f2579fa37953e213ebc
  1. .devcontainer/
  2. .github/
  3. .mvn/
  4. doc/
  5. lang/
  6. share/
  7. .asf.yaml
  8. .editorconfig
  9. .gitattributes
  10. .gitignore
  11. .yamllint.yml
  12. BUILD.md
  13. build.sh
  14. composer.json
  15. DIST_README.txt
  16. docker-compose.yml
  17. LICENSE.txt
  18. NOTICE.txt
  19. pom.xml
  20. README.md
README.md

[!IMPORTANT]
The Rust SDK is moving to https://github.com/apache/avro-rs. Please use it for new issues and pull requests!

Apache Avro™

Current CI status (Github servers)

test c test c# test c++ test java test javascript test perl test ruby test python test php

Current CodeQL status

codeql c# codeql java codeql javascript codeql python


Apache Avro™ is a data serialization system.

Learn more about Avro, please visit our website at:

https://avro.apache.org/

To contribute to Avro, please read:

https://cwiki.apache.org/confluence/display/AVRO/How+To+Contribute

You can use devcontainers to develop Avro:

  • Open in Visual Studio Code
  • Open in Github Codespaces

Trademark & logos

Apache®, Apache Avro and the Apache Avro airplane logo are trademarks of The Apache Software Foundation.

The Apache Avro airplane logo on this page has been designed by Emma Kellam for use by this project.