Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
221c8c77
Commit
221c8c77
authored
6 years ago
by
Eugen Rochko
Browse files
Options
Download
Email Patches
Plain Diff
Prevent ActivityPub movedTo recursion (#8092)
Fix #8051
parent
a16d41e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/services/activitypub/fetch_remote_account_service.rb
+2
-2
app/services/activitypub/fetch_remote_account_service.rb
app/services/activitypub/process_account_service.rb
+1
-1
app/services/activitypub/process_account_service.rb
with
3 additions
and
3 deletions
+3
-3
app/services/activitypub/fetch_remote_account_service.rb
+
2
-
2
View file @
221c8c77
...
...
@@ -7,14 +7,14 @@ class ActivityPub::FetchRemoteAccountService < BaseService
# Should be called when uri has already been checked for locality
# Does a WebFinger roundtrip on each call
def
call
(
uri
,
id:
true
,
prefetched_body:
nil
)
def
call
(
uri
,
id:
true
,
prefetched_body:
nil
,
break_on_redirect:
false
)
@json
=
if
prefetched_body
.
nil?
fetch_resource
(
uri
,
id
)
else
body_to_json
(
prefetched_body
,
compare_id:
id
?
uri
:
nil
)
end
return
unless
supported_context?
&&
expected_type?
return
if
!
supported_context?
||
!
expected_type?
||
(
break_on_redirect
&&
@json
[
'movedTo'
].
present?
)
@uri
=
@json
[
'id'
]
@username
=
@json
[
'preferredUsername'
]
...
...
This diff is collapsed.
Click to expand it.
app/services/activitypub/process_account_service.rb
+
1
-
1
View file @
221c8c77
...
...
@@ -175,7 +175,7 @@ class ActivityPub::ProcessAccountService < BaseService
def
moved_account
account
=
ActivityPub
::
TagManager
.
instance
.
uri_to_resource
(
@json
[
'movedTo'
],
Account
)
account
||=
ActivityPub
::
FetchRemoteAccountService
.
new
.
call
(
@json
[
'movedTo'
],
id:
true
)
account
||=
ActivityPub
::
FetchRemoteAccountService
.
new
.
call
(
@json
[
'movedTo'
],
id:
true
,
break_on_redirect:
true
)
account
end
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets