Skip to content

Commit

Permalink
Merge branch 'master' into test-pr-1614
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrushforth committed Oct 29, 2024
2 parents 858bd97 + dc5df6c commit 988e622
Show file tree
Hide file tree
Showing 69 changed files with 758 additions and 2,315 deletions.
59 changes: 0 additions & 59 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,9 @@ ext.BUILD_CLOSED = buildClosed

ext.RUNARGSFILE = "run.args"
ext.COMPILEARGSFILE = "compile.args"
ext.RUNJAVAPOLICYFILE = 'run.java.policy'

ext.TESTCOMPILEARGSFILE = "testcompile.args"
ext.TESTRUNARGSFILE = "testrun.args"
ext.TESTJAVAPOLICYFILE = 'test.java.policy'

// the file containing "extra" --add-exports
ext.EXTRAADDEXPORTS = 'buildSrc/addExports'
Expand Down Expand Up @@ -3791,7 +3789,6 @@ project(":web") {
dependsOn testWebArchiveJar
def testResourceDir = file("$buildDir/testing/resources")
jvmArgs "-DWEB_ARCHIVE_JAR_TEST_DIR=$testResourceDir"
systemProperty 'java.security.manager', 'allow'
}

task compileJavaDOMBinding()
Expand Down Expand Up @@ -4033,7 +4030,6 @@ project(":systemTests") {
def dependentProjects = [ 'base', 'graphics', 'controls', 'media', 'jsobject', 'web', 'swing', 'fxml' ]
commonModuleSetup(project, dependentProjects)

File testJavaPolicyFile = new File(rootProject.buildDir, TESTJAVAPOLICYFILE);
File testRunArgsFile = new File(rootProject.buildDir,TESTRUNARGSFILE);

File stRunArgsFile = new File(project.buildDir,"st.run.args");
Expand Down Expand Up @@ -4184,15 +4180,12 @@ project(":systemTests") {
if (project.hasProperty("launcherModulePath")) {
systemProperties 'worker.module.path': launcherModulePath
}
systemProperties 'worker.patch.policy': cygpath(testJavaPolicyFile.path)
systemProperties 'worker.java.cmd': JAVA

if (rootProject.hasProperty("ClipShapeTest.numTests")) {
systemProperty "ClipShapeTest.numTests", rootProject.getProperty("ClipShapeTest.numTests")
}

systemProperty 'java.security.manager', 'allow'

if (!IS_USE_ROBOT) {
// Disable all robot-based visual tests
exclude("test/robot/**");
Expand Down Expand Up @@ -4976,18 +4969,6 @@ compileTargets { t ->
outputs.file(f)
}

def outputPolicyDir = "${modulesConfDir}/java.base/security"
def outputPolicyFile = file("${outputPolicyDir}/java.policy.extra")

outputs.file(outputPolicyFile)
moduleProjList.each { project ->
def policyDir = "${project.projectDir}/src/main/conf/security"
def policyFile = file("${policyDir}/java.policy")
if (policyFile.exists()) {
inputs.file(policyFile)
}
}

doLast {
Map extras = [:]

Expand Down Expand Up @@ -5031,16 +5012,6 @@ compileTargets { t ->
f << "\n"
}
}

// concatecate java.policy files into a single file
//
mkdir outputPolicyDir
outputPolicyFile.delete()
moduleProjList.each { project ->
def policyDir = "${project.projectDir}/src/main/conf/security"
def policyFile = file("${policyDir}/java.policy")
if (policyFile.exists()) outputPolicyFile << policyFile.text
}
}
}
buildModules.dependsOn(buildModulesTask)
Expand Down Expand Up @@ -5777,15 +5748,9 @@ compileTargets { t ->
File testRunArgsFile = new File(rootProject.buildDir, TESTRUNARGSFILE)
//test (shimed) version
File testCompileArgsFile = new File(rootProject.buildDir, TESTCOMPILEARGSFILE)
// And a test java.policy file
File testJavaPolicyFile = new File(rootProject.buildDir, TESTJAVAPOLICYFILE)
// and the non-test version to go with run.args
File runJavaPolicyFile = new File(rootProject.buildDir, RUNJAVAPOLICYFILE);

outputs.file(testRunArgsFile)
outputs.file(testCompileArgsFile)
outputs.file(testJavaPolicyFile)
outputs.file(runJavaPolicyFile)
inputs.file(EXTRAADDEXPORTS);

doLast() {
Expand All @@ -5801,9 +5766,6 @@ compileTargets { t ->
testRunArgsFile.delete()
testCompileArgsFile.delete()

testJavaPolicyFile.delete()
runJavaPolicyFile.delete()

List<String> modpath = []

if (HAS_JAVAFX_MODULES) {
Expand All @@ -5819,16 +5781,6 @@ compileTargets { t ->
def dstModuleDir = cygpath(dir.path)
modpath << "${project.ext.moduleName}=${dstModuleDir}"

String themod = dir.toURI()
testJavaPolicyFile << "grant codeBase \"${themod}\" {\n" +
" permission java.security.AllPermission;\n" +
"};\n"

dir = new File(rootProject.buildDir, "modular-sdk/modules/${project.ext.moduleName}")
themod = dir.toURI()
runJavaPolicyFile << "grant codeBase \"${themod}\" {\n" +
" permission java.security.AllPermission;\n" +
"};\n"
}
}

Expand All @@ -5853,17 +5805,6 @@ compileTargets { t ->

def dstModuleDir = cygpath(dir.path)
modpath << "${dstModuleDir}"

String themod = dir.toURI()
testJavaPolicyFile << "grant codeBase \"${themod}\" {\n" +
" permission java.security.AllPermission;\n" +
"};\n"

dir = new File(TEST_SDK_PATH, "sdk/lib/${project.ext.moduleName}.jar")
themod = dir.toURI()
runJavaPolicyFile << "grant codeBase \"${themod}\" {\n" +
" permission java.security.AllPermission;\n" +
"};\n"
}
}

Expand Down
4 changes: 0 additions & 4 deletions modules/javafx.base/src/main/conf/security/java.policy

This file was deleted.

111 changes: 3 additions & 108 deletions modules/javafx.base/src/main/java/javafx/util/FXPermission.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,119 +33,14 @@
* no actions list; you either have the named permission
* or you don't.
*
* <p>
* The target name is the name of the JavaFX permission (see below). The naming
* convention follows the hierarchical property naming convention.
* Also, an asterisk can be used to represent all JavaFX permissions.
* </p>
*
* <p>
* The following table lists all the possible {@code FXPermission}
* target names, and for each provides a description of what the permission
* allows and a discussion of the risks of granting code the permission.
* </p>
*
* <table border=1>
* <caption>FXPermission Table</caption>
* <tr>
* <th style="padding: 5px;" scope="col">Permission Target Name</th>
* <th style="padding: 5px;" scope="col">What the Permission Allows</th>
* <th style="padding: 5px;" scope="col">Risks of Allowing this Permission</th>
* </tr>
*
* <tr>
* <th style="padding: 5px;" scope="row">accessClipboard</th>
* <td style="padding: 5px;">Posting and retrieval of information to and from the system clipboard</td>
* <td style="padding: 5px;">This would allow a malicious application to share or read
* potentially sensitive or confidential information.</td>
* </tr>
*
* <tr>
* <th style="padding: 5px;" scope="row">accessWindowList</th>
* <td style="padding: 5px;">Accessing the list of all JavaFX Windows</td>
* <td style="padding: 5px;">Providing access to the complete list of all JavaFX windows could give
* a malicious application the ability to modify a security dialog.</td>
* </tr>
*
* <tr>
* <th style="padding: 5px;" scope="row">createRobot</th>
* <td style="padding: 5px;">Creating JavaFX Robot objects</td>
* <td style="padding: 5px;">The JavaFX Robot object allows code to generate native-level
* mouse and keyboard events as well as read the screen. It could allow
* malicious code to control the system, run other programs, read the
* display, and deny mouse and keyboard access to the user.</td>
* </tr>
*
* <tr>
* <th style="padding: 5px;" scope="row">createTransparentWindow</th>
* <td style="padding: 5px;">Creating transparent windows</td>
* <td style="padding: 5px;">Transparent windows are not limited to a rectangular region that
* obscures what is underneath the window.
* This can make it difficult to distinguish parts of the window
* from other application windows or the platform desktop, and can be used
* to allow a malicious application to trick a user into entering
* sensitive data, especially in conjunction with either
* {@code setWindowAlwaysOnTop} or {@code unrestrictedFullScreen}.</td>
* </tr>
*
* <tr>
* <th style="padding: 5px;" scope="row">loadFont</th>
* <td style="padding: 5px;">Loading a custom font, either via the
* {@link javafx.scene.text.Font#loadFont} method or a jar file containing
* embedded fonts listed in the jar manifest</td>
* <td style="padding: 5px;">Loading a custom font might allow a malicious application to provide a
* malformed font. Such a font could crash the application, allowing the
* malicious application to take control of the system, if there are any
* bugs in the underlying platform font implementation.</td>
* </tr>
*
* <tr>
* <th style="padding: 5px;" scope="row">modifyFXMLClassLoader</th>
* <td style="padding: 5px;">Setting the ClassLoader used to load FXML objects, and removing the
* restriction against loading system classes</td>
* <td style="padding: 5px;">Allowing an application to set an arbitrary ClassLoader might enable
* a malicious application to load classes with elevated permissions. Also
* removing the restriction against loading system classes with a null
* ClassLoader, might allow the application access to classes they would
* otherwise be denied from accessing.</td>
* </tr>
*
* <tr>
* <th style="padding: 5px;" scope="row">setWindowAlwaysOnTop</th>
* <td style="padding: 5px;">Setting the always-on-top property of a window:
* {@link javafx.stage.Stage#setAlwaysOnTop}</td>
* <td style="padding: 5px;">The malicious window might make itself look and behave like the
* platform desktop, so that information entered by the unsuspecting user
* is captured and subsequently misused,
* especially in conjunction with the {@code createTransparentWindow}
* permission.</td>
* </tr>
*
* <tr>
* <th style="padding: 5px;" scope="row">unrestrictedFullScreen</th>
* <td style="padding: 5px;">Allow unrestricted full-screen access, including keyboard events
* and warning banner</td>
* <td style="padding: 5px;">This permission allows an application to enter full-screen mode at any
* time, override the warning banner, and disable the function of
* the ESC key to exit from full-screen mode.
* All keyboard input will be delivered to the application while in
* full-screen mode, rather than being limited to KEY_PRESSED and
* KEY_RELEASED events for a subset of keys. See
* {@link javafx.stage.Stage#setFullScreen}.
* This could allow a malicious window to
* look and behave like the platform desktop, so that information entered
* by the unsuspecting user is captured and subsequently misused,
* especially in conjunction with the {@code createTransparentWindow}
* permission.</td>
* </tr>
*
* </table>
* @apiNote
* This permission cannot be used for controlling access to resources anymore
* as the Security Manager is no longer supported.
*
* @see java.security.BasicPermission
* @see java.security.Permission
* @see java.security.Permissions
* @see java.security.PermissionCollection
* @see java.lang.SecurityManager
*
* @since 9
*/
Expand Down
4 changes: 0 additions & 4 deletions modules/javafx.controls/src/main/conf/security/java.policy

This file was deleted.

Loading

0 comments on commit 988e622

Please sign in to comment.