Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
addons
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
26
Issues
26
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
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
hubzilla
addons
Commits
d6febe92
Commit
d6febe92
authored
Nov 04, 2020
by
Mario
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure the signature is valid and fix an issue with public keys storage
parent
16583244
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
3 deletions
+40
-3
pubcrawl/Mod_Inbox.php
pubcrawl/Mod_Inbox.php
+8
-1
pubcrawl/as.php
pubcrawl/as.php
+32
-2
No files found.
pubcrawl/Mod_Inbox.php
View file @
d6febe92
...
...
@@ -25,6 +25,11 @@ class Inbox extends \Zotlabs\Web\Controller {
$hsig
=
HTTPSig
::
verify
(
$data
);
if
(
!
(
$hsig
[
'header_signed'
]
&&
$hsig
[
'header_valid'
]
&&
$hsig
[
'content_signed'
]
&&
$hsig
[
'content_valid'
]))
{
logger
(
'HTTPSig::verify() failed: '
.
print_r
(
$hsig
,
true
),
LOGGER_DEBUG
);
http_status_exit
(
403
,
'Permission denied'
);
}
$AS
=
new
ActivityStreams
(
$data
);
if
(
$AS
->
is_valid
()
&&
$AS
->
type
===
'Announce'
&&
is_array
(
$AS
->
obj
)
...
...
@@ -104,8 +109,10 @@ class Inbox extends \Zotlabs\Web\Controller {
return
;
}
if
(
is_array
(
$AS
->
actor
)
&&
array_key_exists
(
'id'
,
$AS
->
actor
))
if
(
is_array
(
$AS
->
actor
)
&&
array_key_exists
(
'id'
,
$AS
->
actor
))
{
as_actor_store
(
$AS
->
actor
[
'id'
],
$AS
->
actor
);
}
if
(
$AS
->
type
==
'Announce'
&&
is_array
(
$AS
->
obj
)
&&
array_key_exists
(
'attributedTo'
,
$AS
->
obj
))
{
$arr
=
[];
...
...
pubcrawl/as.php
View file @
d6febe92
...
...
@@ -1127,6 +1127,37 @@ function as_actor_store($url,$person_obj) {
if
(
!
is_array
(
$person_obj
))
return
;
// it seems we were loosing public keys due to an issue Lib/Activity::encode_person()
// if so, refetch the person object and fix it.
$fix_pubkey
=
false
;
if
(
!
$person_obj
[
'publicKey'
][
'publicKeyPem'
])
{
$fix_pubkey
=
true
;
$x
=
as_fetch
(
$url
);
if
(
!
$x
)
return
;
$AS
=
new
ActivityStreams
(
$x
);
if
(
!
$AS
->
is_valid
())
{
return
;
}
$person_obj
=
null
;
if
(
in_array
(
$AS
->
type
,
[
'Application'
,
'Group'
,
'Organization'
,
'Person'
,
'Service'
]))
{
$person_obj
=
$AS
->
data
;
}
elseif
(
$AS
->
obj
&&
(
in_array
(
$AS
->
obj
[
'type'
],
[
'Application'
,
'Group'
,
'Organization'
,
'Person'
,
'Service'
]
)))
{
$person_obj
=
$AS
->
obj
;
}
else
{
return
;
}
}
$icon
=
''
;
$name
=
$person_obj
[
'name'
];
if
(
!
$name
)
...
...
@@ -1223,9 +1254,8 @@ function as_actor_store($url,$person_obj) {
// Record exists. Cache existing records for one week at most
// then refetch to catch updated profile photos, names, etc.
$d
=
datetime_convert
(
'UTC'
,
'UTC'
,
'now - 1 week'
);
if
(
$r
[
0
][
'xchan_name_date'
]
>
$d
)
if
(
$r
[
0
][
'xchan_name_date'
]
>
$d
&&
$fix_pubkey
===
false
)
return
;
// update existing record
...
...
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