kopia lustrzana https://github.com/nextcloud/social
fixing signature check
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/586/head
rodzic
a1221cacf6
commit
e85bb3495c
|
|
@ -320,13 +320,13 @@ class LinkedDataSignature implements JsonSerializable {
|
||||||
*/
|
*/
|
||||||
public function import(array $data) {
|
public function import(array $data) {
|
||||||
|
|
||||||
if (!in_array(ACore::CONTEXT_SECURITY, $this->getArray('@context', $data, []))) {
|
// if (!in_array(ACore::CONTEXT_SECURITY, $this->getArray('@context', $data, []))) {
|
||||||
throw new LinkedDataSignatureMissingException();
|
// throw new LinkedDataSignatureMissingException('no @context security entry');
|
||||||
}
|
// }
|
||||||
|
|
||||||
$signature = $this->getArray('signature', $data, []);
|
$signature = $this->getArray('signature', $data, []);
|
||||||
if ($signature === []) {
|
if ($signature === []) {
|
||||||
throw new LinkedDataSignatureMissingException();
|
throw new LinkedDataSignatureMissingException('missing signature');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setType($this->get('type', $signature, ''));
|
$this->setType($this->get('type', $signature, ''));
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ class SignatureService {
|
||||||
public function generateKeys(Person &$actor) {
|
public function generateKeys(Person &$actor) {
|
||||||
$res = openssl_pkey_new(
|
$res = openssl_pkey_new(
|
||||||
[
|
[
|
||||||
"digest_alg" => "rsa",
|
"digest_alg" => "rsa",
|
||||||
"private_key_bits" => 2048,
|
"private_key_bits" => 2048,
|
||||||
"private_key_type" => OPENSSL_KEYTYPE_RSA,
|
"private_key_type" => OPENSSL_KEYTYPE_RSA,
|
||||||
]
|
]
|
||||||
|
|
@ -232,6 +232,7 @@ class SignatureService {
|
||||||
* @throws ItemUnknownException
|
* @throws ItemUnknownException
|
||||||
* @throws RequestResultNotJsonException
|
* @throws RequestResultNotJsonException
|
||||||
* @throws DateTimeException
|
* @throws DateTimeException
|
||||||
|
* @throws UnauthorizedFediverseException
|
||||||
*/
|
*/
|
||||||
public function checkObject(ACore $object): bool {
|
public function checkObject(ACore $object): bool {
|
||||||
try {
|
try {
|
||||||
|
|
@ -263,6 +264,10 @@ class SignatureService {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (LinkedDataSignatureMissingException $e) {
|
} catch (LinkedDataSignatureMissingException $e) {
|
||||||
|
$this->miscService->log(
|
||||||
|
'LinkedDataSignatureMissingException while checkObject : ' . $e->getMessage()
|
||||||
|
. ' --- ' . json_encode($object), 1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue