666ghj/MiroFish · error · StarHistoryError

generated SVG contains an unreviewed image

Error message

generated SVG contains an unreviewed image

What it means

Raised by `_validate_svg`'s image audit (scripts/star_history.py:1219). `<image>` elements are permitted only in exactly two reviewed forms: the owner avatar (fixed x/y/size, OWNER_AVATAR_DATA_URI href, clip-path) and the watermark logo (WATERMARK_LOGO_DATA_URI). Any other `<image>` — different geometry, href, or extra attributes — is 'unreviewed' and rejected, since images are the main data-URI injection channel.

Source

Thrown at scripts/star_history.py:1219

                "y": "12",
                "width": "22",
                "height": "22",
                "href": OWNER_AVATAR_DATA_URI,
                "clip-path": "url(#clip-circle-title)",
            }
            watermark_attributes = {
                "x": "635",
                "y": "508.333",
                "width": "20",
                "height": "20",
                "href": WATERMARK_LOGO_DATA_URI,
            }
            if element.attrib == avatar_attributes:
                avatar_count += 1
            elif element.attrib == watermark_attributes:
                watermark_count += 1
            else:
                raise StarHistoryError("generated SVG contains an unreviewed image")
        for raw_name, value in element.attrib.items():
            if raw_name.startswith("{") or raw_name not in allowed_for_element:
                raise StarHistoryError("generated SVG contains a forbidden attribute")
            if (
                not value.isascii()
                or "\\" in value
                or "/*" in value
                or "*/" in value
                or any(ord(character) < 0x20 for character in value)
            ):
                raise StarHistoryError("generated SVG contains an unsafe attribute value")
            exact_values = exact_attribute_values.get(raw_name)
            if exact_values is not None and value not in exact_values:
                raise StarHistoryError("generated SVG contains an unsafe attribute value")
            if raw_name == "href":
                if local_name != "image" or value not in {
                    OWNER_AVATAR_DATA_URI,
                    WATERMARK_LOGO_DATA_URI,

View on GitHub (pinned to b5b53acc57)

Solutions

  1. If you forked branding: replace OWNER_AVATAR_DATA_URI / WATERMARK_LOGO_DATA_URI constants rather than editing the `<image>` attributes, and keep geometry exactly as templated.
  2. If geometry must change, update both the template and the mirrored `avatar_attributes`/`watermark_attributes` literals inside `_validate_svg` so the audit stays in sync.
  3. Never add extra `<image>` elements; the design allows exactly one avatar and one watermark.
  4. Diff your rendered SVG against a known-good output to find which attribute diverged.

Example fix

# fork: swap branding safely
# before: template edited to <image href="data:image/png;base64,MYLOGO..." ...> alongside old audit -> raises

# after: keep the template untouched; replace the constant
OWNER_AVATAR_DATA_URI = "data:image/png;base64,MYLOGO..."  # geometry & audit unchanged
Defensive patterns

Strategy: try-catch

Try / catch

try:
    _validate_svg(payload)
except StarHistoryError as exc:
    if "unreviewed image" in str(exc):
        raise ValueError("<image> must exactly match the avatar or watermark template") from exc
    raise

Prevention

When it happens

Trigger: An `<image>` element whose `element.attrib` dict is not byte-identical to `avatar_attributes` or `watermark_attributes`: changed coordinates, a different/extra attribute, a swapped data URI, or a third image added by fork code. Even a reordered-but-equal dict is fine (dict equality ignores order), but any value change fires.

Common situations: Forks repositioning the avatar/watermark or substituting their own logo data URI without updating the reviewed attribute sets; attempts to embed arbitrary pictures; template refactors that add `opacity` or `id` to the image elements.

Related errors


AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14). Data as JSON: /api/errors/dc518c4e79f77094. Report an issue: GitHub.