Commit Graph

2817 Commits

Author SHA1 Message Date
Yasser Zamani 07afb5ba88 debug docker build for JDK 9+ 2020-02-12 17:39:05 +03:30
JCgH4164838Gh792C124B5 ee583c22f1 Minor follow-up to WW-5050 changes to ContainerImpl.
- Made isStatic() utility method static, added javadoc comment.
- Refactored isNotPublic() into isPublicForReflection() with negation moved
to calling locations.  Also added javadoc comment.
- Added final declaration to several variables used in methods.
- Added @Override annotation to overriden methods.
2020-01-10 21:13:07 -05:00
Lukasz Lenart 8d8b306c3c WW-5049 Drops empty space 2019-12-29 09:10:08 +01:00
Lukasz Lenart 503c8b7623 WW-5047 Avoids confusion about scope's default value 2019-12-29 09:10:08 +01:00
Lukasz Lenart 9c1b0cf1c2 WW-5049 Supports bean-selection via Java config 2019-12-29 09:10:08 +01:00
Lukasz Lenart 7c6dfe1930 WW-5049 Sets proper order of configuration elements 2019-12-29 09:10:08 +01:00
Lukasz Lenart 84f8438026 WW-5049 Renames default bean provider 2019-12-29 09:07:00 +01:00
Lukasz Lenart df4e193aa8 WW-5049 Extends xwork DTD as well 2019-12-29 09:07:00 +01:00
Lukasz Lenart a7cfed7a96 WW-5049 Allows define a custom bean provider 2019-12-29 09:07:00 +01:00
Lukasz Lenart 5c55e69b4f WW-5049 Moves Velocity support into a dedicated plugin 2019-12-29 09:07:00 +01:00
Lukasz Lenart 140bea2e1c WW-5003 Drops XWorkException and uses StrutsException instead 2019-12-27 09:09:42 +01:00
Yasser Zamani 93f9cf6bfa increase security log levels to error 2019-12-24 10:56:30 +03:30
Yasser Zamani 7dddaf5128 refactor duplicate code. add log info. 2019-12-24 10:50:46 +03:30
JCgH4164838Gh792C124B5 28a7912acd Disable expressionMaxLength by default for Struts 2.5.x. (#380)
* Disable struts.ognl.expressionMaxLength by default for Struts 2.5.x.
- Commented out struts.ognl.expressionMaxLength line in default.properties
and provided in-place comments about its usage.
- Changed OgnlValueStack.handleOgnlException() methods to output error
instead of warn for failures to evaluate expressions due to security
constraints.
- Updated existing unit tests to compensate for change in default
behaviour.
- Added a unit test to confirm default behaviour for
struts.ognl.expressionMaxLength is disabled.

* Updated commit for disable struts.ognl.expressionMaxLength by default for
Struts 2.5.x
- Additional unit test requested by Y. Zamani for code coverage.
- Corrected accidental use of wrong (static) toString method in one test.
- Addition of a minimum struts.ognl.expressionMaxLength value permitted
by Struts 2 (128).  Any value smaller than that is likely to be a
configuration error and if a user really wishes to force it they may go to
OGNL directly to do so.

* Updated commit for disable struts.ognl.expressionMaxLength by default for
Struts 2.5.x
- Removed minimum struts.ognl.expressionMaxLength (restored to previous
behaviour) as requested by Y. Zamani and L. Lenart.
- Updated unit tests to compensate for the above change.
- Changed log output from warn to error in applyExpressionMaxLength() on
exception since it will likely be considered a fatal condition.

(cherry picked from commit 3dfc5a4)
2019-12-21 11:54:46 +03:30
JCgH4164838Gh792C124B5 a23db416e5 Additional change
- added unit test (hoping to make coveralls happy).

(cherry picked from commit dd6d206)
2019-12-21 11:54:23 +03:30
JCgH4164838Gh792C124B5 84cf17ebb1 Minor follow-up changes to PR #371
- added some additional exclusions in struts-default.xml.
- added log warning that specifies the value of maxLength involved if
  applyExpressionMaxLength(maxLength) fails.
- added null guards to two handleOgnlException() methods that could
  result in an NPE with #371 changes (a null OgnlException parameter
  was permissible previously, correct or not).

