Commit Graph
10432 Commits
Author SHA1 Message Date
Benjamin Jugl 5a0b0a0c0d Fixed: Checkstyle Issues in WebToolsDbEvents and UtilXml (OFBIZ-6510) 2021-02-04 12:29:28 +01:00
Benjamin Jugl 8fac07ad0a Improved: Replaces ModelInduceFromDb with widgets (OFBIZ-6510) 2021-02-03 12:39:15 +01:00
Ingo Könemann ffcd8f34fc Fixed: Remove _PREVIOUS_REQUEST_ Session Attribute on non-authentication
pages (OFBIZ-12047)

Added removal of the _PREVIOUS_REQUEST_ attribute when requesting
non-authenticated sites and moved targetRequestUri handling to a
accommodate this change
2021-02-03 11:47:15 +01:00
Sebastian Berg a33ac5cff3 Improved: Convert EmailServices.xml mini lang to groovy (OFBIZ-11868) 2021-02-01 16:51:00 +01:00
Jacques Le Roux 2718ee011c Improved: fixes a typo 2021-01-30 11:01:37 +01:00
Wiebke Pätzold b57f4d0845 Improved: Spelling error in the German translation of Slovakia
(OFBIZ-12161)
2021-01-28 18:08:15 +01:00
Benjamin Jugl 17864a11e9 Fixed: Possible NPE in DatabaseUtil.getColumnInfo(...) (OFBIZ-11385) 2021-01-25 18:11:54 +01:00
Daniel Watford edd7960e4b Fixed: Use data url scheme for logo in CompanyHeader
(OFBIZ-7327)

Use a data URL rather than a regular URL for company logos when a
logo has been specified as a Party Content item. This works around the
problem of Apache FOP failing to retrieve content from HTTPS URLs.

Thanks: Deepak Dixit for the review and suggestions
2021-01-24 16:26:34 +00:00
Jacques Le Roux c54dced51c Improved: Improve description encoding in 2 classes: MacroFormRenderer and renderableFtlFormElementsBuilder (OFBIZ-12159)
Concern MacroFormRenderer::makeHyperlinkByType and renderableFtlFormElementsBuilder::encode
I'm not sure it's useful but it's harmless
2021-01-23 18:18:16 +01:00
Jacques Le Roux cb9c366327 Fixed: Ampersand in Party not displayed correctly (OFBIZ-12140)
In the reported case, ModelFormField::getDescription double HTML encodes the
description when both the entity and the description contain an ampersand.

A solution is to test if the description is already HTML encoded before encoding
it again. If HTML encoded then only String encodes it.

BTW I'm not sure it's useful but it's harmless, the same solution can be applied
to OFBIZ-12026 and similarly in renderableFtlFormElementsBuilder::encode. I'll
do as improvements...

Thanks: Andrew Waters for report and help in analysis
2021-01-23 17:56:15 +01:00
James Yong b679d36b49 Improved: Updated tasks.checkstyleMain.maxErrors to 278 2021-01-21 21:21:54 +08:00
James Yong 1bfd3c5fb0 Improved: Allow Unsafe Event Message (OFBIZ-12147)
Allow application to define event messages that contain javascripts, via request attribute "_UNSAFE_EVENT_MESSAGE_"

Thanks Jacques for review
2021-01-21 20:46:06 +08:00
Jacques Le Roux 20e7fc5435 Fixed: Creating a new Customer create a wrong record in CommunicationEvent (OFBIZ-12142)
In https://markmail.org/message/pf3d3qyjfucicbj7 I initially answered:
In demo data 13 parties use <<infoString="ofbiztest@example.com">> as in
<ContactMech contactMechId="FRA01" contactMechTypeId="EMAIL_ADDRESS" infoString="ofbiztest@example.com"/>
This one is loaded last. Rather
<ContactMech contactMechId="Company" contactMechTypeId="EMAIL_ADDRESS" infoString="ofbiztest@example.com"/>
which is the 1st one, should be loaded last.

A better solution is to use "ofbizsupport@example.com" in EmailServices.xml

Indeed, fortunately the Company party also uses this infoString and using it in
EmailServices.xml does not affect the integration test and should not affect
other parts of the (only) demo data

Thanks: Emad Radwan for opiniated report :) and Pritam Kute for issue analysis
2021-01-18 19:41:08 +01:00
Jacques Le Roux 3f76f86014 Improved: Marked unused HTML renderers as deprecated (OFBIZ-11927)
Upcoming Branch is actually another name for trunk. It's always evolving and
never released. Better put a date when deprecating a Class or method. Else you
have no idea when it was deprecated, apart referring to git-blame.
2021-01-16 10:14:28 +01:00
Nicolas Malin 7165768251 Implemented: Add a framework method to get main webapp menu with the webapp name
(OFBIZ-10601)

To improve theme management and provide better tools for new themes, we implement a method to obtain the main menu of a webapp.
Instead of just managing a menu, we extend the functionality by offering a method to expose a summary of the webapp, to simplify the navigation.

For this we add a new attribute on webapp definition app-shortcut-screen :

    <webapp name="mywebapp"
            ...
            app-shortcut-screen="component://mycomponent/widget/CommonScreens.xml#ShortcutApp"
            ...
    />

The idea is to define a new purpose screen *Shortcut* that contains what defines a webapp when an action or navigation has been requested. With this screen you can load a menu, a search, a complex description and use all screen powerfulness to resolve what displaying and support by theming

    <screen name="ShortcutApp">
        <section>
            <actions>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
            </actions>
            <widgets>
                <decorator-screen name="ShortcutDecorator" location="component://common/widget/CommonScreens.xml">
                    <decorator-section name="body">
                        <include-menu name="MyShortcutAppBar" location="component://mycomponent/widget/CommonMenus.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

Each component are self-sufficient to define what shortcuts to display without framework change or knowledge about other component.
Each theme can implement and customize the display rendering at will.

To illustrate an example of implementation we set sub menu for each webapp defined on applications and exploit it on bluelight theme.

Thanks for Dennis Balkir, Jacques Leroux, Leila Mekika and Julien Nicolas for their involvement
2021-01-15 08:56:23 +01:00
Daniel Watford c4d8f904b7 Improved: Don't log warning when ObjectType converts from String to
String

(OFBIZ-10710)

Thanks: Benjamin Jugl for report and patch.
2021-01-14 17:58:05 +00:00
Daniel Watford 406f51d032 Improved: Marked unused HTML renderers as deprecated
(OFBIZ-11927)
2021-01-14 17:30:03 +00:00
Daniel Watford 7830328bb4 Improved: Removed deprecated ExpectedException.none from tests
(OFBIZ-12137)

Prevents logging of deprecation warnings during the build.
2021-01-14 17:07:40 +00:00
Daniel Watford d40081dc86 Improved: Minor changes to reduce checkstyle warnings count 2021-01-13 14:28:19 +00:00
James Yong 9c7dc7b877 Improved: Rename MultiBlockHtmlTemplateUtil to ScriptLinkHelper (OFBIZ-12134)
Rename + Refactor
2021-01-13 09:26:42 +08:00
Nicolas Malin e0a840a0c4 Implemented: Access to the current screen from any widget element
(OFBIZ-11809)

During the rendering process, an element have no information about the screen which is dependent from. This not really help to automate some refresh treatment and force the developer to know the screen structure where is the element.

To solve this situation we implement a new class, ScreenStack that allow anytime for any element to identify its direct dependency. This help to resolve the unique Id that the screen take and can be used by the theme.

At any time a developer can retrieve the screen reference with uel function screen:id(screenStack)

example:
     <container id="${screen:id(screenStack)}">

The object screenStack is always present during a rendering process.
2021-01-12 17:48:00 +01:00
James Yong 3c83ab53b2 Refactoring 2021-01-12 23:25:25 +08:00
Daniel Watford 3795727ea2 Improved: MacroFormRenderer refactoring of label, display and text
fields

(OFBIZ-11900)

New RenderableFtl elements to represent pre-rendered FTL strings and FTL
macro calls. RenderableFtl elements are able to render themselves to
strings which are processed as an FTL template by the FtlWriter class.

For labels, display fields and text fields, MacroFormRenderer no longer
generates FTL to write to a template itself, but instead calls
RenderableFtlFormElementsBuilder to create corresponding RenderableFtl
elements which are then processed by FtlWriter. This is a WIP to reduce
complexity in MacroFormRenderer.
2021-01-12 10:40:58 +00:00
Daniel Watford c9ee842163 Fixed: Issue starting ofbiz from tar distribution (OFBIZ-12118)
Avoid using caches when opening a URL connection to read an XML resource
in a JAR file.

