add google drive - #41
Open
frederic34 wants to merge 13 commits into
Open
Conversation
Add GOOGLEAPI_CONTEXTS_TO_SEND setting with per-context enable/disable in setup.php, add an ecmfiles extrafield for googleapiId, fix rights labels, extend token expiry buffer to 60s with better error catching, enable the scheduled watch cron job by default, and misc small fixes across oauth callback, actions and tabs.
The jqueryFileTree plugin is not loaded globally by Dolibarr core, so
jQuery('#filetree').fileTree() threw "not a function" and aborted the whole
ready handler, leaving both the folder tree and the file list empty.
Load the plugin from $morejs before our own JS, using the same path as
htdocs/ecm/index.php. Also load the file list before initializing the tree
and wrap the tree init in a try/catch, so a tree failure can no longer take
the file list down with it.
Google Drive file and folder names are attacker-controlled: anybody sharing a folder with the connected account picks its name. Breadcrumb: the name was concatenated into a string injected with .html(), so a folder named "<img src=x onerror=alert(1)>" ran script on every re-render. Escape it through a text node first. onclick handlers: dol_escape_js() protects the JS string literal but not the surrounding HTML attribute, and the browser HTML-decodes the attribute before parsing it as JS. A name containing "'" therefore became a real quote and broke out of the argument. Build the handler first, then HTML-escape it as a whole. Uses dol_escape_htmltag($s, 0, 0, '', 1): in its default mode dol_escape_htmltag() re-emits the literal sequence "'" untouched (it hides it behind __SIMPLEQUOTE__ so htmlentities() never encodes the &), which leaves exactly this attack open. $escapeonlyhtmltags=1 has no such carve-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.