Commit Graph
244 Commits
Author SHA1 Message Date
Suraj Khurana 8b1e0dbd85 Improved: Corrected all checkstyle formatting issues: 'typecast' is not followed by whitespace in framework component.
(OFBIZ-11887)
2020-07-18 12:26:42 +05:30
Suraj Khurana dd4da77d76 Improved: Corrected checkstyle formatting issues, 'is preceded/not preceded with whitespace' for framework component.
(OFBIZ-11874)
This fixes following checkstyle issues:
'{' is not preceded with whitespace.
'{' is not followed by whitespace.
'}' is not followed by whitespace.
'}' is not preceded with whitespace.
'typecast' is not followed by whitespace.
'try' is not followed by whitespace.
';' is preceded with whitespace.
2020-07-11 14:33:47 +05:30
Jacques Le Roux d0fceffadd Fixed: don't remove localhost from host-headers-allowed it was only for testing 2020-07-11 09:59:17 +02:00
Jacques Le Roux 3c9fe5f916 Improved: better message for host-headers-allowed
Adds an explanation about what to do when using own domain.

Some users don't look into the log so it's better to set also the exception
message in order for them to have it right at 1st glance.
2020-07-11 09:59:16 +02:00
Suraj Khurana 443025e37f Merge branch 'trunk' of https://gitbox.apache.org/repos/asf/ofbiz-framework into trunk 2020-07-07 15:10:53 +05:30
Suraj Khurana fc6b8a6ca3 Improved: Corrected remaining ', is not followed by whitespace' checkstyle errors in framework component.
(OFBIZ-11805)
2020-07-07 15:08:17 +05:30
Jacques Le Roux 16c2d35219 Documented: CsrfDefenseStrategy in case of no support for SameSite cookie attribute
Use of CsrfDefenseStrategy in case of potential use of a browser version not
supporting the SameSite cookie attribute

Refer to https://caniuse.com/#feat=same-site-cookie-attribute
2020-07-06 15:15:48 +02:00
Pawan Verma e19b12eae9 Improved: Replace explicit type argument with diamond operator(OFBIZ-11828)
Since Java 1.7, when defining generic types it is unnecessary to redefine those types in the constructor when it is already done in the declared type.
2020-06-28 01:04:51 +05:30
holivier 192059e3da Improvement: Help link using asciidoc files via generated html
(OFBIZ-11693)

Change release for all asciidoc files, now there area 3 publish site,
one per release
* site/trunk
* site/next   currently for the 18.12
* site/stable currently for the 17.12
2020-06-04 17:56:54 +02:00
Suraj Khurana abc7836dde Improved: Made MODULE as private data member of class instead of public in all framework components.
(OFBIZ-11739)
This will reduce checkstlye issues. Thanks Jacques for review.
2020-05-29 13:20:46 +05:30
Jacques Le Roux 10b8acd5d1 Improved: removes useless "@deprecated No replacement" comments in Java code
This follows a discussion on dev ML 5 days ago.
Those comments are useless because they are all related to Minilang and Minilang
is deprecated as a whole.
2020-05-27 09:26:56 +02:00
Jacques Le Roux a6e8b05135 Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Some people may want to use another TemplateClassResolver than SAFER_RESOLVER
This creates a new templateClassResolver security property and uses it in
FreeMarkerWorker::makeConfiguration by default
2020-05-18 12:06:28 +02:00
Jacques Le Roux e8e9db5b1a Improved: Prevent recurring errors block due to generateTokenForNonAjax
(OFBIZ-11609)

Fixes check style. I removed a space after a cast. That's how I wrote it so
far and that was wrong. BTW I did not invent it, our code is riddled of it:/

https://www.oracle.com/technetwork/java/javase/documentation/codeconventions-141388.html
2020-04-27 14:29:14 +02:00
Jacques Le Roux faf2827e67 Improved: Prevent recurring errors block due to generateTokenForNonAjax
(OFBIZ-11609)

Fixes the if(test): toString() is not the same than getCanonicalName()

Also while at it, in case of exception, uses NoCsrfDefenseStrategy as default
2020-04-27 12:36:17 +02:00
Jacques Le Roux cdb40c3d31 Improved: Prevent recurring errors block due to generateTokenForNonAjax
(OFBIZ-11609)

Fixes check style issues
2020-04-26 14:21:59 +02:00
Jacques Le Roux 1ff79ec566 Improved: Prevent recurring errors block due to generateTokenForNonAjax
(OFBIZ-)

After the VM demos crash yesterday, I had a look at the log of trunk demo and
found a lot of recurring errors block due to CsrfUtil::generateTokenForNonAjax.

It's not a big deal but it's annoying to have such useless errors cluttering the
logs
2020-04-26 12:38:05 +02:00
Jacques Le Roux a721ba7557 Documented: fixes wrong indentations 2020-04-20 18:57:58 +02:00
Jacques Le Roux 07a472f89c Documented: improves security.properties documentation 2020-04-15 19:31:51 +02:00
Jacques Le Roux fdb995fd50 Documented: adds CSRF defense and updates password and JWT 2020-04-15 19:30:53 +02:00
Jacques Le Roux d8025d41dc Improved: Add security.internal.sso.enabled and security.token.key
SystemProperties

(OFBIZ-11594)(OFBIZ-11470)

After adding more latitude to set same site by using
EntityUtilProperties::getPropertyValueFromDelegatorName for retrieving the value
possibly from the DB as a SystemProperty, adds the value as strict in
SSOJWTDemoData.xml
2020-04-15 15:15:13 +02:00
Jacques Le Roux ff9335ac8c Improved: Add security.internal.sso.enabled and security.token.key
SystemProperties

(OFBIZ-11594)

This comes handy when testing, from examples component, the internal SSO feature
which allows a token based login between OFBiz instances

The SSOJWTDemoData.xml inadvertently slipped in w/ previous commit
2020-04-13 12:14:48 +02:00
Jacques Le Roux e1988a29c8 Improved: moves "10 seconds" comments from security.properties to CommonEvents.java
Also removes trailing blanks in security.properties
2020-04-13 11:40:58 +02:00
Jacques Le Roux 03780e4665 Fixed: "entity/list" request is not handled well
(OFBIZ-11593)

Fixes the resolveURIBasicOverrideView test
2020-04-13 11:38:04 +02:00
Jacques Le Roux 7958d6d55d Fixed: Updates checkstyleMain.maxErrors to fits with Buildbot report
Never ever install Eclipse Checkstyle plugin. It does not use the same version
than Gradle, it's then a mess (Eclipse's is newer).

Fixes issues in CsrfUtilTests.java
2020-04-06 19:23:14 +02:00
Jacques Le Roux b95fa36bf4 Improved: follow checkstyle conventions in files committed for CSRF token defense
Mostly manually-automated, so some changes are not perfect. I have manually
changed back excessive ones

Comments out ArrayTypeStyle checkstyle
Updates checkstyleMain.maxErrors
2020-04-06 12:05:16 +02:00
Jacques Le Roux ddb8f4273a Improved: replaces module by MODULE everywhere 2020-04-05 19:46:34 +02:00
Jacques Le Roux ab9b048d07 Improved: fixes a Javadoc issue 2020-04-05 12:29:47 +02:00
Jacques Le Roux ba707d45be Implemented: POC for CSRF Token
(OFBIZ-11306)

Simple strategy is to rely on SameSite 'strict' value in SameSiteFilter in all
supported branches. No backport needed with the changes here.

Thanks: James for all the good work we did together :)
2020-04-05 11:29:40 +02:00
Jacques Le Roux e0f0d5271a Fixed: Prevent Host Header Injection (CVE-2019-12425)
(OFBIZ-11583)
2020-04-04 19:32:02 +02:00
Jacques Le Roux 645d419574 Merge branch 'trunk' into POC-for-CSRF-Token-OFBIZ-11306 2020-04-04 17:52:06 +02:00
Jacques Le Roux 768353a093 Improved:
Implemented:
Documented:
Completed:
Reverted:
Fixed:

