digimarc-corp / c2pa-content-credentials-extension

C2PA Chrome Extension
MIT License
16 stars 7 forks source link

[BUG] This extension rewrites the id attribute of the img element, which breaks some websites and web applications #43

Closed sounisi5011 closed 5 months ago

sounisi5011 commented 6 months ago

Currently, this extension sets its own id attribute value to the target img element when verifying.

https://github.com/digimarc-corp/c2pa-content-credentials-extension/blob/66a02d410f6fd53ace934ffebc5b05fb97cb49a1/lib/imageUtils.js#L266-L267

However, this behavior breaks the CSS layout on some sites that depend on the id attribute value, and also breaks the JavaScript that retrieves the element from the id attribute.

In general, a website assumes that the id attribute value will not change (or will only be changed by the website itself). id attributes are unique; they should not be rewritten by browser extensions. If a browser extension rewrites the id attribute value, the pre-existing id attribute value is lost.

Browser extensions MUST NOT rewrite id attribute values. Instead, use the data-* attribute or hold the object value of the DOM element itself in the handledImages array.

clementh59 commented 5 months ago

Hi @sounisi5011,

That's a good point. We'll publish a new version in the coming days with a fix. Thank you for taking the time to create the issue.

domguinard commented 5 months ago

@sounisi5011 many thanks for your bug report and suggestions for fixing. I'm happy to let you know that v0.0.4 has been released and should fix this issue. Thanks again and if you do like this version more please do reconsider leaving us a few more stars on the chrome web store.