|
| Summary: |
Enforce the file encoding rules with Checkstyle |
| Issue Type: |
Improvement |
| Assignee: |
Unassigned |
| Components: |
Development Issues only |
| Created: |
13/Oct/26 18:59 |
| Priority: |
Major |
| Reporter: |
Vincent Massol |
| Description: |
Following the vote at https://forum.xwiki.org/t/move-java-sources-to-utf-8-and-update-the-file-encoding-rules/18925, Java sources are UTF-8 and may contain non-ASCII characters, and properties files are ISO-8859-1.
- Add a Checkstyle rule (in checkstyle.xml and checkstyle-test.xml) failing the build when a Java source contains an invisible or ambiguous character written raw instead of as a unicode escape: control characters, non-breaking spaces, soft hyphens, zero-width characters, bidirectional control characters and byte order marks. Such characters can't be seen in code reviews and can hide bugs or malicious code (CVE-2021-42574, "Trojan Source").
- Add a Checkstyle rule failing the build when a properties file is encoded in UTF-8 instead of ISO-8859-1, which would display garbled characters at runtime.
- Add an .editorconfig to commons, rendering and platform declaring these encodings, and fix the existing violations.
|
|