(cherry picked from commit e2b644a)
2019-12-21 11:54:03 +03:30
Yasser Zamani 11999d148e WW-5041 Upgrade to OGNL 3.1.26 and adapt to its new features
(cherry picked from commit 1de94b2)
2019-12-21 11:45:02 +03:30
Lukasz Lenart 54d01ae72b Merge pull request #385 from JCgH4164838Gh792C124B5/local_25x_TstFix1
Fix incorrect encoding strings in FileUploadInterceptorTest

(cherry picked from commit 47c87bc62c)
2019-12-01 14:41:14 -05:00
Sebastian Peters 0c17c650b1 Fix warning: Use parameterized types instead of raw types 2019-11-18 20:56:28 +01:00
Sebastian Peters 12ed52e05d Remove unused xerces import 2019-11-18 20:53:15 +01:00
Lukasz Lenart c6bf6ed4d4 Cleans up code 2019-11-13 08:43:49 +01:00
Lukasz Lenart d83e93919c WW-5022 Adds missing autogenerated tags 2019-11-11 10:14:49 +01:00
Lukasz Lenart 2d23357f0d Merge pull request #373 from JCgH4164838Gh792C124B5/local_26x_TagBodyEscapeCtrl
Proposed fix for WW-5022 (escape html tag body control flag)
2019-10-19 18:21:03 +02:00
Lucca Scarano eafed471e9 Remove duplicate attribute
Signed-off-by: Lucca Scarano <lucca.scarano@hotmail.com>
2019-10-15 13:25:30 -03:00
JCgH4164838Gh792C124B5 9592355960 Proposed fix for WW-5022 (escape html tag body control flag)
- Added escapeHtmlBody parameter to s:a and s:submit tags.
- No other tags appear to require this feature (but can be added to any
component).
- Added new unit tests for escapeHtmlBody (and usesBody for component).
- Fixed broken s:a tags in ShowCase app.
2019-10-14 17:52:16 -04:00
Lukasz Lenart 070f16c156 Merge pull request #370 from JCgH4164838Gh792C124B5/local_26x_CPickPR367
Forward-port PR#367 from 2.5.x to 2.6.x (cherry-pick)
2019-10-01 08:37:29 +02:00
Lukasz Lenart 544c3532a0 Merge pull request #369 from JCgH4164838Gh792C124B5/local_26x_CPickPR366
Forward-port PR#366 from 2.5.x to 2.6.x (cherry-pick)
2019-10-01 08:37:07 +02:00
Lukasz Lenart 0987143e5d Merge pull request #367 from JCgH4164838Gh792C124B5/local_25x_SendRedirectEnh
Minor improvement proposed for ServletRedirectResult sendRedirect()

(cherry picked from commit 706bb560e4)
2019-09-30 23:37:33 -04:00
Lukasz Lenart 1a93a300bb Merge pull request #366 from JCgH4164838Gh792C124B5/local_25x_SendErrorEnh
Improved logging for DefaultDispatcherErrorHandler, DefaultStaticContentLoader

(cherry picked from commit 12d4feaf8f)
2019-09-30 23:30:55 -04:00
Lukasz Lenart 40d23ac315 Merge pull request #354 from JCgH4164838Gh792C124B5/localS2_25x_B10
Minor consistency update correction for WW-5029 fix to the 2.5.x branch

(cherry picked from commit bb9ce7582b)
2019-09-30 22:32:02 -04:00
JCgH4164838Gh792C124B5 6d453ca70d Proposed WW-5035 enhancement:
- Provide cache clearing methods for OgnlUtil (expression cache, BeanInfo
cache).
- Provide methods to check the cache sizes (entry number for expression
cache, BeanInfo cache).
- Provide static method to clear the OgnlRuntime cache (convenience
method).

