Can this be done safely?
Depending on how you define "safe." An external style sheet can make things look ugly or play tricks with existing controls on the site. You cannot prevent this, as it will be impossible to detect. Here is a good overview of the malicious things that can be done in this way.
In addition, it is obvious that CSS can initiate requests to any URL by setting a background-image
or similar. The browser will notice that the URL is not a valid image resource, but the request will always be executed. Thus, it is possible to provoke a password request in order to understand that the site user may mistakenly accept his own login invitation.
I don’t know about any CSS attack scripts, although I’m sure that IE behavior
can be one, I would definitely separate them.
There is a question about stack overflow , but none of the vulnerabilities mentioned in the accepted answer work with clean external style sheets.
source share