If caches were used when running from the ofbiz.jar file then attempts
to read resources from the jar would fail due to the cached file's
InputStream already being in a closed state.

Thanks: Eugen Stan for the bug report and fix.
2021-01-11 17:35:07 +00:00
Suraj Khurana cc17887980 Improved: Added support to calculate distance between two geo points.
(OFBIZ-11901)
Thanks Ravi Lodhi for review and discussion.
2021-01-09 13:37:21 +05:30
James Yong 067db8fe9e Improved: Open Menu file from browser (OFBIZ-12119)
User can open menu definition file from the browser by clicking on the named border.
2021-01-09 13:05:23 +08:00
James Yong f484b0d318 Fixed: Open Screen file from browser (OFBIZ-12038)
Fix named borders not rendered for sub-screens.
2021-01-06 23:23:35 +08:00
Jacques Le Roux c7e1114b74 Fixed: partymgr fails to upload image (OFBIZ-12101)
This is a bug due to OFBIZ-12080, fileToCheck is the complete name of the file
with path not the filename

Thanks: Wai for report
2020-12-26 09:06:02 +01:00
James Yong 203fa5f1c1 Implemented: Support Freemarker square interpolation syntax (OFBIZ-12099)
Use square interpolation syntax when file extension is .spi.ftl
2020-12-21 19:46:11 +08:00
James Yong 483e77ea83 Fixed: Date picker not initialised in ajax-called form (OFBIZ-12097)
Use inline script when request is ajax
2020-12-20 08:46:52 +08:00
Jacques Le Roux c52f29e0ae Fixed: Post-auth XSS vulnerability at catalog/control/EditProductPromo (OFBIZ-12096)
We missed to unescape EcmaScript encoded strings in
UtilCoded::checkStringForHtmlSafe, ie in all form fields using allow-html="safe"

Thanks: 牛治 <niu.zhi@zte.com.cn> for report
2020-12-19 20:54:08 +01:00
Jacques Le Roux c7fef0c409 Fixed: Post-auth XSS vulnerability at catalog/control/EditProductPromo (OFBIZ-12096)
We missed to unescape EcmaScript encoded strings in
UtilCoded::checkStringForHtmlSafe, ie in all form fields using allow-html="safe"

Thanks: 牛治 <niu.zhi@zte.com.cn> for report
2020-12-19 18:24:29 +01:00
Jacques Le Roux ec2b84341e Reverted: "Improved: Hyperlink target-type attribute is deprecated and should be replaced by url-mode (OFBIZ-12091)"
This reverts commit 17eb2e4cf7.

It does not work when using <<target="javascript:........>>
I could change those cases but it's easier and safer to simply revert back to
target-type!

Thanks: James for report
2020-12-18 11:08:32 +01:00
Jacques Le Roux 333b896eef Fixed: Error wIth Flat Grey theme related to rest component (OFBIZ-12093)
When you use the Flat Grey theme (useful for RTL languages) you see an error in
the main menu (component choise). It's related to the rest component not using a
controller.

Fixes is simple and has not side effect: instead of throwing an exception simply
log a warning and return an empty string
2020-12-18 10:38:26 +01:00
Jacques Le Roux c4650ff9bc Fixed: Secure the uploads (OFBIZ-12080)
According to https://s.apache.org/rpzog, adds few, maybe redundant, Java
API/methods found in webshell, or alike, source code
2020-12-14 19:00:37 +01:00
Jacques Le Roux 179dd2411a Fixed: Secure the uploads (OFBIZ-12080)
Follows OWASP advice on file names:

All the control characters and Unicode ones should be removed from the filenames
and their extensions without any exception. Also, the special characters such as
“;”, “:”, “>”, “<”, “/” ,”\”, additional “.”, “*”, “%”, “$”, and so on should be
discarded as well.

If it is applicable and there is no need to have Unicode characters, it is
highly recommended to only accept Alpha-Numeric characters and only 1 dot as an
input for the file name and the extension; in which the file name and also the
extension should not be empty at all
(regular expression: [a-zA-Z0-9]{1,200}.[a-zA-Z0-9]{1,10}).

