Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
275
Merge Requests
33
CI / CD
Security & Compliance
Packages
Analytics
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
eff0477f
Commit
eff0477f
authored
24 minutes ago
by
Mark Harding
Browse files
Options
Download
(chore): add ugc to blog links
parent
66f4f9cd
master
No related merge requests found
Pipeline
#117772792
waiting for manual action with stages
in 8 minutes and 34 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
Core/Security/XSS/GenericRule.php
View file @
eff0477f
...
...
@@ -163,7 +163,7 @@ class GenericRule implements Interfaces\XSSRule
//make all urls force open in a new tab/window
if
(
$element
->
nodeName
==
'a'
)
{
$element
->
setAttribute
(
'target'
,
'_blank'
);
$element
->
setAttribute
(
'rel'
,
'noopener noreferrer nofollow'
);
//nofollow hurts spammers
$element
->
setAttribute
(
'rel'
,
'noopener noreferrer nofollow
ugc
'
);
//nofollow hurts spammers
}
}
...
...
This diff is collapsed.
Spec/Core/Security/XSSSpec.php
View file @
eff0477f
...
...
@@ -39,25 +39,25 @@ class XSSSpec extends ObjectBehavior
public
function
it_should_dissallow_onClick_attributes
()
{
$dirty
=
"<a onclick=
\"
console.log('hmmm...')
\"
>click me</a>"
;
$this
->
clean
(
$dirty
)
->
shouldReturn
(
'<?xml encoding="utf-8" ?>'
.
"<a target=
\"
_blank
\"
rel=
\"
noopener noreferrer nofollow
\"
>click me</a>"
);
$this
->
clean
(
$dirty
)
->
shouldReturn
(
'<?xml encoding="utf-8" ?>'
.
"<a target=
\"
_blank
\"
rel=
\"
noopener noreferrer nofollow
ugc
\"
>click me</a>"
);
}
public
function
it_should_allow_href_on_anchor_tags
()
{
$dirty
=
"<a href=
\"
https://www.minds.com
\"
>take me home</a>"
;
$this
->
clean
(
$dirty
)
->
shouldReturn
(
'<?xml encoding="utf-8" ?>'
.
"<a href=
\"
https://www.minds.com
\"
target=
\"
_blank
\"
rel=
\"
noopener noreferrer nofollow
\"
>take me home</a>"
);
$this
->
clean
(
$dirty
)
->
shouldReturn
(
'<?xml encoding="utf-8" ?>'
.
"<a href=
\"
https://www.minds.com
\"
target=
\"
_blank
\"
rel=
\"
noopener noreferrer nofollow
ugc
\"
>take me home</a>"
);
}
public
function
it_should_not_allow_bad_url_schemes
()
{
$dirty
=
"<a href=
\"
javascript:alert('HEYHO')
\"
>bad scheme here</a>"
;
$this
->
clean
(
$dirty
)
->
shouldReturn
(
'<?xml encoding="utf-8" ?>'
.
"<a href=
\"
alert('HEYHO')
\"
target=
\"
_blank
\"
rel=
\"
noopener noreferrer nofollow
\"
>bad scheme here</a>"
);
$this
->
clean
(
$dirty
)
->
shouldReturn
(
'<?xml encoding="utf-8" ?>'
.
"<a href=
\"
alert('HEYHO')
\"
target=
\"
_blank
\"
rel=
\"
noopener noreferrer nofollow
ugc
\"
>bad scheme here</a>"
);
}
public
function
it_should_not_allow_bad_url_schemes_with_case_hacks
()
{
$dirty
=
"<a href=
\"
Javascript:alert('HEYHO')
\"
>bad scheme here</a>"
;
$this
->
clean
(
$dirty
)
->
shouldReturn
(
'<?xml encoding="utf-8" ?>'
.
"<a href=
\"
alert('HEYHO')
\"
target=
\"
_blank
\"
rel=
\"
noopener noreferrer nofollow
\"
>bad scheme here</a>"
);
$this
->
clean
(
$dirty
)
->
shouldReturn
(
'<?xml encoding="utf-8" ?>'
.
"<a href=
\"
alert('HEYHO')
\"
target=
\"
_blank
\"
rel=
\"
noopener noreferrer nofollow
ugc
\"
>bad scheme here</a>"
);
}
public
function
it_should_not_allow_bad_url_schemes_from_multiple_keywords
()
...
...
This diff is collapsed.
Please
register
or
sign in
to comment