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
f8a72f29
Commit
f8a72f29
authored
Feb 21, 2019
by
kaniini
Browse files
activitypub: sign http date header
parent
1c87102d
Pipeline
#7982
passed with stages
in 4 minutes and 53 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/activity_pub/activity_pub.ex
View file @
f8a72f29
...
...
@@ -823,11 +823,16 @@ def publish_one(%{inbox: inbox, json: json, actor: actor, id: id} = params) do
digest
=
"SHA-256="
<>
(
:crypto
.
hash
(
:sha256
,
json
)
|>
Base
.
encode64
())
date
=
NaiveDateTime
.
utc_now
()
|>
Timex
.
format!
(
"{WDshort}, {D} {Mshort} {YYYY} {h24}:{m}:{s} GMT"
)
signature
=
Pleroma
.
Web
.
HTTPSignatures
.
sign
(
actor
,
%{
host:
host
,
"content-length"
:
byte_size
(
json
),
digest:
digest
digest:
digest
,
date:
date
})
with
{
:ok
,
%{
status:
code
}}
when
code
in
200
..
299
<-
...
...
@@ -837,6 +842,7 @@ def publish_one(%{inbox: inbox, json: json, actor: actor, id: id} = params) do
json
,
[
{
"Content-Type"
,
"application/activity+json"
},
{
"Date"
,
date
},
{
"signature"
,
signature
},
{
"digest"
,
digest
}
]
...
...
Write
Preview
Supports
Markdown
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