-
-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
5.3.1 has too much going on and should be shortened #1589
Comments
Point from @ImanSharaf #1561 (comment)
|
We also should address CSS related issue with this: #1558 |
(updated 2023-03-29, 2023-03-30) As the Pandora box is opened... We still need to have abstract requirement to cover all not listed syntaxes:
Separate requirements:
I did not cover from 5.3.1 - do we need to mention it?
CSS - (for some reason it is missing from issue description but actually exists in bleeding edge version) - As there is no such thing like CSS encoding, we need to use input validation and/or sanitize when using userinput in CSS. Should be covered via #1558 |
Note: CSS encoding is a thing, it's a native JS function. CSS.escape for example. |
I agree that we should split out this requirement as @elarlang has set out above, the treatment should either be one or more of the following:
|
I have started to write those requirements many times.. but those still feel like duplicates. So, there is a turn-around in my proposal, and it is also more aligned with the goals to make fewer requirements to the ASVS and provide "requirement per principle", not "requirement per principle per syntax/technology". We don't have separate requirements for "use authorization correctly in framework x" and "use authorization correctly in framework y", so we also should not have separate requirements for "use encoding correctly for HTML" and "use encoding correctly for URL". The more I watch the current requirement, the more I think it's ok. Just need to shorten it a bit.
The list of examples can be fine-tuned. Splitting the requirement per syntax makes it more like a checklist, and this is a testing guide area. |
For brainstorming - to cover entire chapters 5.2 and 5.3, it's enough to have a requirement:
Where we can put the line between "too detailed" vs "too abstract". |
CSS encoding does exist in native javascript and other languages meant to escape CSS Variables. See: https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape_static |
Jim, you already said that (#1589 (comment)). Just please, (re)read and learn the issues before commenting :) |
Understood and will do. |
My a bit updated proposal:
|
I like it Elar. |
So I am not sure I completely understood your draft, does my rephrasing make sense:
|
I’ve been thinking a lot about this and am trying to reduce my concerns to the bare minimum.
Base64url encoding is not that important to safe document construction. It’s a little important when adding binary data or JWT’s to a url.
But validating untrusted URL’s is crucial to safe document construction. URL’s are the only case where encoding will still lead to client side injection and that is such a common successful attack I want it to be addressed a lot more prominently when it comes to document construction.
So my bottom line is:
1) give url validation a very prominent requirement when it comes to document construction. Mentioning url encoding by itself without mentioning validation is dangerous.
2) somehow directly mention base64url encoding when it comes to adding binary data or JWT’s to a url
I do not think the current requirements address these prominently enough.
|
Having discussed this further with Elar, the direction becomes a little too general because when you start worrying about building HTML attribute names or element names dynamically or building JSON attribute names dynamically you are getting into the territory of allowing the end user to write their own code as well :) This can't be fixed by encoding so we will leave it for now. This returns us to how to handle this requirement. My current feeling is that the fact that the current 5.3.1 requirement is a little too abstract is one of the things that has led to this long discussion. My current feeling is to have specific requirements which cover the key cases and then a catch-all output encoding for other cases which describes a function's behaviour "takes user input and builds some other representation or command based upon it". Possible rough splitting for now:
|
Here is a detailed list to consider. Some of these are duplicated from other requirements, admittedly. HTML Docs
LDAP
Database
XML
OS
Logs
|
@tghosth to draft some requirements that sit in between 1 requirement for all of the above and individual requirements for everyone one of the above. |
|
Politely, no. I think safely building HTML (encoding and similar) and avoiding template injection (avoid server side template assembly) are different controls. |
This addresses sanitizing user authored cunks of CSS. Just like untrusted HTML is need to be sanitized.
This addresses adding user controlled data, like a color, into blocks of otherwise static css. Different controls and to some degree different attacks, too. |
I updated the table above. |
I merged this in. I added a catch all for any encoding scenarios not covered elsewhere as I suggested here. I don't think this wording is perfect but it has taken too long to spend further on it for now. |
I prefer to not have the 5.3.14 and have 5.3.1 to cover all cases. The requirement text must be independent and understandable when watched just a requirement alone - it can not contain "not mentioned above". |
I'd really rather keep 5.3.1 focused on it's particular area. Would it be better to just change the text to say:
|
Whilst the concept of a catch-all makes sense, having thought about it more, I don't think it adds that much value compared to adding another, potentially confusing requirement. |
We also have 5.2.2 as a sort of catch all for dangerous sinks🙃 |
@set-reminder 7 days @tghosth to remove 5.3.14 |
⏰ Reminder
|
5.3.14 should be removed in #2026 |
The text was updated successfully, but these errors were encountered: