Commit Graph
26712 Commits
Author SHA1 Message Date
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
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 7d95c46b83 Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

Forgot to add UtilHttp::SameSiteFilter
2020-03-20 18:04:31 +01:00
Jacques Le Roux 369d5f6c95 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-20 17:50:17 +01:00
Jacques Le Roux b6a796cbdf 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-20 10:51:49 +01:00
Jacques Le Roux 2517a96792 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-20 09:38:04 +01:00
Nicolas Malin 13ee4cc263 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-19 14:44:07 +01:00
Jacques Le Roux 31812009eb Fixed: CommonTheme has a dependency on Flatgrey application.js
(OFBIZ-11466)

In theme.xml of common-theme there is a reference to application.js residing in
the Flatgrey theme. This should not be. The file should be in common-theme.

Thanks: Pierre Smits for report and fix. I have just also removed
rainbowstone/js/application.js since it's now in common-theme
2020-03-19 11:22:09 +01:00
Daniel Watford 584f1edda5 Improved: Ensure MacroFormRenderer uses
ModelFormField#getCurrentContainerId rather than
ModelFormField#getIdName to ensure any FlexibleStringExpander expression
defined in the field's id-name property is processed before rendering
into the container FTL macro.

(OFBIZ-4035)
2020-03-19 09:51:06 +01:00
Michael Brohl e4e32a1a64 Improved: Styles some clickable fields of backend tables as buttons.
(OFBIZ-11309)

Thanks Ulrich Heidfeld for reporting and providing the patch, James Yong
for additional review.
2020-03-18 08:05:00 +01:00
Michael Brohl 83b8b27b58 Fixed: Fixed a bug introduced with the removal of the login security
question.

(OFBIZ-11244)

Thanks Olivier Heintz for reporting and Wiebke Pätzold for providing the
patch.
2020-03-17 12:36:40 +01:00
Dennis Balkir 2895da2220 Implemented: _WARNING_MESSAGE_
(OFBIZ-10587)

Added warning message as a message type, by adding it in the
messages.ftl and the request-handler

Thanks to Niklas Fallik for reporting
2020-03-15 11:23:33 +01:00
Jacques Le Roux a4753d911d Improved: no functional change
Follows the "How to apply the Apache License to your work" section at
https://www.apache.org/licenses/LICENSE-2.0

Removes the references to products only used in plugins
2020-03-14 12:32:02 +01:00
Jacques Le Roux 67531d8bb2 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-03-14 08:51:23 +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 308fa20e81 Improved: Remove unused ‘UtilHttp#checkURLforSpiders’
(OFBIZ-11138)

The "link.remove_lsessionid.user_agent_list" properties was forgotten
2020-03-12 15:13:42 +01:00
Dennis Balkir d83bec22d8 Fixed: Potential Nullpointer in ErrorPage.ftl
(OFBIZ-11448)

Inserted nullcheck for request-attribute
2020-03-10 15:59:57 +01:00
Nicolas Malin c8a838ef03 Improved: Convert PartyServices.xml from mini lang to groovy
(OFBIZ-11361)

Thanks to Leila Mekika for providing the patch
2020-03-10 14:37:57 +01:00
Nicolas Malin 930f4af7a2 Improved: Convert CommonServices.xml from mini lang to groovy
(OFBIZ-11402)

Thanks to Wiebke Pätzold for providing the patch
2020-03-10 14:09:08 +01:00
Nicolas Malin 43b44f53e0 Improved: Convert ProductContentServices.xml mini lang to groovy
(OFBIZ-11436)

Thanks to Sebastian Berg for providing the patch
2020-03-10 09:32:37 +01:00
Michael Brohl 03b3a7bc02 Improved: Upgrade Freemarker from 2.3.29 to 2.3.30.
(OFBIZ-11445)
2020-03-08 01:13:05 +01:00
Gil Portenseigne b79c95b151 Fixed: Convert OrderServices.xml mini-lang to groovyDSL : getNextOrderId
(OFBIZ-9984)
Fix introduced NPE detected by the introduced test.
2020-03-06 17:36:14 +01:00
Gil Portenseigne 53a8b81260 Improved: Convert OrderServices.xml mini-lang to groovyDSL : getOrderedSummaryInformation
(OFBIZ-9984)
Thanks Julien for your contribution
2020-03-06 15:47:52 +01:00
Gil Portenseigne eba4157c59 Improved: Convert OrderServices.xml mini-lang to groovyDSL : getNextOrderId
(OFBIZ-9984)
Thanks Julien for your old patch, it has been improved.
Add a new integration test for the service 'getNextOrderId'
2020-03-06 15:46:58 +01:00
Nicolas Malin 27aa23833c Improved: Convert createTextAndUploadedContent service from mini-lang to groovy DSL
(OFBIZ-11368)

Thanks to Rohit Hukkeri for providing the patch
2020-03-06 14:58:15 +01:00
Nicolas Malin 92963609da Improved: Convert ProductFeatureServices.xml mini lang to groovy
(OFBIZ-11439)

Thanks to Sebastian Berg for providing the patch
2020-03-06 11:36:32 +01:00
Jacques Le Roux 784a299968 Fixed: createMissingCategoryAndProductAltUrls service misses a transaction
(OFBIZ-11441)

Not sure why it had use-transaction="false", makes no sens to me, too old to
check, not a big deal I guess
2020-03-05 09:56:07 +01:00
Nicolas Malin 51837c8cbf Fixed: Convert ProductServices.xml mini lang to groovy: productPriceGenericPermission failed
(OFBIZ-10231)

After groovy conversion the method productPriceGenericPermission failed to validate a user

Problem due to bad call on hasEntityPermission instead of hasPermission
2020-03-04 21:46:11 +01:00
Nicolas Malin 80026c76c0 Improved: Convert ProductServices.xml mini lang to groovy
(OFBIZ-10231)

After groovy conversion the method checkProductRelatedPermission
has been broken for other minilang method that didn't converted.

To solve this problem, I created new permission service checkProductRelatedPermission
and convert all previous minilang method call by a permission service on the related service call
2020-03-04 21:44:11 +01:00
Nicolas Malin 2b98727c5f Improved: Convert party/LookupServices.xml mini-lang to groovyDSL
(OFBIZ-11362)

Deprecate lookupParty service by performFindParty and rewrite to work as bridge during the deprecation time
2020-03-04 21:25:23 +01:00
Nicolas Malin 9a50fa907b Fixed: Refactoring permission model call, alone permission service failed
(OFBIZ-11440)

During refactoring (OFBIZ-7113), the service reader used two different methods to read a
permission service definition if is present alone or in a group. For the alone version a link
was missing between the service and the permission service to resolve correctly the permission.

To solve this problem I reorganized to use only one method to initialize a service model permission.

Other point, an attribute renaming was missed : action -> permissionMainAction, when service permission call was called

Last, these problems weren't detected before due to missing unit test on failure service permission, now cover.
2020-03-04 21:18:30 +01:00
Jacques Le Roux feeeb22f4a Fixed: Convert ProductServices.xml mini lang to groovy
Improved: no functional change
(OFBIZ-10231)

ProductServices.xml has been removed while

createProductPrice still refers to an inexisting PriceServices.xml
createProductPrice is not implemented in Groovy, there is no PriceServices.groovy

This just adds it temporarily, waiting for a correct and complete fix
2020-03-04 15:43:51 +01:00