Description
I discussed this briefly with @koto and thought I'd file it to not lose track of the idea. What if instead of sinks we add the guards at the various primitives. E.g., not <a>
, <form>
, etc. but "navigate". Not fetch()
, <img>
, etc. but "fetch". Not appendChild()
et al but "prepare a script" (or some such). Not innerHTML
and friends but "HTML fragment parsing algorithm".
This would put the actual protections right at the dangerous points. We'd still have to change sinks to allow for typed objects to reach the dangerous points, but there's no longer the issue of overlooking a sink or overlooking trusted types when adding a new sink. Or the issue of it not being clear how to update all the various sinks as with Location
as we could opt not to add trusted types for all of them.