Commit Graph
208 Commits
Author SHA1 Message Date
Jacques Le Roux ecc4e84a95 Fixed: don't remove localhost from host-headers-allowed this was only for testing 2020-07-11 09:57:04 +02:00
Jacques Le Roux c70fa51ae7 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.

Conflicts handled in webapp/control/RequestHandler.java
2020-07-11 09:47:23 +02:00
holivier 4568c6f55a Improvement: Help link using asciidoc files via generated html
(OFBIZ-11693)

Change release to 18.12 for all asciidoc files where there is still
17.12
2020-06-05 14:37:03 +02:00
Jacques Le Roux b97d6bf1e2 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

Conflicts handled by hand
  framework/security/config/security.properties
2020-05-18 13:29:20 +02:00
Jacques Le Roux 3e22e45c36 Documented: Adds the CSRF defense documentation (missed the add last time) 2020-04-15 19:42:39 +02:00
Jacques Le Roux 18b3fa80ad Documented: Adds the CSRF defense documentation 2020-04-15 19:37:48 +02:00
Jacques Le Roux 5530e23738 Fixed: Prevent Host Header Injection (CVE-2019-12425)
(OFBIZ-11583)
2020-04-05 11:35:33 +02:00
Jacques Le Roux 9fa3dbe1ea Revert "Merge branch 'JacquesLeRoux-POC-for-CSRF-Token-OFBIZ-11306' into trunk"
This reverts commit 0add8bedbc.
2020-04-05 10:04:15 +02:00
Jacques Le Roux 0add8bedbc Merge branch 'JacquesLeRoux-POC-for-CSRF-Token-OFBIZ-11306' into trunk
Because of GitHub message on PR56:
This branch cannot be rebased due to conflicts

Conflicts handled by hand
RequestHandler.java
2020-04-04 18:33:11 +02:00
Jacques Le Roux d08a0527c4 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:56:39 +01:00
Gil Portenseigne 767e17d02d 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:32:39 +01:00
Gil Portenseigne 43bfbcf4f2 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:55:41 +01:00
Gil Portenseigne e6021be638 Fixed: Update release revision number into embedded documentation
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1868932 13f79535-47bb-0310-9956-ffa450edef68
2019-10-25 13:35:05 +00:00
Nicolas Malin 4406d24877 Fixed: Any ecommerce user has the ability to reset anothers password
(including admin) via 'Forget Your Password'
(OFBIZ-4361)
Trunk backport r1866478 and r1866518

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/branches/release18.12@1867296 13f79535-47bb-0310-9956-ffa450edef68
2019-09-21 19:12:23 +00:00
Jacques Le Roux 83c71d208b Improved: Document how to store the JWT secret key
(OFBIZ-10751)

Copy manually all files from trunk because of weird conflicts

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1866938 13f79535-47bb-0310-9956-ffa450edef68
2019-09-14 11:37:37 +00:00
Michael Brohl be5f4bddb6 Applied fix from trunk for revision: 1852882
===

Fixed: Error parsing JWT
(OFBIZ-10814)

Fixes incorrect retrieval of the Authorization header JWT token. 
Fixes wrong API usage for the key parameter which assumed the key is
provided in BAS64 format.
Refactored the code to use helper methods for key and auth header 
retrieval.
Javadoc corrections and enhancements.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1852884 13f79535-47bb-0310-9956-ffa450edef68
2019-02-04 09:26:42 +00:00
Jacques Le Roux d53238e430 Improved: Tomcat SSO in Cluster
(OFBIZ-10123)

Finally this was not done, noted in security.properties

Thanks: James Yong for the proposition, Michael for the discussionn in 
OFBIZ-10047

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1849796 13f79535-47bb-0310-9956-ffa450edef68
2018-12-27 10:18:32 +00:00
Deepak Dixit 089e840be8 Fixed: Relation UserLogin of entity UserLoginHistory is not unique for that entity
(OFBIZ-10515)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1849192 13f79535-47bb-0310-9956-ffa450edef68
2018-12-18 16:31:55 +00:00
Jacques Le Roux bbfc62d47a Improved: Fix or Silence various warnings
(OFBIZ-10701)

In order to detect potential issues early, the linting compiler option should be 
used by default and disabled with {{./gradlew -PXlint:none build}}.

Additionally it is important to reduce the number of warnings otherwise new 
warnings will remain unnoticed.

The warning related to the com.googlecode.concurrentlinkedhashmap dependency 
should resolves itself once we handle upgrade to Caffeine like proposed in 
OFBIZ-6747.

