constellation-app / constellation

A graph-focused data visualisation and interactive analysis application.
https://constellation-app.com
Apache License 2.0
386 stars 59 forks source link

Dev Guide: Adding security management requirements for using in new Java #2062

Closed antares1470 closed 3 months ago

antares1470 commented 4 months ago

Prerequisites

Description

From Java 17, Java has updated security management which requires explicitly declaring access to classes outside their own module (through exports and opens). Constellation for v3 required a number of these additions to the main project properties in Core as well as project properties for any module suites sitting on top of Core order for it to work. This will include the TrainingExercises module suite which is created as the base for the developer guide.

Given the module suite is created from scratch by a developer going through the guide, the required security management declarations should be added to the guide, likely as an added step in Exercise 1.1 (probably at some point before current 1.1.4). It could be added a couple of ways (possibly others): 1) added before current 1.1.3 (run the application), making it clear from the beginning that there will need to be things declared in properties 2) modifying 1.1.3 to demonstrate what happens without the declarations and then steps afterwards declaring them and running again

Without these additions, the application won't run properly.

Steps to Reproduce

  1. Follow the guide as currently set out up until first run
  2. Run the application when first asked to
  3. Open a new graph

Expected behaviour: Can get a point in guide where applications doesn't throw issues. Guide clearly articulates need for explicit security management

Actual behaviour: App never seems to work as guide says it does. No mention of explicit security management

Reproduces how often: 100%

Additional Information

Copying the ones from Core appears to work. i.e. adding the following to project.properties in the TrainingExercises module suite:

run.args.extra=-J--add-opens=java.base/java.net\=ALL-UNNAMED \
               -J--add-opens=java.base/java.security\=ALL-UNNAMED \
               -J--add-opens=java.desktop/javax.swing\=ALL-UNNAMED \
               -J--add-opens=javafx.base/com.sun.javafx.event\=ALL-UNNAMED \
               -J--add-exports=java.base/java.net\=ALL-UNNAMED \
               -J--add-exports=java.base/java.security\=ALL-UNNAMED \
               -J--add-exports=java.base/java.lang\=ALL-UNNAMED \
               -J--add-exports=java.desktop/sun.awt\=ALL-UNNAMED \ 
               -J--add-exports=java.desktop/sun.java2d\=ALL-UNNAMED \
               -J--add-exports=javafx.base/com.sun.javafx.event\=ALL-UNNAMED

If someone figures out a simpler list to include though, then that should probably be what is used.

HolandCrick commented 3 months ago

@antares1470 - thanks for updating the dev guide. Looks better now.