(cherry picked from commit 9216e8e)
2019-09-07 15:15:01 +04:30
Sebastian Haas dca0dd224f Fix typo in MultiselectInterceptor javadoc 2019-08-29 11:40:06 +02:00
Yasser Zamani 570f8c3e67 fix compilation error of WW-4999 cherry picks 2019-06-03 12:28:57 +04:30
Yasser Zamani 704e41c6e8 test false for logMissingProperties (WW-4999)
(cherry picked from commit a50af87)
2019-06-03 12:17:15 +04:30
Yasser Zamani eca9c34645 decouple logMissingProperties from devMode (WW-4999)
(cherry picked from commit 9e01fbd)
2019-06-03 12:17:02 +04:30
Yasser Zamani a16cd4fca6 test not throw exception on top missing property (WW-4999)
instead continue to next objects in stack

Also tests not skip returned null values by user method

(cherry picked from commit d4dd338)
2019-06-03 12:16:52 +04:30
Yasser Zamani 382124cfd2 not log user exceptions as missing properties (WW-4999)
Also reaks loop on user method exceptions - but continue to next objects in stack on NoSuchMethodException.

(cherry picked from commit 0999fba)
2019-06-03 12:16:37 +04:30
Yasser Zamani b657a272d1 fix logMissingProperties (WW-4999)
Moves checking OgnlValueStack.THROW_EXCEPTION_ON_FAILURE outside loop because it shouldn't throw exception on first failure while is trying all root objects.

Returns on first successful call because it's not rational and is confusing user to skip when user method successfully returns null as an actual result.

Fixes WW-4999 via honoring (devMode && logMissingProperties) for OgnlValueStack.THROW_EXCEPTION_ON_FAILURE and REPORT_ERRORS_ON_NO_PROP.

(cherry picked from commit 3ac6835)
2019-06-03 12:16:25 +04:30
JCgH4164838Gh792C124B5 5c30e0d5c6 [WW-5034] Forward port Minor enhancement/fix to
AbstractLocalizedTextProvider:
- Forward port of equivalent change from 2.5.x.
- Made "constant" RELOADED static to save an initialization every time.
- Made ineffective clearBundle(final String bundleName) method a "no-op"
  with a debug log indicating the same.  Marked method as deprecated.
- Introduced protected clearBundle(final String bundleName, Locale locale)
  method for use by descendants, with debug log output when called.
- Introduced protected clearMissingBundlesCache() method for use by
  descendants, with debug log when called.
2019-06-01 14:58:18 -04:00
Yasser Zamani b7d64f3a01 allow white-space around ";" character in multipart request RegEx
fixes WW-4958
2019-04-23 12:09:58 +04:30
JCgH4164838Gh792C124B5 47a8a21da2 Proposed fix for WW-5029 for the 2.5.x branch (#347)
* Proposed fix for WW-5029 for the 2.5.x branch:
- NOTE: If the PR is accepted please credit Maxime Clement for this change as they found
        the issue, identified the probable cause/related details and opened the JIRA.
- Updated XWorkConfigurationProvider buildAllowedMethods(), loadGlobalAllowedMethods() so that
  they now handle situations when a SAX parser produces multiple elements to represent the tag
  body value.
- No changes to unit tests.

* Update commit to fix weakness identified by Maxime Clement:
- Implementation should now properly concatenate the node children values together (as a single unified string)
  in both buildAllowedMethods(), loadGlobalAllowedMethods() - before generating the method Set to be added.
- Made some eligible variables final.

* Update commit to provide new unit tests:
- Added unit tests to confirm the fixes for buildAllowedMethods(), loadGlobalAllowedMethods()
- Added Mock DOM classes sufficient for these tests.
- Added unit tests to cover buildResults() and loadGlobalResults().

(cherry picked from commit fb38a91)
2019-04-20 10:00:48 +04:30
JCgH4164838Gh792C124B5 f0776aeac6 (Amended commit based on feedback)
Proposed fix for WW-5028 for the 2.5.x branch:
- Disable printing stacktrace on exceptions by the Dispatcher by default.
- Printing stacktrace on exception is only enabled with devMode set to true, as suggested by L. Lenart.
- Now prints stacktrace on exception using LOG, as suggested by A. Mashchenko and the the JIRA reporter.
  Log level set to debug as recommended by Y. Zamani.
- Added two additional unit tests for Dispatcher devMode and handleException states.

(cherry picked from commit 4815744)
2019-04-20 09:11:49 +04:30
Lukasz Lenart 91c6a6f88f Merge pull request #346 from JCgH4164838Gh792C124B5/localS2_26x_B4
Forward port fix for WW-5024 to 2.6:
2019-04-01 09:26:07 +02:00
JCgH4164838Gh792C124B5 3e11e1db47 Forward port fix for WW-5024 to 2.6:
- NOTE: If the PR is accepted please credit Robert Hollencamp (Github @rhollencamp) for this change
        as he found the issue, proposed a solution for 2.6 (master), and opened the JIRA.
- Updated HttpParameters, ActionMappingParametersInterceptor to prevent multi-level Parameter wrapping from occuring.
- Updated HttpParameters create(), build() and buildNoNestedWrapping() to replace redundant type operators with <> based on IDE hint.
- Made HttpParameters parameters member final based on IDE hint.
- Added a new ActionMappingParametersInterceptorTest to verify the fix.
2019-03-31 23:44:40 -04:00
JCgH4164838Gh792C124B5 bb7cf092bc Forward-port fix for WW-5026 to 2.6.
- Equivalent to PR#342 for 2.5.x, fixes double-submit error 500 failure with
- Fixes error 500 processing failures for double-submit results with TokenSessionStoreInterceptor processing
- Fix to InvocationSessionStore, new unit test confirming fix in InvocationSessionStoreTest
- Minor whitespace fix to TokenSessionStoreInterceptor
2019-03-31 22:47:16 -04:00
JCgH4164838Gh792C124B5 d3eb1fc595 Fix for default (un-configured) allowStaticFieldAccess state, Showcase Application in 2.6.x (#334)
* Fix for default un-configured allowStaticFieldAccess state:
1) Ensure OgnlValueStackFactory returns true for allowStaticFieldAccess when not configured (consistency - same as OgnlUtil does).
2) Add test to OgnlValueStackTest for the no allowStaticXXX flags present.

Minor config fixes for the Showcase Application in 2.6.x:
1) File upload examples.  Multiple file upload missing result page (list and array), added missing JSP.  Added missing input results in configuration.
2) File upload examples.  Fixed NPE for multiple file upload (array version) when no files selected.
3) Add manual test for public constant access via expression (to If tag JSP).

* Added missed logic elements from PR#320 (identified by Y. Zamani):
1) Added ognlAllowStaticFieldAccess field and getter/setter to ConstantConfig.
2) Added allowStaticFieldAccess (set to true) to default.properties.

* Follow-up commit:
- Fixed wrong package reference in testNullMethod(), as well as in new tets.
- Added additional tests to cover the full set of static access flag combinations.

* Follow-up commit:
- Fixed createValueStack() not setting allowStaticFieldAccess parameter.
- Removed 3 unused import statement.
- Refactored OgnlValueStackFactory creation logic into two utility methods: getValueStackFactory(), reloadValueStackFactory()
- Added one additional test with a raw OgnlValueStackFactory generated OgnlValueStack (staticMethodAccess false, staticFieldAccess true).
  Test confirms same result as with a default OgnlValueStackFactory.
2019-03-11 09:35:48 +03:30
Yasser Zamani ce4f192676 add properties support to XWorkTestCase.loadButAdd
also includes cleanups for PRs #292 and #320

(cherry picked from commit a15c12a)
2019-02-24 18:51:00 +03:30
Aleksandr Mashchenko 9466b615ab Improve SecurityMemberAccess (#323)
* Improve SecurityMemberAccess

Move public member check to be the first performed
Remove final-s from methods to allow overriding
Split check for statics into two separate methods

* Change log level to warn
2019-02-10 23:17:27 +03:30
Aleksandr Mashchenko aacac5b9fc WW-5016 Support java8 date/time in date tag 2019-02-06 23:06:09 +02:00
Aleksandr Mashchenko f6e0cdeb67 WW-4991 Not existing property in listValueKey throws exception 2019-02-04 22:06:26 +02:00