fix(chrome-ledger): enforce implant ownership
This commit is contained in:
1 parent
a4eba116db
commit
48c7ab4618
3 files changed
+6
-6
No files matched your search
@@ -68,11 +68,11 @@ def check_certificate(connection, ledger, implant_id, owner_id, payload=None):
|
||||
return result
|
||||
|
||||
|
||||
def reissue(connection, ledger, implant_id, payload):
|
||||
def reissue(connection, ledger, implant_id, owner_id, payload):
|
||||
key, digest = certificates.signing_request(payload)
|
||||
with connection:
|
||||
connection.execute("BEGIN IMMEDIATE")
|
||||
row = access.implant(connection, implant_id)
|
||||
row = access.implant(connection, implant_id, owner_id)
|
||||
current = repositories.get_current_certificate(connection, implant_id)
|
||||
if current is None:
|
||||
raise LedgerError(409, "Implant has no valid certificate")
|
||||
@@ -86,7 +86,7 @@ def reissue(connection, ledger, implant_id, payload):
|
||||
if not isinstance(signature, str):
|
||||
raise LedgerError(401, "Invalid signature for the current key")
|
||||
current_key_authorized = keys.verify_implant_signature(previous.public_key(), signature, message)
|
||||
if not current_key_authorized and not keys.verify_implant_signature(key, signature, message):
|
||||
if not current_key_authorized:
|
||||
raise LedgerError(401, "Invalid signature for the current key")
|
||||
now = utc_now()
|
||||
details = json.loads(envelopes.decode_envelope(ledger.master_key, row["details"], implant_id))
|
||||
|
||||
Reference in new issue
Block a user