Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vtigercrm
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Welcome to Vtiger Community. To gain access for account, please contact [ community @ vtiger.com ]
Show more breadcrumbs
Akshath
vtigercrm
Commits
8cb3c8f6
Commit
8cb3c8f6
authored
8 years ago
by
Prasad
Browse files
Options
Downloads
Patches
Plain Diff
Minor xss and non-admin access control fix.
parent
b3d82c8c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/utils/VtlibUtils.php
+22
-0
22 additions, 0 deletions
include/utils/VtlibUtils.php
modules/Users/actions/Save.php
+16
-2
16 additions, 2 deletions
modules/Users/actions/Save.php
with
38 additions
and
2 deletions
include/utils/VtlibUtils.php
+
22
−
0
View file @
8cb3c8f6
...
...
@@ -648,6 +648,7 @@ function vtlib_purify($input, $ignore=false) {
}
}
else
{
// Simple type
$value
=
$__htmlpurifier_instance
->
purify
(
$input
);
$value
=
purifyHtmlEventAttributes
(
$value
);
}
}
$purified_cache
[
$md5OfInput
]
=
$value
;
...
...
@@ -656,6 +657,23 @@ function vtlib_purify($input, $ignore=false) {
return
$value
;
}
/**
* To purify malicious html event attributes
* @param <String> $value
* @return <String>
*/
function
purifyHtmlEventAttributes
(
$value
){
$htmlEventAttributes
=
"onerror|onblur|onchange|oncontextmenu|onfocus|oninput|oninvalid|"
.
"onreset|onsearch|onselect|onsubmit|onkeydown|onkeypress|onkeyup|"
.
"onclick|ondblclick|ondrag|ondragend|ondragenter|ondragleave|ondragover|"
.
"ondragstart|ondrop|onmousedown|onmousemove|onmouseout|onmouseover|"
.
"onmouseup|onmousewheel|onscroll|onwheel|oncopy|oncut|onpaste"
;
if
(
preg_match
(
"/\s("
.
$htmlEventAttributes
.
")\s*=/i"
,
$value
))
{
$value
=
str_replace
(
"="
,
"="
,
$value
);
}
return
$value
;
}
/**
* Function to return the valid SQl input.
* @param <String> $string
...
...
@@ -704,4 +722,8 @@ function vtlib_module_icon($modulename){
return
"modules/Vtiger/Vtiger.png"
;
}
function
vtlib_mime_content_type
(
$filename
)
{
return
Vtiger_Functions
::
mime_content_type
(
$filename
);
}
?>
This diff is collapsed.
Click to expand it.
modules/Users/actions/Save.php
+
16
−
2
View file @
8cb3c8f6
...
...
@@ -15,8 +15,22 @@ class Users_Save_Action extends Vtiger_Save_Action {
$record
=
$request
->
get
(
'record'
);
$recordModel
=
Vtiger_Record_Model
::
getInstanceById
(
$record
,
$moduleName
);
$currentUserModel
=
Users_Record_Model
::
getCurrentUserModel
();
if
(
!
Users_Privileges_Model
::
isPermitted
(
$moduleName
,
'Save'
,
$record
)
||
(
$recordModel
->
isAccountOwner
()
&&
$currentUserModel
->
get
(
'id'
)
!=
$recordModel
->
getId
()
&&
!
$currentUserModel
->
isAdminUser
()))
{
// Check for operation access.
$allowed
=
Users_Privileges_Model
::
isPermitted
(
$moduleName
,
'Save'
,
$record
);
if
(
$allowed
)
{
// Deny access if not administrator or account-owner or self
if
(
!
$currentUserModel
->
isAdminUser
()
&&
!
$recordModel
->
isAccountOwner
())
{
if
(
empty
(
$record
))
{
$allowed
=
false
;
}
else
if
(
$currentUserModel
->
get
(
'id'
)
!=
$recordModel
->
getId
())
{
$allowed
=
false
;
}
}
}
if
(
!
$allowed
)
{
throw
new
AppException
(
'LBL_PERMISSION_DENIED'
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment