Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
diaspora
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
diaspora
Commits
fa0e34f6
Unverified
Commit
fa0e34f6
authored
Nov 08, 2018
by
Benjamin Neff
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hotfix/0.7.7.1'
parents
d8c1b4f4
32cd7647
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
46 deletions
+31
-46
Changelog.md
Changelog.md
+4
-0
Gemfile.lock
Gemfile.lock
+2
-2
app/helpers/open_graph_helper.rb
app/helpers/open_graph_helper.rb
+0
-10
app/views/status_messages/_status_message.mobile.haml
app/views/status_messages/_status_message.mobile.haml
+7
-1
config/defaults.yml
config/defaults.yml
+1
-1
spec/helpers/open_graph_helper_spec.rb
spec/helpers/open_graph_helper_spec.rb
+0
-32
spec/views/status_messages/_status_message.mobile.haml_spec.rb
...views/status_messages/_status_message.mobile.haml_spec.rb
+17
-0
No files found.
Changelog.md
View file @
fa0e34f6
# 0.7.7.1
Fixes a potential cross-site scripting issue with maliciously crafted OpenGraph metadata on the mobile interface.
# 0.7.7.0
# 0.7.7.0
## Refactor
## Refactor
...
...
Gemfile.lock
View file @
fa0e34f6
...
@@ -472,7 +472,7 @@ GEM
...
@@ -472,7 +472,7 @@ GEM
byebug (~> 10.0)
byebug (~> 10.0)
pry (~> 0.10)
pry (~> 0.10)
public_suffix (3.0.3)
public_suffix (3.0.3)
rack (2.0.
5
)
rack (2.0.
6
)
rack-cors (1.0.2)
rack-cors (1.0.2)
rack-google-analytics (1.2.0)
rack-google-analytics (1.2.0)
actionpack
actionpack
...
@@ -900,4 +900,4 @@ DEPENDENCIES
...
@@ -900,4 +900,4 @@ DEPENDENCIES
will_paginate (= 3.1.6)
will_paginate (= 3.1.6)
BUNDLED WITH
BUNDLED WITH
1.1
6.5
1.1
7.1
app/helpers/open_graph_helper.rb
View file @
fa0e34f6
# frozen_string_literal: true
# frozen_string_literal: true
module
OpenGraphHelper
module
OpenGraphHelper
def
og_html
(
cache
)
"<a href=
\"
#{
cache
.
url
}
\"
target=
\"
_blank
\"
>"
+
" <div>"
+
" <img src=
\"
#{
cache
.
image
}
\"
/>"
+
" <strong>
#{
cache
.
title
}
</strong>"
+
" <p>
#{
truncate
(
cache
.
description
,
length:
250
,
separator:
' '
)
}
</p>"
+
" </div>"
+
"</a>"
end
def
link_to_oembed_image
(
cache
,
prefix
=
'thumbnail_'
)
def
link_to_oembed_image
(
cache
,
prefix
=
'thumbnail_'
)
link_to
(
oembed_image_tag
(
cache
,
prefix
),
cache
.
url
,
:target
=>
'_blank'
)
link_to
(
oembed_image_tag
(
cache
,
prefix
),
cache
.
url
,
:target
=>
'_blank'
)
end
end
...
...
app/views/status_messages/_status_message.mobile.haml
View file @
fa0e34f6
...
@@ -20,4 +20,10 @@
...
@@ -20,4 +20,10 @@
!=
o_embed_html
post
.
o_embed_cache
!=
o_embed_html
post
.
o_embed_cache
-
if
post
.
open_graph_cache
-
if
post
.
open_graph_cache
.opengraph
.opengraph
!=
og_html
post
.
open_graph_cache
%a
{
href:
post
.
open_graph_cache
.
url
,
target:
"_blank"
}
%div
=
image_tag
post
.
open_graph_cache
.
image
%strong
=
post
.
open_graph_cache
.
title
%p
=
truncate
(
post
.
open_graph_cache
.
description
,
length:
250
,
separator:
" "
)
config/defaults.yml
View file @
fa0e34f6
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
defaults
:
defaults
:
version
:
version
:
number
:
"
0.7.7.
0
"
# Do not touch unless doing a release, do not backport the version number that's in master
number
:
"
0.7.7.
1
"
# Do not touch unless doing a release, do not backport the version number that's in master
heroku
:
false
heroku
:
false
environment
:
environment
:
url
:
"
http://localhost:3000/"
url
:
"
http://localhost:3000/"
...
...
spec/helpers/open_graph_helper_spec.rb
deleted
100644 → 0
View file @
d8c1b4f4
# frozen_string_literal: true
describe
OpenGraphHelper
,
:type
=>
:helper
do
describe
'og_html'
do
scenarios
=
{
"article"
=>
{
"url"
=>
"http://opengraph-enabled-site.com/articles/1332-scientists-discover-new-planet"
,
"image"
=>
"http://opengraph-enabled-site.com/images/1332-lead.jpg"
,
"title"
=>
"Scientists discover new planet"
,
"description"
=>
"A new planet was found yesterday"
},
}
scenarios
.
each
do
|
type
,
data
|
specify
'for type "'
+
type
+
'"'
do
cache
=
OpenGraphCache
.
new
(
:url
=>
data
[
'url'
])
cache
.
ob_type
=
type
cache
.
image
=
data
[
'image'
]
cache
.
title
=
data
[
'title'
]
cache
.
description
=
data
[
'description'
]
formatted
=
og_html
(
cache
)
expect
(
formatted
).
to
match
(
/
#{
data
[
'url'
]
}
/
)
expect
(
formatted
).
to
match
(
/
#{
data
[
'title'
]
}
/
)
expect
(
formatted
).
to
match
(
/
#{
data
[
'image'
]
}
/
)
expect
(
formatted
).
to
match
(
/
#{
data
[
'description'
]
}
/
)
end
end
end
end
spec/views/status_messages/_status_message.mobile.haml_spec.rb
0 → 100644
View file @
fa0e34f6
# frozen_string_literal: true
describe
"status_messages/_status_message.mobile.haml"
do
it
"escapes the OpenGraph metadata"
do
open_graph_cache
=
OpenGraphCache
.
new
(
url:
"<script>alert(0);</script>"
,
title:
"<script>alert(0);</script>"
,
image:
"https://example.org/
\"
><script>alert(0);</script>"
,
description:
"<script>alert(0);</script>"
)
post
=
FactoryGirl
.
create
(
:status_message
,
public:
true
,
open_graph_cache:
open_graph_cache
)
render
file:
"status_messages/_status_message.mobile.haml"
,
locals:
{
post:
post
,
photos:
post
.
photos
}
expect
(
rendered
).
to_not
include
(
"<script>"
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment