1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2025-01-30 10:52:18 +00:00

Update FederationController

This commit is contained in:
Daniel Supernault 2019-03-01 16:17:45 -07:00
parent cdb4a9b38e
commit da28b13545
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -199,9 +199,16 @@ XML;
$body = $request->getContent();
$bodyDecoded = json_decode($body, true, 8);
$signature = $request->header('signature');
$date = $request->header('date');
if(!$signature) {
abort(400, 'Missing signature header');
}
if(!$date) {
abort(400, 'Missing date header');
}
if(!now()->parse($date)->gt(now()->subDays(1)) || !now()->parse($date)->lt(now()->addDays(1))) {
abort(400, 'Invalid date');
}
$signatureData = HttpSignature::parseSignatureHeader($signature);
$keyId = Helpers::validateUrl($signatureData['keyId']);
$id = Helpers::validateUrl($bodyDecoded['id']);