Thanks: Mathieu Lirzin

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1848673 13f79535-47bb-0310-9956-ffa450edef68
2018-12-11 13:33:49 +00:00
Jacques Le Roux f5cd96479b Documented: no functional change
Fixes security-impersonation.adoc file name to sy-impersonation.adoc



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1847224 13f79535-47bb-0310-9956-ffa450edef68
2018-11-23 08:53:02 +00:00
Jacques Le Roux 159fb21f80 Documented: no functional change
Renames the security doc dir to docs as requested by documentation guidelines
Includes webapp.adoc in developer-manual.adoc



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1847078 13f79535-47bb-0310-9956-ffa450edef68
2018-11-21 08:15:36 +00:00
Jacques Le Roux fbfa0daa5a Implemented: Navigate from a domain to another with automated signed in
authentication
(OFBIZ-10307)

This uses a JWT Token authentication to get from one domain, where you are 
signed in, to another domain where you get signed in automatically. 
Something like ExternalLoginKey or Tomcat SSO, but not on the same domain.

In the example component, the FormWidgetExamples screen contains 2 new fields 
in the LinksExampleForm which demonstrate the use from a local instance to the
trunk demo instance.

A simple documentation is available in 
  framework\webapp\src\docs\asciidoc\_include\wa-cross-domains-SSO.adoc

Thanks: Taher for review

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1844880 13f79535-47bb-0310-9956-ffa450edef68
2018-10-26 09:32:46 +00:00
Gil Portenseigne 54ad6c68fa Fixed : Impersonation of userLogin feature
(OFBIZ-10515)

Fix default value of impersonation feature to true (unchanged after last test before commit...) 

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1842111 13f79535-47bb-0310-9956-ffa450edef68
2018-09-27 16:11:40 +00:00
Gil Portenseigne a61c98775f Implemented : Impersonation of userLogin feature
(OFBIZ-10515)

Introduce a new feature that allow the impersonation of a login by an authorized user.
Add the documentation with all the details in security-impersonation.adoc.
Big thanks to Leila, Nicolas and Jacques for your contribution to this implementation.
Big thanks to Mathieu, Jacques, Pierre and Taher for your remarks and reviews that
improved this contribution quality. 

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1842110 13f79535-47bb-0310-9956-ffa450edef68
2018-09-27 16:01:35 +00:00
Jacques Le Roux ca9b1bbd41 Reverted: Navigate from a domain to another with automated signed in
authentication
(OFBIZ-10307)

This reverts the work done previously for OFBIZ-9833 and OFBIZ-10206
Most parts of it will actually be reused later in a patch. By reverting it will 
allow to provide a patch for others to review


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1833510 13f79535-47bb-0310-9956-ffa450edef68
2018-06-14 14:37:24 +00:00
Rishi Solanki bc4a0cbfc3 Improved: Remove Entity suffix from title of all entities. In all EntityModel.xml files, title should not contain Entity as suffix.
(OFBIZ-10408)
Thanks to Suraj Khurana for reporting the improvement and providing fix for that.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1832235 13f79535-47bb-0310-9956-ffa450edef68
2018-05-25 12:19:07 +00:00
Rishi Solanki cfef87d6f1 Improved: Remove empty field values from xml data files so that it will not override existing data with empty values. Removed all empty data fields from data files.
(OFBIZ-10282)
Thanks to Arun Patidar for reporting and review.
Thanks to Suraj Khurana for providing patch for the improvement.
Thanks to Jacques for discussion and finalizing the work.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1830545 13f79535-47bb-0310-9956-ffa450edef68
2018-04-30 10:52:55 +00:00
Taher A. Alkhateeb 19b879e257 Reverted: commit r1825436, inconsistency in results between me and buildbot
WIP, to investigate


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1825438 13f79535-47bb-0310-9956-ffa450edef68
2018-02-27 10:53:59 +00:00
Taher A. Alkhateeb cc022f8c4a Fixed: a bug in loading seed-only data into the system
When calling OFBiz with the command gradlew "ofbiz -l readers=seed-initial"
the system crashes. The reason is because of a faulty dependency of
"seed-initial" data in the entityext component to "seed" data in the security
component. The fix is simply to change the type of reader for the requested
data in SecurityPermissionSeedData.xml from "seed" to "seed-initial"


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1825436 13f79535-47bb-0310-9956-ffa450edef68
2018-02-27 10:41:14 +00:00
Jacques Le Roux 5977381e62 Reverted: Secure the login.secret_key_string
(OFBIZ-9966)

I forgot to revert this part; I guess got conflict issues and then forgot.

