diff --git a/src/as-validator-issue-tag.h b/src/as-validator-issue-tag.h index 28cb9e88..f48cd1dd 100644 --- a/src/as-validator-issue-tag.h +++ b/src/as-validator-issue-tag.h @@ -753,6 +753,11 @@ AsValidatorIssueTag as_validator_issue_tag_list[] = { N_("The release is missing either the `date` (preferred) or the `timestamp` property."), }, + { "release-timestamp-invalid", + AS_ISSUE_SEVERITY_ERROR, + N_("The release timestamp is invalid."), + }, + { "artifact-type-invalid", AS_ISSUE_SEVERITY_ERROR, /* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */ diff --git a/src/as-validator.c b/src/as-validator.c index 3a53864f..5a3d0d1f 100644 --- a/src/as-validator.c +++ b/src/as-validator.c @@ -1686,9 +1686,15 @@ as_validator_check_release (AsValidator *validator, xmlNode *node, AsFormatStyle g_free (prop); } else { g_autofree gchar *timestamp = as_xml_get_prop_value (node, "timestamp"); - /* Neither timestamp, nor date property exists */ if (timestamp == NULL) + /* Neither timestamp, nor date property exists */ as_validator_add_issue (validator, node, "release-time-missing", "date"); + else { + if (g_ascii_strtoll (timestamp, NULL, 10) < 3000) { + /* check if the timestamp is both a number and higher than 3000. The 3000 is used to check that it is not a year */ + as_validator_add_issue (validator, node, "release-timestamp-invalid", timestamp); + } + } } prop = as_xml_get_prop_value (node, "date_eol"); if (prop != NULL) {