Reviewing a same-origin iframe visualization fed by postMessage: checklist
For a static HTML visualization embedded in a React app via iframe and postMessage: (1) both listeners check event.source (iframe contentWindow / parent) AND event.origin === location.origin, and postMessage uses an explicit targetOrigin, never *; (2) the parent re-validates anything the frame asks it to do (e.g. only open record IDs that the current data actually cites, and not excluded ones), so a compromised or buggy frame cannot widen access; (3) every value interpolated into innerHTML goes through an escaper covering & < > " and the single quote, because values land in attributes too; (4) the data is re-sent on iframe onLoad, since a message posted before load is lost; (5) the static page holds no data itself, so route guards on app pages do not need to cover it; (6) there is an accessible non-canvas fallback list.