Test files › Images › svg-plain.svg
Sample SVG file (plain)
Clean SVG with shapes and text, no scripts or external references.
↓ Download svg-plain.svg| Filename | svg-plain.svg |
| Format | SVG |
| Size | 303 bytes (303 bytes) |
| MIME type | image/svg+xml |
| SHA-256 | 083bfde9c3ad9327b6d94c7337d66455717c543f2d765b3ad0a968188abcfcb0 |
What this file catchesBaseline for the SVG sanitiser cases below - this one must survive sanitisation intact.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
An SVG is a document that can run script, so an uploaded one is an XSS risk when served inline. This screen is triage, not a sanitiser: serve user SVGs from a separate domain with a strict Content-Security-Policy, or rasterise them.
import re
RISKS = [
(r"<!ENTITY|<!DOCTYPE[^>]*\[", "declares entities (XXE)"),
(r"<script\b", "contains <script>"),
(r"\son[a-z]+\s*=", "has an on* event handler"),
(r"(?:href|src)\s*=\s*[\"']?\s*javascript:", "links to javascript:"),
(r"<foreignObject\b", "embeds HTML in foreignObject"),
(r"(?:href|src)\s*=\s*[\"']?\s*https?://", "loads an external resource"),
]
with open("svg-plain.svg", encoding="utf-8") as f:
svg = f.read()
found = [label for pattern, label in RISKS if re.search(pattern, svg, re.I)]
print("unsafe to serve inline: " + ", ".join(found) if found else "no active content found")Run against this file, it prints: no active content found
Related guides and tools
Sample image filesFile signaturesMIME typesUpload validation checklistCheck a file's real typeVerify its SHA-256
Download & verify
curl -fsSL -o "svg-plain.svg" "https://files.hexaqa.com/image/svg-plain.svg"
curl -fsSL "https://files.hexaqa.com/image/svg-plain.svg" | sha256sum
# expect: 083bfde9c3ad9327b6d94c7337d66455717c543f2d765b3ad0a968188abcfcb0