(OFBIZ-)
Explanation
Thanks:
2020-04-04 15:49:49 +02:00
Jacques Le Roux 11c75b6661 Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

Fixes a typo
2020-04-04 15:49:40 +02:00
Jacques Le Roux 866c742e8f Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

It's better to allow users to change from strict to lax, at least for all
cookies. Some could want to change it by cookie type. I let the exercise for
them :)
See:https://blog.mozilla.org/security/2018/04/24/same-site-cookies-in-firefox-60
2020-04-04 15:49:40 +02:00
Jacques Le Roux c2fb314a1b Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

Fixes a typo
2020-03-21 12:02:03 +01:00
Jacques Le Roux fd1e7f477b Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

It's better to allow users to change from strict to lax, at least for all
cookies. Some could want to change it by cookie type. I let the exercise for
them :)
See:https://blog.mozilla.org/security/2018/04/24/same-site-cookies-in-firefox-60
2020-03-21 11:55:53 +01:00
Michael Brohl d3907529c3 Implemented: Remove the user login security question.
(OFBIZ-11244)

Thanks Wiebke Pätzold for providing the patch.
2020-03-21 11:31:47 +01:00
Michael Brohl bb698b9b96 Implemented: Remove the user login security question.
(OFBIZ-11244)

Thanks Wiebke Pätzold for providing the patch.
2020-03-13 17:31:49 +01:00
Jacques Le Roux c34491892a Improved:
Implemented:
Documented:
Completed:
Reverted:
Fixed:
Improved: no functional change
(OFBIZ-)
Explanation
Thanks:
2020-02-27 14:36:26 +01:00
Gil Portenseigne 8653b6374e Improved: Error in user impersonation with sub permission
(OFBIZ-11342)

Improved javadoc
Set 'checkMultiLevelAdminPermissionValidity' visibility to default
Add another test verifying that hierarchy in permission is respected

Thanks Mathieu for your review
2020-02-13 15:36:59 +01:00
Gil Portenseigne c73b97eb29 Fixed: Error in user impersonation with sub permission
(OFBIZ-11342)

Add unit tests for permission control feature.
Add new method to manage multilevel permission control.
This allowing an user with PARTYMGR_ADMIN permission to impersonate
another user with PARTYMGR_PCM_CREATE permission.
2020-02-12 09:53:45 +01:00
Mathieu Lirzin aae1c8a8f5 Reverted: "Improved: Use ‘depends-on’ attribute instead of “component-load.xml”"
(OFBIZ-11296)

This reverts commit eeabe69813.
2019-12-18 12:09:20 +01:00
Mathieu Lirzin eeabe69813 Improved: Use ‘depends-on’ attribute instead of “component-load.xml” (OFBIZ-11296)
We currently have two ways to define component loading order. Either
by using ‘depends-on’ attribute in “component-config.xml” or by adding
a “component-load.xml” file at the root of a component directory.

“depends-on” is more flexible because it handles partial ordering when
“component-load.xml” defines a total order which is not necessarily
meaningful, so it is better to rely only “depends-on”.

This removes the usage of “component-load.xml” to use ‘depends-on’
instead. The dependency declarations correspond to the total ordering
previously defined but will need to be refined in the future to relax
unnecessary dependency declarations.

Only “framework/base/config/component-load.xml” which defines the
top-level directories order (framework, applications, themes and
plugins) is kept.
2019-11-25 15:28:54 +01:00
Jacques Le Roux bbd77ef52a Improved: Document how to store the JWT secret key
(OFBIZ-10751)

Adds a link to OWASP documentation

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866936 13f79535-47bb-0310-9956-ffa450edef68
2019-09-14 10:52:54 +00:00
Jacques Le Roux 1a92cf0850 Improved: Document how to store the JWT secret key
(OFBIZ-10751)

