Skip to content

Commit

Permalink
kernelCTF: PR GHA: better schema validation error message, fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
koczkatamas committed Aug 24, 2023
1 parent b3bddb4 commit c611045
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernelctf/check-submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ def parseCsv(csvContent):
if schemaVersionM:
schemaVersion = int(schemaVersionM.group(1))
if schemaVersion < MIN_SCHEMA_VERSION:
error(f"The `metadata.json` schema version (v{schemaVersion}) is not supported anymore, " + "
error(f"The `metadata.json` schema version (v{schemaVersion}) is not supported anymore, " +
f"please use `metadata.schema.v{MIN_SCHEMA_VERSION}.json`. Verifying file against v{MIN_SCHEMA_VERSION}.")

schemaVersion = MIN_SCHEMA_VERSION

schemaUrl = f"https://google.github.io/security-research/kernelctf/metadata.schema.v{schemaVersion}.json"
Expand All @@ -153,7 +154,7 @@ def parseCsv(csvContent):
metadataErrors = list(jsonschema.Draft202012Validator(schema).iter_errors(metadata))
if len(metadataErrors) > 0:
for err in metadataErrors:
error(f"Schema validation of `metadata.json` failed with the following error:\n```\n{err}\n```")
error(f"Schema validation of `metadata.json` failed at the `<root>{err.json_path[1:]}` node with the following error: `{err.message}`")

submissionIds = metadata.get("submission_ids", None) or metadata["submission_id"]
if isinstance(submissionIds, str):
Expand Down

0 comments on commit c611045

Please sign in to comment.