Question 310
Architecture principle case — A support portal escapes HTML in a value that is later placed inside JavaScript code. The design review is extracting the transferable lesson for later software projects. Which security principle best governs the observation?
Explanation
Correct Answer
In Q0310, the fictional organizational observation is: A support portal escapes HTML in a value that is later placed inside JavaScript code. The distinct underlying risk mechanism is: The encoder did not match the parser context where untrusted data was eventually interpreted. Choice B addresses the governing security-design principle because it states: Encoding works only when tailored to the grammar of the final output context. This fits the governing design principle: Encoding works only when tailored to the grammar of the final output context. For measurable acceptance, the team should: Browser tests with inert hostile samples confirm text cannot become executable markup or script. Sustained prevention requires: Require safe rendering APIs and context-specific encoding review in UI changes.
Incorrect Answers
Choice A describes a plausible governing security-design principle for a separate security issue, weak account enumeration protection: Public authentication responses reveal sensitive account existence through wording or timing. Its proposed response, “Error handling should not become a directory of identities attackers can validate”, does not directly resolve this case. The discriminating cause is: The encoder did not match the parser context where untrusted data was eventually interpreted. A stronger governing security-design principle would be: Encoding works only when tailored to the grammar of the final output context. An objective reviewer would test: Browser tests with inert hostile samples confirm text cannot become executable markup or script.
Choice C describes a plausible governing security-design principle for a separate security issue, sql query composed from user fields: Untrusted input was used to construct executable database syntax rather than bound as data. Its proposed response, “Separating instructions from untrusted data prevents injection at database execution boundaries”, does not directly resolve this case. The discriminating cause is: The encoder did not match the parser context where untrusted data was eventually interpreted. A stronger governing security-design principle would be: Encoding works only when tailored to the grammar of the final output context. An objective reviewer would test: Browser tests with inert hostile samples confirm text cannot become executable markup or script.
Choice D describes a plausible governing security-design principle for a separate security issue, string length bypass after normalization: Identity comparisons and length rules used inconsistent Unicode representations. Its proposed response, “Identifier security depends on consistent canonical representation across validation and storage”, does not directly resolve this case. The discriminating cause is: The encoder did not match the parser context where untrusted data was eventually interpreted. A stronger governing security-design principle would be: Encoding works only when tailored to the grammar of the final output context. An objective reviewer would test: Browser tests with inert hostile samples confirm text cannot become executable markup or script.



Secure Software Design (KEO1) Practice Tests