Adds a link to OFBIZ-11187

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866596 13f79535-47bb-0310-9956-ffa450edef68
2019-09-08 08:17:54 +00:00
Jacques Le Roux 70969b29ed Improved: Document how to store the JWT secret key
(OFBIZ-10751)

Fixes a typo

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866544 13f79535-47bb-0310-9956-ffa450edef68
2019-09-07 06:26:52 +00:00
Jacques Le Roux 1841c00154 Improved: Document how to store the JWT secret key
(OFBIZ-10751)

AS discussed in dev ML at https://markmail.org/message/dtjnu7fdi5noeagk and 
previously in OFBIZ-9833 & OFBIZ-10307 we want to document how to store the 
JWT secret key. 

We agreed about keeping it as a property OOTB; and giving a link from the 
security properties file to suggest how to better do it in production.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866519 13f79535-47bb-0310-9956-ffa450edef68
2019-09-06 15:37:22 +00:00
Jacques Le Roux ab50c75752 Fixed: Any ecommerce user has the ability to reset anothers password
(including admin) via "Forget Your Password"
(OFBIZ-4361)

Adds the security.token.key value and change the login.secret_key_string value

The security.token.key value is not mandatory for the "Forget Your Password"
feature but then only the username and password are used to create the JWT key.

Adds a reference for both properties to the 
"Passwords and JWT (JSON Web Tokens) usage" 
documentation to suggest users to choose the way to store these keys

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866518 13f79535-47bb-0310-9956-ffa450edef68
2019-09-06 15:34:09 +00:00
Jacques Le Roux 7d7a441715 Fixed: Any ecommerce user has the ability to reset anothers password
(including admin) via "Forget Your Password"
(OFBIZ-4361)

Currently, any user (via ecommerce "Forget Your Password") has the ability to 
reset another users password, including "admin" without permission.  
By simply entering "admin" and clicking "Email Password", the following is 
displayed:

The following occurred:
A new password has been created and sent to you. Please check your Email.

This now forces the user of the ERP to change their password.  
It is also possible to generate a dictionary attack against ofbiz because there 
is no capta code required.  This is serious security risk.

I have modified the patch following comments I made in the Jira, notably
  Removed unused Java variables
  Removed a check in LoginEvents::forgotPassword which prevented to show error
    messages
  Changed fr and en SecurityExtPasswordSentToYou 
    + SecurityExtThisEmailIsInResponseToYourRequestToHave labels 
    + template PasswordEmail.ftl
    + loginservices.token_incorrect labels
  Added fr and en SecurityExtIgnoreEmail + SecurityExtLinkOnce labels
  Removed changes in general.properties
  I did not remove the 2 GetSecurityQuestion.ftl files (webpos one was still in)

There is still room for improvement. I'll discuss them on the Jira and dev
ML. But this version is already strong enough to not wait that the patch is 
inapplicable!

Thanks: mz4wheeler (Mike Z) for the Jira, Nicolas Malin for the patch, I guess 
with some Gil's help, and all others for comments and ideas

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866478 13f79535-47bb-0310-9956-ffa450edef68
2019-09-05 15:56:46 +00:00
Jacques Le Roux 24ae8bed84 Improved: Unknown request [images]; this request does not exist or cannot be
called directly.
(OFBIZ-11152)

Gives an advice to reassure users about the seriousness of the issue

This issue can be easily reproduced by going to example/control/FormWidgetExamples
Other backend components are less concerned but it happens sometimes in them too.
It's quite hard to understand what's happening.
This is a sequel of OFBIZ-10895

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866255 13f79535-47bb-0310-9956-ffa450edef68
2019-09-02 07:05:08 +00:00
Mathieu Lirzin cf79277608 Improved: Remove redundant "dtd" directory from classpath
(OFBIZ-11161)

the "dtd" directories are already present as resources distributed
inside OFBiz jar, so there is no need to augment the classpath to find
the XML schema inside those directories.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865796 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 00:29:41 +00:00