Commit Graph
27737 Commits
Author SHA1 Message Date
Harutyun Farajyan 4594fc4964 Improved: Convert PartyPermissionServices.xml from mini lang to groovy
(OFBIZ-11433)

Thanks to Harutyun Farajyan for providing the patch
2020-04-04 15:49:43 +02:00
Jacques Le Roux c9d516d367 Fixed: The createTaskContent request does not work
(OFBIZ-11246)

It seems that same request can not be parsed multiple times if it has multi part
object in it as the parse method remove it after that.

Found one stackoverflow link around the same:

https://stackoverflow.com/questions/13881272/
servletfileuploadparserequestrequest-returns-an-empty-list

I believe that all places/uploads using this workflow should resulting the same
issue.

One possible solution I could think of without going with new approach is to set
list of file Items into the request attribute and use it if parse method remove
it and unable to retrieve on 2nd call.

Thanks: Ankush Upadhyay for the analysis and initial patch. I only slightly
modified it.
2020-04-04 15:49:43 +02:00
Jacques Le Roux e666c65b7c Improved: Improve Web Content Caching
(OFBIZ-11477)

According to OWASP OFBiz Web Content Caching is weak:

Independently of the cache policy defined by the web application, if caching web
application contents is allowed, the session IDs must never be cached, so it is
highly recommended to use the Cache-Control: no-cache="Set-Cookie, Set-Cookie2"
directive, to allow web clients to cache everything except the session ID

I though noticed that Set-Cookie2 is deprecated for a long time now. And we new
browsers policies it to often updated. So no need to use Set-Cookie2.
2020-04-04 15:49:43 +02:00
Jacques Le Roux ae3ae26698 Improved: type="text/css" was missing on a call to <<link rel="stylesheet/less>>
This was reported by OWASP ZAP: "The Content-Type header is missing or empty."
Considered a low vulnerability
2020-04-04 15:49:43 +02:00
Jacques Le Roux f2e69894fb Improved: Implement the pretty print for keyword search
(OFBIZ-11476)

With OFBIZ-9164 and r1835891 I introduced
keywordConstraint::prettyPrintConstraint without implementation.
So the information is missing at top of page.

This implements it. It also amends 2 French labels
2020-04-04 15:49:42 +02:00
Jacques Le Roux 060e9ab950 Improved: no functional change
Adds /uploads/ in .runtime/.gitignore
2020-04-04 15:49:42 +02:00
Pierre Smits 6c66ce0dc2 Fixed: DataModel - correct foreign key (#51)
(OFBIZ-11474)

Renaming foreign key to PROD_PRCDE_OPCD
2020-04-04 15:49:42 +02:00
Pierre Smits c89e9346ba Improved: unify style application
(OFBIZ-11458)

remove unused property 'align-float'
2020-04-04 15:49:42 +02:00
Pierre Smits 321e51602a Improved: unify style application
(OFBIZ-11458)

replace 'align-float' with 'align-text'
2020-04-04 15:49:42 +02:00
Pierre Smits 20cf076c44 Improved: unify style application
(OFBIZ-11458)

replace 'align-float' with 'align-text'
2020-04-04 15:49:42 +02:00
Pierre Smits 48e81c48db Improved: style alignment properties
(OFBIZ-11458)

Adding alignment properties (creating consistency across themes.
2020-04-04 15:49:41 +02:00
Pawan Verma 4d2e5d3e26 Fixed: Specified key was too long; max key length is 767 bytes for ProductPromoCodeEmail entity.(OFBIZ-5426) (#44)
* Fixed: Specified key was too long; max key length is 767 bytes for ProductPromoCodeEmail entity.
(OFBIZ-5426)

The problem is in the entity model. An email address should not be used in the primary key - mainly because an email address is case-insensitive. A better design would be to use the email address contact mechanism ID in the primary key.

Done Following:
1. Changed Entity Name from ProductPromoCodeEmail to ProductPromoCodeContMech
2. Related Changes for the entity name change
3. Migration service to migrate old data

Thanks, Leon for the report and Adrian Crum, Jacques Le Roux, Ingo Wolfmayr, Deepak Dixit, Pierre Smits and Gil Portenseigne for the discussion and review.

* Improved: Added new line in service definition file and lincence in MigrationServices file.
(OFBIZ-5426)

Thanks, Jacopo for the review.
2020-04-04 15:49:41 +02:00
Jacques Le Roux 43f46399ff Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes check style errors
2020-04-04 15:49:41 +02:00
Jacques Le Roux c68d43efa2 Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes an issue due to Eclipse automated import organisation.

There are still check style errors
2020-04-04 15:49:41 +02:00
Jacques Le Roux d1ca68c166 Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes a check issue (line too long)

Notice: on Windows I get 20 errors when compiling:
> Task :compileTestJava FAILED
C:\projectsASF\Git\ofbiz-framework\framework\widget\src\test\java\org\apache\
ofbiz\widget\renderer\macro\MacroFormRendererTest.java:134:
error: annotation type not applicable to this kind of declaration
        @Mock
        ^
I guess the change in build.gradle are not enough for Windows, to be seen later...
2020-04-04 15:49:41 +02:00
Daniel Watford 1fbf6c3d6b Improved: Added license header to MacroFormRendererTest
(OFBIZ-4035)
2020-04-04 15:49:41 +02:00
Daniel Watford 87277ab992 Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)
2020-04-04 15:49:40 +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 6c49411ee7 Improved: "auth" should be true for all the request url used for Application
components

(OFBIZ-4956)

Currently there are some URLs present in application components with
auth="false". So anyone can hit these URLs and access these resources without
authorization.
I think all the URLs should be secure with auth="true"

jleroux: I have also fixed the dataResourceId="GZ-DIG"

Thanks: Amardeep Singh Jhajj for report and initial fix
2020-04-04 15:25:51 +02:00
Ulrich Heidfeld 8ee522e42e Improved: Decodes AjaxAutocompleteOptions return value
(OFBIZ-11475)
2020-04-02 09:15:45 +02:00
Pawan Verma 3b86754e14 Improved: Added new data model changes done under OFBIZ-5426 in DataModel changes file. (#55)
(OFBIZ-5426)

Thanks, Deepak Dixit for the report.
2020-03-30 23:21:43 +05:30
Jacques Le Roux 019b58859e Improved: POC for CSRF Token
(OFBIZ-11306)

There is no need to change it there because, apart the ecommerce application,
there are no applications that requires an anonymous flow.
It should be only changed in ecommerce controller.
2020-03-27 14:42:40 +01:00
Nicolas Malin e922d34e59 Fixed: correct path to ftpAddress services
(OFBIZ-11359)

After the minilang ContactMarchServices.xml to groovy, I forgot to change
the path of existant ftpAddress services already present before.

Thanks to Olivier Heintz for this alert
2020-03-27 11:46:11 +01:00
Nicolas Malin b6944ded4c Fixed: correct path to ftpAddress services
(OFBIZ-11359)

After the minilang ContactMarchServices.xml to groovy, I forgot to change
the path of existant ftpAddress services already present before.

Thanks to Olivier Heintz for this alert
2020-03-27 11:41:03 +01:00
Harutyun Farajyan ae686c3ff6 Improved: Convert PartyPermissionServices.xml from mini lang to groovy
(OFBIZ-11433)

Thanks to Harutyun Farajyan for providing the patch
2020-03-27 11:11:32 +01:00
Jacques Le Roux f4acda5ade Fixed: The createTaskContent request does not work
(OFBIZ-11246)

It seems that same request can not be parsed multiple times if it has multi part
object in it as the parse method remove it after that.

Found one stackoverflow link around the same:

https://stackoverflow.com/questions/13881272/
servletfileuploadparserequestrequest-returns-an-empty-list

I believe that all places/uploads using this workflow should resulting the same
issue.

One possible solution I could think of without going with new approach is to set
list of file Items into the request attribute and use it if parse method remove
it and unable to retrieve on 2nd call.

Thanks: Ankush Upadhyay for the analysis and initial patch. I only slightly
modified it.
2020-03-27 10:55:59 +01:00
Jacques Le Roux 2bb1de22cc Improved: Improve Web Content Caching
(OFBIZ-11477)

According to OWASP OFBiz Web Content Caching is weak:

Independently of the cache policy defined by the web application, if caching web
application contents is allowed, the session IDs must never be cached, so it is
highly recommended to use the Cache-Control: no-cache="Set-Cookie, Set-Cookie2"
directive, to allow web clients to cache everything except the session ID

I though noticed that Set-Cookie2 is deprecated for a long time now. And we new
browsers policies it to often updated. So no need to use Set-Cookie2.
2020-03-27 10:05:37 +01:00
Jacques Le Roux bd1b8a882d Improved: type="text/css" was missing on a call to <<link rel="stylesheet/less>>
This was reported by OWASP ZAP: "The Content-Type header is missing or empty."
Considered a low vulnerability
2020-03-26 12:12:37 +01:00
Jacques Le Roux 5988e27a0d Improved: Implement the pretty print for keyword search
(OFBIZ-11476)

With OFBIZ-9164 and r1835891 I introduced
keywordConstraint::prettyPrintConstraint without implementation.
So the information is missing at top of page.

This implements it. It also amends 2 French labels
2020-03-26 11:07:29 +01:00
Jacques Le Roux 11c0ce6d55 Improved: no functional change
Adds /uploads/ in .runtime/.gitignore
2020-03-24 18:31:54 +01:00
Pierre Smits dc68ac089f Fixed: DataModel - correct foreign key (#51)
(OFBIZ-11474)

Renaming foreign key to PROD_PRCDE_OPCD
2020-03-24 14:45:58 +05:30
Pierre Smits 3f01b0d422 Improved: unify style application
(OFBIZ-11458)

remove unused property 'align-float'
2020-03-24 09:01:40 +01:00
Pierre Smits 1f1d25b39f Improved: unify style application
(OFBIZ-11458)

replace 'align-float' with 'align-text'
2020-03-24 09:01:40 +01:00
Pierre Smits 3c5224c351 Improved: unify style application
(OFBIZ-11458)

replace 'align-float' with 'align-text'
2020-03-24 09:01:40 +01:00
Pierre Smits 5767da5e15 Improved: style alignment properties
(OFBIZ-11458)

Adding alignment properties (creating consistency across themes.
2020-03-24 09:01:40 +01:00
Jacques Le Roux ef8546bf19 Improved: POC for CSRF Token
(OFBIZ-11306)

There is no need to change it there because, apart the ecommerce application,
there are no applications that requires an anonymous flow.
It should be only changed in ecommerce controller.
2020-03-23 15:30:40 +01:00
Pawan Verma 91673f1b41 Fixed: Specified key was too long; max key length is 767 bytes for ProductPromoCodeEmail entity.(OFBIZ-5426) (#44)
* Fixed: Specified key was too long; max key length is 767 bytes for ProductPromoCodeEmail entity.
(OFBIZ-5426)

The problem is in the entity model. An email address should not be used in the primary key - mainly because an email address is case-insensitive. A better design would be to use the email address contact mechanism ID in the primary key.

Done Following:
1. Changed Entity Name from ProductPromoCodeEmail to ProductPromoCodeContMech
2. Related Changes for the entity name change
3. Migration service to migrate old data

Thanks, Leon for the report and Adrian Crum, Jacques Le Roux, Ingo Wolfmayr, Deepak Dixit, Pierre Smits and Gil Portenseigne for the discussion and review.

* Improved: Added new line in service definition file and lincence in MigrationServices file.
(OFBIZ-5426)

Thanks, Jacopo for the review.
2020-03-23 17:08:58 +05:30
Jacques Le Roux 1348f9d3be Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes check style errors
2020-03-21 23:09:05 +01:00
Jacques Le Roux 28e961c062 Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes an issue due to Eclipse automated import organisation.

There are still check style errors
2020-03-21 23:01:36 +01:00
Jacques Le Roux 322df2750c Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes a check issue (line too long)

Notice: on Windows I get 20 errors when compiling:
> Task :compileTestJava FAILED
C:\projectsASF\Git\ofbiz-framework\framework\widget\src\test\java\org\apache\
ofbiz\widget\renderer\macro\MacroFormRendererTest.java:134:
error: annotation type not applicable to this kind of declaration
        @Mock
        ^
I guess the change in build.gradle are not enough for Windows, to be seen later...
2020-03-21 22:08:00 +01:00
Daniel Watford e2142dd00e Improved: Added license header to MacroFormRendererTest
(OFBIZ-4035)
2020-03-21 20:02:59 +01:00
Daniel Watford 05d734206a Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)
2020-03-21 20:02:59 +01: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
Jacques Le Roux 3a5a657604 Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

Forgot to add UtilHttp::SameSiteFilter
2020-03-21 11:31:56 +01:00
Jacques Le Roux 7240b2642b Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

As reported by OWASP ZAP:
A cookie has been set without the SameSite attribute, which means that the
cookie can be sent as a result of a 'cross-site' request. The SameSite attribute
is an effective counter measure to cross-site request forgery, cross-site script
inclusion, and timing attacks.

The solution was not obvious in OFBiz for 2 reasons:

1. There is no HttpServletResponse::setHeader. So we need to use a filter
  (SameSiteFilter) and even that is not enough because of 2:
2. To prevent session fixation we force Tomcat to generates a new jsessionId,
ultimately put in cookie, in LoginWorker::login. So we need to add a call to
SameSiteFilter::addSameSiteCookieAttribute in
UtilHttp::setResponseBrowserDefaultSecurityHeaders.
2020-03-21 11:31:56 +01:00
Jacques Le Roux f3bd6a14b7 Improved: no functional change
Adds "Content-Security-Policy" frame-ancestors="self" in ErrorPage.ftl
Because this page is used as a HTTP 500 error it's more susceptible to
clickjacking

Quoting OWASP ZAP:
This problem still applies to error-type pages (401, 403, 500, etc.), as these
pages are still often affected by injection problems, in which case it is still
possible that browsers may interpret pages differently from their actual content
type.

I tried to work on other file types that were also reported but it's complicated
adn I believe it's not worth it
2020-03-21 11:31:56 +01:00
Jacques Le Roux b824d45d25 Fixed: Propagate the theme in DataResourceWorker.renderDataResourceAsText()
Improved: no functional change

(OFBIZ-9923)

Seems that this has been fixed with OFBIZ-11466 "CommonTheme has a dependency on
Flatgrey application.js"

Thanks: Pierre Smits for the fix in OFBIZ-11466
2020-03-21 11:31:56 +01:00
Nicolas Malin d65b01148e Fixed: Unable to view entity row record in webtools if PK contains timestamp field
(OFBIZ-11426)

This problem came from when the GenericEntity try to store fields value on the map,
If the java type didn't match with the current value type, the function failed and
didn't try to convert it on the wanted type.

Thanks to Pawan Verma and Pierre Smits to raise this issue
2020-03-21 11:31:55 +01:00