ensure public api served blocks are not decrypted
This commit is contained in:
parent
62a01b6dba
commit
24284e058f
@ -5,7 +5,7 @@ import onionrexceptions
|
||||
class GetBlockData:
|
||||
def __init__(self, client_api_inst=None):
|
||||
return
|
||||
|
||||
|
||||
def get_block_data(self, bHash, decrypt=False, raw=False, headerOnly=False):
|
||||
if not stringvalidators.validate_hash(bHash): raise onionrexceptions.InvalidHexHash("block hash not valid hash format")
|
||||
bl = onionrblockapi.Block(bHash)
|
||||
@ -26,7 +26,7 @@ class GetBlockData:
|
||||
validSig = False
|
||||
signer = bytesconverter.bytes_to_str(bl.signer)
|
||||
if bl.isSigned() and stringvalidators.validate_pub_key(signer) and bl.isSigner(signer):
|
||||
validSig = True
|
||||
validSig = True
|
||||
bl.bheader['validSig'] = validSig
|
||||
bl.bheader['meta'] = ''
|
||||
retData = {'meta': bl.bheader, 'metadata': bl.bmetadata}
|
||||
|
@ -43,7 +43,7 @@ def get_block_data(publicAPI, data):
|
||||
if stringvalidators.validate_hash(data):
|
||||
if not config.get('general.hide_created_blocks', True) or data not in publicAPI.hideBlocks:
|
||||
if data in blockmetadb.get_block_list():
|
||||
block = apiutils.GetBlockData().get_block_data(data, raw=True)
|
||||
block = apiutils.GetBlockData().get_block_data(data, raw=True, decrypt=False)
|
||||
try:
|
||||
block = block.encode() # Encode in case data is binary
|
||||
except AttributeError:
|
||||
|
Loading…
Reference in New Issue
Block a user