So if someone needs other chars in uploaded filenames a change will be needed
2020-12-14 16:46:05 +01:00
Jacques Le Roux 63e2b526b8 Fixed: Secure the uploads (OFBIZ-12080)
Prevents too long filenames as recommended by OWASP.

Based on https://security.stackexchange.com/questions/46484/denial-of-service-when-uploading-a-file#answer-46495
I decided to not limit sizes of files. Anyway we know it's only post-auth...
2020-12-14 12:46:32 +01:00
Jacques Le Roux 93fb762071 Improved: Add unique identifier data to portlet context (OFBIZ-12090)
Add the portalPortletId + portletSeqId to the portlet context. This is useful if
a unique identifier within the portlet body (the portlet content) is required.

Thanks: Ingo Wolfmayr
2020-12-12 19:39:31 +01:00
Jacques Le Roux 17eb2e4cf7 Improved: Hyperlink target-type attribute is deprecated and should be replaced by url-mode (OFBIZ-12091)
Same for sub-hyperlink
2020-12-11 16:52:04 +01:00
Jacques Le Roux caded9e937 Fixed: Hyperlink title under form widget doesn't support character encoding for special characters (OFBIZ-12026)
When we use any title with special characters for hyperlink tag, it shows broken
string on UI, eg:
<hyperlink description="${uiLabelMap.CommonImportExport}"  target="ImportExport">
should render a button with the title "Import/Export. But it shows as
Import&#x2f;Export

jleroux: I have noticed that the same happens with special French characters.
So it's a general issue.
The title (description in code) is HTML encoded and that does not work for
special characters. I simply used a string encoder.

Thanks: Pradeep Choudhary for report, Sourabh Jain for a possible but not
general solution at OFBIZ-12023, ie using target-type="plain"
2020-12-11 13:40:53 +01:00
James Yong 89f36f1a06 Correct spelling for μManager.
Reference: https://imagejdocu.tudor.lu/faq/general/which_file_formats_are_supported_by_imagej
2020-12-08 19:49:15 +08:00
James Yong 931716a628 Improve notes for Tomcat SSO 2020-12-08 19:37:21 +08:00
Jacques Le Roux 100810faeb Fixed: Secure the uploads (OFBIZ-12080)
Adds audio and video as supported formats
2020-12-07 19:48:36 +01:00
Jacques Le Roux 4481f373ca Fixed: Secure the uploads (OFBIZ-12080)
Handles audio and video formats supported by Tika.

Adds few new audio and video formats in seed data.

AFAIK there are no ways to embed a webshell in an audio or video file. So I did
not sophisticate the validation, just rely on Tika.

I have also fixed bugs in SecuredUpload: in isValidSvgFile and
isValidImageIncludingSvgFile
2020-12-07 18:45:24 +01:00
James Yong c1644940e9 Fixed: Make locale available for DateFindField and DateTimeField macros (OFBIZ-12086)
Fixed compile error in MacroFormRendererTest.java.

Thanks: Daniel and Tomek for the finding
2020-12-07 23:46:02 +08:00
Jacques Le Roux 5fa312cfb9 Fixed: Secure the uploads (OFBIZ-12080)
Improves the labels names and format comment in LayoutEvents.java

I backport to ease later works...
2020-12-06 11:16:44 +01:00
James Yong 76a940ab43 Improved: Make locale available for DateFindField and DateTimeField macros (OFBIZ-12086)
DateFindField and DateTimeField macros need to find locale-specific javascript library files.
2020-12-05 23:13:55 +08:00
James Yong cfabbc9b74 Fixed: jquery.ui.datepicker-en.js does not exist (OFBIZ-12071)
Fixed for Jquery DatePicker
2020-12-05 19:24:09 +08:00
Jacques Le Roux e73616caf1 Fixed: Secure the uploads (OFBIZ-12080)
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.
2020-12-01 10:16:04 +01:00
Nicolas Malin 816068335c Improved: Improve makeRangeCondition in file EntityDateFilterCondition.java
(OFBIZ-12051)

When we have a value with both from and thrudate greater than given range

Thanks to Leila Mekika for this improvement
2020-11-29 19:21:23 +01:00