Uh oh!
There was an error while loading. Please reload this page.
Fix building in IntelliJ IDEA - #200
Conversation
For an improved supply chain security (see [XDev for example](https://xdev.software/en/news/detail/discovering-the-perfect-java-supply-chain-attack-vector-and-how-it-got-fixed) automatic annotation processor discovery should be disabled and annotation processors should be explicitly listed on the command line. In Maven this can be done: - If the list of processors is not empty, by adding an `<annotationProcessors>` configuration element. - If the list of processors is empty, the above setting will cause an invalid `-processor ''` argument to be passed to the compiler. To fix that `-proc:none` needs to be provided. The above procedure breaks IntelliJ IDEA compilation, since seeing a `-proc:none` not only disables annotation processing, but also causes IDEA to ignore the provided `--processor-path`. We don't have annotation processors, but we have a [compiler `Plugin`](https://docs.oracle.com/javase/8/docs/jdk/api/javac/tree/com/sun/source/util/Plugin.html), which needs to be on the annotation processor path. This PR solves these compatibility problems, by removing both the `-proc:none` and `-processor` arguments and _de facto_ **enables** the automatic discovery of annotation processors. It adds a comment to re-enable the `annotationProcessor` element if an annotation processor is added in the future. Closespackage-url#199
dwalluck
commented
Mar 15, 2025
So, since no processors existed in the first place, the flag was unnecessary for security, right? |
dwalluck
commented
Mar 15, 2025
Here is one more IDEA puzzle for you: Every time I restart IDEA, I have to re-enable jspecify as the default null annotation (all existing uses are underlined). It always goes back to its own annotations by default. |
ppkarwasz
commented
Mar 15, 2025
I am not even sure, where to find the option to set that. |
jeremylong
commented
Mar 16, 2025
@ppkarwasz I mentioned annotation processor attacks in my 2023 talk at BlackHat and AppSec USA (same talk at both - I think the AppSec one might have been a little better as it was my second time giving the talk): |
dwalluck
commented
Mar 16, 2025
@ppkarwasz I think I am using this plugin https://plugins.jetbrains.com/plugin/9418-nullability-annotations-inspection |
For an improved supply chain security (see XDev for example automatic annotation processor discovery should be disabled and annotation processors should be explicitly listed on the command line. In Maven this can be done:
<annotationProcessors>configuration element.-processor ''argument to be passed to the compiler. To fix that-proc:noneneeds to be provided.The above procedure breaks IntelliJ IDEA compilation, since seeing a
-proc:nonenot only disables annotation processing, but also causes IDEA to ignore the provided--processor-path. We don't have annotation processors, but we have a compilerPlugin, which needs to be on the annotation processor path.This PR solves these compatibility problems, by removing both the
-proc:noneand-processorarguments and de factoenables the automatic discovery of annotation processors. It adds a comment to re-enable theannotationProcessorelement if an annotation processor is added in the future.Closes#199