CRITICAL
Rule Definition
Without well-established and maintained trust boundaries, programmers will inevitably lose track of which pieces of data have been validated and which have not. This confusion will eventually allow some data to be used without first being validated.
Remediation
Perform input data validation before storing or transmitting the data.
Violation Code Sample
String usrname; // value given by an API request
if (session.getAttribute(ATTR_USR) == null) {
session.setAttribute(ATTR_USR, usrname);
}
Fixed Code Sample
// Never mix trusted and untrusted data
Reference
CWE-501: Trust Boundary Violation
https://cwe.mitre.org/data/definitions/501.html
Open Web Application Security Project (OWASP)
https://www.owasp.org/index.php/Top_10-2017_A3-Sensitive_Data_Exposure
Related Technologies
Technical Criterion
Secure Coding - Input Validation
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.