I just found that some code I had added to a theme was not escaped and thus open to HTML injection and XSS (although in my particular case it would only affect the hacker, not anyone else). I had this code:
$handle = qa_get_logged_in_handle();
$this->output('etc ' . $handle . ' etc');
I have now added the qa_html function to escape $handle. But how am I supposed to know which content is already escaped, and which is not? I see code like this in Q2A's theme, it's not obvious whether the title has already been escaped:
$headtitle=(strlen($pagetitle) ? ($pagetitle.' - ') : '').$this->content['site_title'];
$this->output('<TITLE>'.$headtitle.'</TITLE>');