I'll also revert in R16 and R17 and close as won't fix, I gave my arguments
that's enough for me.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1824855 13f79535-47bb-0310-9956-ffa450edef68
2018-02-20 11:59:07 +00:00
Jacques Le Roux f26b20885a No functional change, removes reference to MD5 in comments. It's not used anymore
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1824128 13f79535-47bb-0310-9956-ffa450edef68
2018-02-13 12:51:30 +00:00
Jacques Le Roux 619d31e331 Completed:: Security issue in Token Based Authentication
(OFBIZ-10206)

Updates the security.properties content related to JWT
 Refers to the last up to date external-server-test-example.patch at OFBIZ-10206
 Makes demo-trunk.ofbiz.apache.org default external-server-name so that anybody
 can try the feature from own machine. The use-external-server=Y was already set

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1823467 13f79535-47bb-0310-9956-ffa450edef68
2018-02-07 14:17:51 +00:00
Jacques Le Roux 97a9b690dd Fixed: Security issue in Token Based Authentication
(OFBIZ-10206)

The version I committed so far in OFBIZ-9833 has a small security issue.
See the Jira description for all details

To test I have attached a OFBIZ-10206-external-server-test-example.patch to 
the Jira

This removes the external-server-query property now useless

In  ContextFilter the getHeader (wrapper) now uses an autoLoginCookie to get 
the userLoginId passed in the JWT instead of externalServerUserLogin parameter.
A sourceServerWebappName parameter must be passed from the client request to
allow reading the autoLoginCookie.

This userLoginId is then retrieved on the target server from the JWT in the 
externalServerLoginCheck which is simplified.

In LoginWorker
  getAutoLoginCookieName() has now 2 versions to allow to pass a webappname

  A new autoLogoutFromAllBackendSessions() method has been added but for now 
  commented out. Decommenting it out will be submitted as a patch in OFBIZ-4959.

Thanks: Leila Mekika for reporting the security issue directly to me

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1823324 13f79535-47bb-0310-9956-ffa450edef68
2018-02-06 13:17:57 +00:00
Jacques Le Roux 714e6e3521 Improved: Token Based Authentication
(OFBIZ-9833)

I just thought that for security it's best to have both the source and 
target server using the use-external-server property.

Also default to N when requesting this property

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1822882 13f79535-47bb-0310-9956-ffa450edef68
2018-02-01 15:27:17 +00:00
Jacques Le Roux 9b6e65bd20 No functional change, clarifies for demo
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1822877 13f79535-47bb-0310-9956-ffa450edef68
2018-02-01 14:41:48 +00:00
Jacques Le Roux 492c78a4d5 No functional change, just clarifies things a bit
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1822518 13f79535-47bb-0310-9956-ffa450edef68
2018-01-29 15:27:25 +00:00
Jacques Le Roux 0ca7c12475 Improved: Token Based Authentication
(OFBIZ-9833)

No functional change

As reported by Jinghai on dev ML we should better use "Authorization" than
 "Authorisation" when retrieving the JWT token, even if both are accepted
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
Also improves the comment on token ttl

Thanks: Jinghai for report

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1821600 13f79535-47bb-0310-9956-ffa450edef68
2018-01-19 08:39:05 +00:00
James Yong ba2e822f27 Implemented: Tomcat SSO
(OFBIZ-10047)

This allow developers the option to use Tomcat SSO, instead of externalLoginKey, for SSO.

Thanks: Jacques and Michael for the reviews

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1819133 13f79535-47bb-0310-9956-ffa450edef68
2017-12-23 10:39:44 +00:00
Jacques Le Roux 35ee954560 Completed: Remove applet concept in OFBiz
(OFBIZ-10094)

Following discussion at http://markmail.org/message/dlp4zoo3xxuiefpn :

While reviewing http://svn.apache.org/viewvc?view=revision&revision=1811438 
I stumbled upon the usage of Java Applets

It's still possible to use Java Applets in browsers but most of the time it's 
not OOTB https://www.digitalcitizen.life/how-enable-java-all-major-web-browsers

And Java 9 deprecates it https://www.java.com/en/download/faq/jdk9_plugin.xml


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1818646 13f79535-47bb-0310-9956-ffa450edef68
2017-12-19 10:33:15 +00:00
Jacques Le Roux 40e8be83df Improved: Always check if debug verbose is on when using Debug.logVerbose()
(OFBIZ-10052)

This completes r1818010, there were much more cases.
Also few tabs automatically replaced by spaces

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1818020 13f79535-47bb-0310-9956-ffa450edef68
2017-12-13 14:11:38 +00:00
Jacques Le Roux e0d2057456 Improved: Always check if debug verbose is on when using Debug.logVerbose()
(OFBIZ-10052)

