Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for unknown AID uploads #16

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/verifier/core/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ def recur(self, tyme):

signatures = docInfo["signatures"]
signed = []
verfed = []
for signature in signatures:
try:
file = signature["file"]
Expand All @@ -377,9 +378,9 @@ def recur(self, tyme):

aid = signature["aid"]

# First check to ensure signature if from submitter, otherwise skip
# First check to ensure signature is from submitter, otherwise skip
if aid != stats.submitter:
continue
print(f"signature from {aid} does not match submitter {stats.submitter}")

# Now ensure we know who this AID is and that we have their key state
if aid not in self.hby.kevers:
Expand All @@ -394,21 +395,23 @@ def recur(self, tyme):
siger.verfer = kever.verfers[siger.index] # assign verfer
if not siger.verfer.verify(siger.raw, ser): # verify each sig
raise kering.ValidationError(f"signature {siger.index} invalid for {file}")

verfed.append(os.path.basename(fullpath))

except KeyError as e:
raise kering.ValidationError(f"Invalid signature in manifest signature list"
f"missing '{e.args[0]}'")
except OSError:
raise kering.ValidationError(f"signature element={signature} point to invalid file")

diff = set(files) - set(signed)
diff = set(files) - set(verfed)
if len(diff) == 0:
msg = f"All {len(files)} files in report package have been signed by " \
f"submitter ({stats.submitter})."
self.filer.update(diger, ReportStatus.verified, msg)
print(msg)
else:
msg = f"{len(diff)} files from report package not signed {diff}, {signed}"
msg = f"{len(diff)} files from report package missing valid signed {diff}, {signed}"
self.filer.update(diger, ReportStatus.failed, msg)
print(msg)

Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def get():
thread.join()
if exceptions:
raise exceptions[0]


# @pytest.mark.manual
# def test_service_integration(seeder):
# with habbing.openHab(name="sid", temp=True, salt=b'0123456789abcdef') as (hby, hab):

Expand Down
Loading