Is it possible to prevent XSS attack simply be preventing any HTML tag (encoded/not encoded) in GET/POST inputs? Also, no (intentional) dynamic data from server side contains any HTML tag.
HTML tags can be prevented simply by a middleware that checks for if any html tag is presented in any GET/POST request.
All my static strings are safe and only dynamic strings are what i have to worry about, and dynamic strings either come from the client (with GET/POST requests) or come from the database, then if i can ensure that non of these characters [", ', <, >, &] are in any dynamic string coming from client or from database, will I be able to avoid XSS?
<script>var something = "<?php echo $_GET['user']; ?>";</script>
Or something like this:<img src="<?php echo $_GET['user']; ?>" />
and a payload like#" onload="doevilthings
. – Alexander O'Mara