Improve readability using stream api, while adding unit test for
refactoring validation.
Fix deniedWebShellTokens property where some blank space where removed
and '// python' comment was inlined.
The fix I did is two folds:
filters extensions (thanks to Zhujie's suggestion of a list of extensions to ban)
deletes bad files at the right place (thanks to thiscodecc's report)
Thanks: thiscodecc for the security report
This prevented to run the stable demo, hence the next, weirdly the trunk had
not this problem. Anyway better safe than sorry... Maybe related to Gradle
version or rather libs loaded?
The reason why the stable (and old) demos were not running is because the
EntitySaxReaderTests did not pass
Makes afterlogin.lastvisit.show to false by default and document that in the
security documentation, ie in
https://cwiki.apache.org/confluence/display/OFBIZ/How+to+secure+your+deployment
Else when working in dev mode you always have to remove or wait the message to
remove itself
Fixes wrong wiki links in sy-password-and-JWT.adoc
After some small study, it seem there is a problem because login request not
require authentication
I have tried to add a test to check if current request is login and only if it's
not to remove PREVIOUS_REQUEST Session Attribute, it seem better with this
modification.
Thanks: Olivier for the patch and Michael for suggesting to parameterize using
a property. I simply used EntityUtilProperties.getPropertyValue instead of
UtilProperties.getPropertyValue
Improved: Display last-visited-time popup after login (OFBIZ-12148)
To allow users to know of any unauthorised access to their accounts.
Thanks: Michael for review
2020/08/10 the OFBiz security team received a security report by Harshit Shukla
<harshit.shukz@gmail.com>, roughly it was (quoting part of it to simplify):
<<I have identified a Remote Code Execution (RCE) Vulnerability. The reason
behind this RCE is lack of file extension check at
catalog/control/UploadCategoryImage?productCategoryId=CATALOG1_BEST_SELL&pload_file_type=category>>
Using this post-auth RCE in OFBiz demos, Harshit was able to get some AWS
credentials by uploading a webshell (based on [0]).
By security, it was then decided by the Infra and OFBiz security teams to shut
down the demos.
After discussing the elements reported with Mark J Cox (VP of ASF security team)
we in common decided that no CVE was necessary.
(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
(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 :)
(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
(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
(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/trunk@1852882 13f79535-47bb-0310-9956-ffa450edef68
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
(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
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
(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
(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
(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
(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
(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
(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
(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
(OFBIZ-8537)
Committed wangjunyuan's new patch.
Thanks: wangjunyuan for the new patch to make the PBKDF2 hashed password comply with RFC 6070, the feedbacks of Jacques and Nicolas on the previous patch.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1773066 13f79535-47bb-0310-9956-ffa450edef68