Skip to main content

Media SVG validation rules for format compliance, security, and content restrictions

FilenameExtensionMustBeValid

Preconditions
content-type is image/svg+xml
DefinitionSeverityAPISampleMode
Validate that filename extension is .svg
VIOLATION
POST
S
Example Validation Report
{
"code": "VALIDATION__FilenameExtensionMustBeValid",
"message": "Filename extension must be .svg",
"severity": "VIOLATION"
}

SVGHasUnsupportedElementOrAttribute

DefinitionSeverityAPISampleMode
Validate that an SVG document includes only a supported element/attribute
VIOLATION
POST
S
Example Validation Report
{
"code": "VALIDATION__SVGHasUnsupportedElementOrAttribute",
"message": "SVG element or attribute is not supported: '{{reason}}'",
"severity": "VIOLATION",
"context": {
"reason": "Unsupported SVG 'keySplines' in '<path>'"
}
}

SVGElementOrAttributeIsRejected

DefinitionSeverityAPISampleMode
Validate that an SVG document does not include any element or attribute that must be rejected
VIOLATION
POST
S
Example Validation Report
{
"code": "VALIDATION__SVGElementOrAttributeIsRejected",
"message": "SVG element or attribute is rejected for reason: '{{reason}}'",
"severity": "VIOLATION",
"context": {
"reason": "Rejected SVG 'style' in '<svg>': 'Allows inline CSS, which can potentially be used for phishing attacks.'"
}
}

XMLDocumentIsNotWellFormed

DefinitionSeverityAPISampleMode
Validate that the XML document is well-formed
VIOLATION
POST
S
Example Validation Report
{
"code": "VALIDATION__XMLDocumentIsNotWellFormed",
"message": "Must have one root element; tags matched by closing tag; elements in expected order; element only containing other valid elements; Element only has attributes that are valid for the element.",
"severity": "VIOLATION"
}