You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Krishnauprit18 (via GitHub)" <gi...@apache.org> on 2026/09/03 04:47:51 UTC

[PR] Fix webtools ProgramExport, Cache Maintenance and Thread List; normalise the ProgramExport pattern list [ofbiz-framework]

Krishnauprit18 opened a new pull request, #1845:
URL: https://github.com/apache/ofbiz-framework/pull/1845

   Small fixes around webtools/ProgramExport and the shared Groovy class loader.
   
   - GroovyUtil: the compile-time AST restrictions meant for inline ${groovy:...}
     scriptlets were also being applied to component:// .groovy files, so screen
     scripts that reference java.lang.Thread / java.lang.Runtime — ProgramExport,
     Cache Maintenance (FindUtilCache) and Thread List (Threads) — stopped
     compiling and returned HTTP 500. The file-location path now uses its own
     GroovyClassLoader; the inline path is unchanged (GroovyUtilTests still pass).
   
   - ProgramExport: the in-file SecureASTCustomizer combined an empty
     static-imports allow-list with indirect import checking and rejected every
     method call, even the built-in example. Switched imports/static imports to
     disallowed-list mode, restored java.lang.Object to the allowed receivers,
     and updated the deprecated setter names.
   
   - ProgramExport: several pattern-list entries matched only the plain obj.name(
     spelling; they now also match Groovy's quoted obj."name"() form, consistently
     across the list.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix webtools ProgramExport, Cache Maintenance and Thread List; normalise the ProgramExport pattern list [ofbiz-framework]

Posted by "ashishvijaywargiya (via GitHub)" <gi...@apache.org>.
ashishvijaywargiya merged PR #1845:
URL: https://github.com/apache/ofbiz-framework/pull/1845


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix webtools ProgramExport, Cache Maintenance and Thread List; normalise the ProgramExport pattern list [ofbiz-framework]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #1845:
URL: https://github.com/apache/ofbiz-framework/pull/1845#discussion_r3921134811


##########
framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/entity/ProgramExport.groovy:
##########
@@ -77,45 +77,49 @@ if (security.hasPermission('ENTITY_MAINT', session)) {
     // (?s) flag for multi-line/dotall matching to prevent whitespace bypass
     List<String> dangerousPatterns = [
             // Process & Command Execution + Runtime Variants
-            /(?s)Runtime\s*\.\s*getRuntime\s*\(\s*\)/,
+            // NOTE: patterns that match a member access ('.name(', 'Type.name', '.name') carry an
+            // optional ['"]? around the name so they also match Groovy's quoted-member syntax
+            // (obj."name"(), Type."name"()) - a normal language feature that otherwise bypasses a
+            // literal-text match.
+            /(?s)Runtime\s*\.\s*['"]?getRuntime['"]?\s*\(\s*\)/,
             /(?s)['"]java\.lang\.Runtime['"]\.class/,
-            /(?s)Runtime\.class\.getDeclaredMethod/,
-            /(?s)getRuntime\s*\(\s*\)\.exec/,
+            /(?s)Runtime\.class\.\s*['"]?getDeclaredMethod['"]?/,

Review Comment:
   The dangerous-pattern regex for `Runtime.class.getDeclaredMethod` doesn’t allow whitespace around the first dot (`Runtime\.class...`), even though the comment above notes whitespace-bypass concerns and most other patterns use `\s*\.\s*`. A script could evade this specific check with `Runtime . class . getDeclaredMethod` (or similar spacing).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org