Media SVG validation rules for format compliance, security, and content restrictions
FilenameExtensionMustBeValid
| Preconditions |
|---|
| content-type is image/svg+xml |
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
| Validate that filename extension is .svg |
Example Validation Report
{
"code": "VALIDATION__FilenameExtensionMustBeValid",
"message": "Filename extension must be .svg",
"severity": "VIOLATION"
}
SVGHasUnsupportedElementOrAttribute
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
| Validate that an SVG document includes only a supported element/attribute |
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
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
| Validate that an SVG document does not include any element or attribute that must be rejected |
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
| Definition | Severity | API | Sample | Mode |
|---|---|---|---|---|
| Validate that the XML document is well-formed |
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"
}