We discussed on this point: http://markmail.org/message/mplvusuqn7oshl4v 
and we agreed about better doing a check when using Debug.logVerbose().

I checked there are 300+ cases like that. Since it's an easy S/R 
This implements it

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1818005 13f79535-47bb-0310-9956-ffa450edef68
2017-12-13 12:43:05 +00:00
Jacques Le Roux 0d0badf38e Implemented: Token Based Authentication
(OFBIZ-9833)

I have tested the Token Based Authentication between my local machine and the 
trunk demo. It works as expected.

This completes the previous commit by:
  adding a new externalServerLoginCheck pre processor
  Documenting how to set the ExternalServerJwtMasterSecretKey in production
    using sed and uuidgen
  Adding documenting properties in security.properties, not set to be used OOTB
   but ready to be set in production

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1814363 13f79535-47bb-0310-9956-ffa450edef68
2017-11-05 17:33:30 +00:00
Jacques Le Roux 8289e03096 Fixed: Secure the login.secret_key_string
(OFBIZ-9966)

When OFBIZ-4983 was implemented I missed that we put the login.secret_key_string
 as a property in security properties. This should not have been because it 
eases attackers work.

The recommended way is to have it as a private static final String that can be 
changed just when compiling using sed and uuidgen. So then the key is temporay 
and final and it gets quite harder for a possible attacker to use this mean.



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1814349 13f79535-47bb-0310-9956-ffa450edef68
2017-11-05 11:28:42 +00:00
Jacques Le Roux 77be02222b Reverts, this slipped in inadvertently with r1814292
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1814348 13f79535-47bb-0310-9956-ffa450edef68
2017-11-05 11:07:50 +00:00
Jacques Le Roux 8693fb0bdc Improved: Replace Inline Javascript with External Javascript
(OFBIZ-9465)

As discussed in http://ofbiz.markmail.org/thread/ti54omjdt4fy662m 
inline javascript for various macros like renderLookupField, makeHyperlinkString,
shortDateInput etc in HtmlFormMacroLibrary.ftl should be replaced with a generic 
code written as external javascript. Generic Javascript code should be written 
in OfbizUtil.js and appropriate classes or identifiers should be used for 
applying that. Any additional data can be passed with HTML 5 custom data attribute 
(https://www.w3.org/TR/2011/WD-html5-20110525/elements.html
#embedding-custom-non-visible-data-with-the-data-attributes).


Deepak: I think we can use data-mask attribute to recognize the element instead 
of adding class. 

jeloux: I noticed a MaskFieldExampleForm was introduced with r1804027 but
not used in FormWidgetExampleScreens.xml so was not visible


Thanks: Aditya and Deepak


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1814292 13f79535-47bb-0310-9956-ffa450edef68
2017-11-04 14:06:56 +00:00
Deepak Dixit 2a8a37f308 Improved: Manage life span of SecurityGroupPermission entity.
Applied patch from jira issue(OFBIZ-9801) Thanks Suraj Khurana for your contribution


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1812383 13f79535-47bb-0310-9956-ffa450edef68
2017-10-17 10:47:47 +00:00
Michael Brohl 57aa05a457 Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.security.
(OFBIZ-9635)

Thanks Dennis Balkir for reporting and providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1811429 13f79535-47bb-0310-9956-ffa450edef68
2017-10-07 14:15:58 +00:00
Rishi Solanki 3d29d37572 Improved: Extend SecurityGroup entity and add name/groupName field. Added groupName field to entity SecurityGroup and related changes done in the data, services and UI. (OFBIZ-9620)
Thanks Suraj Khurana for your patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1809386 13f79535-47bb-0310-9956-ffa450edef68
2017-09-23 10:16:17 +00:00
Deepak Dixit a0d99ed40f Improved: Replace fields with id-ne, id-long-ne and id-vlong-ne by id, id-long and id-vlong respectively which are not primary keys (OFBIZ-9355)
Thanks Aditya Sharma for your contribution.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1804026 13f79535-47bb-0310-9956-ffa450edef68
2017-08-03 17:51:07 +00:00
Deepak Dixit 18d4cc3381 Improved: Replace fields with "id-ne", "id-long-ne" and "id-vlong-ne"
with "id", "id-long" and "id-vlong" respectively which are primary keys
(OFBIZ-9351)
Thanks Aditya Sharma for your contribution.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1796379 13f79535-47bb-0310-9956-ffa450edef68
2017-05-27 11:28:36 +00:00