From c611045dd2754be89f1f9b54791bec2df40c0f32 Mon Sep 17 00:00:00 2001 From: Tamas Koczka Date: Thu, 24 Aug 2023 12:58:38 +0000 Subject: [PATCH] kernelCTF: PR GHA: better schema validation error message, fix typo --- kernelctf/check-submission.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernelctf/check-submission.py b/kernelctf/check-submission.py index 0fa49981..3842ccf4 100755 --- a/kernelctf/check-submission.py +++ b/kernelctf/check-submission.py @@ -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" @@ -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 `{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):