mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-07-25 17:00:57 +02:00
fix(identify): gate C2PA issuer->generator attribution on AI source type (v0.6.5)
Prevents an unmapped C2PA device whose manifest incidentally contains a mapped
issuer substring (e.g. the "Adobe XMP" toolkit string in a Canon/Sony camera
capture) from being mislabeled as that AI generator ("Adobe Firefly").
_attribute_platform now names a specific AI-generator platform only when the
digital-source-type is trainedAlgorithmicMedia; otherwise it degrades to the
neutral "C2PA signer: X" label. Real Firefly/OpenAI/Google output carries the
AI source-type and is unaffected (verified: chatgpt-1.png->OpenAI,
firefly-1.png->Adobe Firefly still attribute). Closes the only real downside of
leaving Canon/Samsung/Bria device signers unmapped: detection and removal were
already unaffected; now the platform label degrades gracefully too.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -369,6 +369,18 @@ class TestIdentifyC2paDevice:
|
||||
r = identify(p, check_visible=False, check_invisible=False)
|
||||
assert r.platform == "Sony (camera, C2PA capture)"
|
||||
|
||||
def test_unmapped_device_not_mislabeled_via_incidental_issuer(self, tmp_path: Path):
|
||||
# An unmapped camera (Canon) whose manifest incidentally contains the
|
||||
# "Adobe" XMP-toolkit string, with NO AI source type, must NOT be labeled
|
||||
# "Adobe Firefly". The issuer->generator mapping only applies to AI content.
|
||||
blob = b"\xff\xd8\xff\xe1 c2pa.claim jumbf Canon EOS Adobe XMP Core \xff\xd9"
|
||||
p = tmp_path / "canon_like.jpg"
|
||||
p.write_bytes(blob)
|
||||
r = identify(p, check_visible=False, check_invisible=False)
|
||||
assert r.is_ai_generated is None # camera capture, not AI
|
||||
assert r.platform is not None
|
||||
assert "Firefly" not in r.platform # not mislabeled as an AI generator
|
||||
|
||||
|
||||
# ── Open invisible watermark (SD/SDXL/FLUX) integration ─────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user