{"action":"opened","issue":{"url":"https://api.github.com/repos/btrask/stronglink/issues/21","labels_url":"https://api.github.com/repos/btrask/stronglink/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/btrask/stronglink/issues/21/comments","events_url":"https://api.github.com/repos/btrask/stronglink/issues/21/events","html_url":"https://github.com/btrask/stronglink/issues/21","id":66639088,"number":21,"title":"DOM templating","user":{"login":"btrask","id":301663,"avatar_url":"https://avatars.githubusercontent.com/u/301663?v=3","gravatar_id":"","url":"https://api.github.com/users/btrask","html_url":"https://github.com/btrask","followers_url":"https://api.github.com/users/btrask/followers","following_url":"https://api.github.com/users/btrask/following{/other_user}","gists_url":"https://api.github.com/users/btrask/gists{/gist_id}","starred_url":"https://api.github.com/users/btrask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btrask/subscriptions","organizations_url":"https://api.github.com/users/btrask/orgs","repos_url":"https://api.github.com/users/btrask/repos","events_url":"https://api.github.com/users/btrask/events{/privacy}","received_events_url":"https://api.github.com/users/btrask/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-06T16:00:55Z","updated_at":"2015-04-06T16:00:55Z","closed_at":null,"body":"It might be nice to use DOM templating instead of our current string-based template system.\r\n\r\nThe main problem currently is that a bad template can compromise the security of the site. For example if your template is `<img src={{val}}>`, without quotes around the template variable, then an evil value can insert JavaScript attributes into your image tag. DOM templating is the sanest way to prevent this, because you need the full context of the output in order to do escaping properly (in that case, adding quotes).\r\n\r\nNote that once the templates are loaded on startup, there wouldn't necessarily be any additional overhead, because we'd just parse them once and then write them as strings like we do now.\r\n\r\nThere are some simple DOM libraries in C, which might be viable because templates themselves are more or less trusted (we aren't exposing random content to the DOM parser)."}}