Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
b483ae0a
Commit
b483ae0a
authored
Nov 17, 2018
by
kaniini
Browse files
tests: add a second spoofing variant
parent
603fccf1
Pipeline
#4534
passed with stages
in 7 minutes and 12 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/fixtures/httpoison_mock/https__info.pleroma.site_activity3.json
0 → 100644
View file @
b483ae0a
{
"@context"
:
"https://www.w3.org/ns/activitystreams"
,
"attributedTo"
:
"http://mastodon.example.org/users/admin"
,
"attachment"
:
[],
"content"
:
"<p>this post was not actually written by Haelwenn</p>"
,
"id"
:
"https://info.pleroma.site/activity2.json"
,
"published"
:
"2018-09-01T22:15:00Z"
,
"tag"
:
[],
"to"
:
[
"https://www.w3.org/ns/activitystreams#Public"
],
"type"
:
"Note"
}
test/support/httpoison_mock.ex
View file @
b483ae0a
...
...
@@ -48,6 +48,14 @@ def get("https://info.pleroma.site/activity2.json", _, _) do
}}
end
def
get
(
"https://info.pleroma.site/activity3.json"
,
_
,
_
)
do
{
:ok
,
%
Response
{
status_code:
200
,
body:
File
.
read!
(
"test/fixtures/httpoison_mock/https__info.pleroma.site_activity3.json"
)
}}
end
def
get
(
"https://info.pleroma.site/actor.json"
,
_
,
_
)
do
{
:ok
,
%
Response
{
...
...
test/web/activity_pub/transmogrifier_test.exs
View file @
b483ae0a
...
...
@@ -884,11 +884,11 @@ test "it rejects activities which reference objects with bogus origins" do
:error
=
Transmogrifier
.
handle_incoming
(
data
)
end
test
"it rejects objects when
the ID does not match the fetched URI
"
do
test
"it rejects objects when
attributedTo is wrong (variant 1)
"
do
{
:error
,
_
}
=
ActivityPub
.
fetch_object_from_id
(
"https://info.pleroma.site/activity2.json"
)
end
test
"it rejects activities which reference objects
by mismatched URI
"
do
test
"it rejects activities which reference objects
that have an incorrect attribution (variant 1)
"
do
data
=
%{
"@context"
=>
"https://www.w3.org/ns/activitystreams"
,
"id"
=>
"http://mastodon.example.org/users/admin/activities/1234"
,
...
...
@@ -900,5 +900,22 @@ test "it rejects activities which reference objects by mismatched URI" do
:error
=
Transmogrifier
.
handle_incoming
(
data
)
end
test
"it rejects objects when attributedTo is wrong (variant 2)"
do
{
:error
,
_
}
=
ActivityPub
.
fetch_object_from_id
(
"https://info.pleroma.site/activity3.json"
)
end
test
"it rejects activities which reference objects that have an incorrect attribution (variant 2)"
do
data
=
%{
"@context"
=>
"https://www.w3.org/ns/activitystreams"
,
"id"
=>
"http://mastodon.example.org/users/admin/activities/1234"
,
"actor"
=>
"http://mastodon.example.org/users/admin"
,
"to"
=>
[
"https://www.w3.org/ns/activitystreams#Public"
],
"object"
=>
"https://info.pleroma.site/activity3.json"
,
"type"
=>
"Announce"
}
:error
=
Transmogrifier
.
handle_incoming
(
data
)
end
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