Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

9.1.2. DevSecOps and Shift-Left Security

💡 First Principle: Most software vulnerabilities fall into a small number of recurring patterns. Understanding these patterns — and why they occur — enables both prevention (don't write vulnerable code in the first place) and detection (know what to test for). The OWASP Top 10 is the industry-standard taxonomy of the most impactful web application vulnerability classes; the CWE (Common Weakness Enumeration) provides a broader catalog of software weakness types.

OWASP Top 10 (2021) — the most tested vulnerability classes:
RankCategoryRoot CausePrevention
A01Broken Access ControlMissing authorization checks; insecure direct object referencesEnforce access control on every request; deny by default
A02Cryptographic FailuresWeak algorithms; unencrypted sensitive data; poor key managementTLS for transit; AES-256 for rest; proper key management
A03Injection (SQL, OS, LDAP)Untrusted data interpreted as commandsParameterized queries; input validation; least privilege DB accounts
A04Insecure DesignThreat modeling not performed; security not in requirementsThreat modeling; security design reviews; secure design patterns
A05Security MisconfigurationDefault credentials; unnecessary features enabled; verbose errorsHardening checklists; config as code; disable defaults
A06Vulnerable/Outdated ComponentsThird-party libraries with known CVEsSCA scanning; dependency update automation; SBOM
A07Identification/Auth FailuresWeak passwords; no MFA; session management flawsStrong auth; MFA; secure session management
A08Software and Data Integrity FailuresUnsigned updates; insecure deserialization; CI/CD pipeline attacksSign artifacts; verify signatures; secure pipeline
A09Security Logging/Monitoring FailuresInsufficient logging; no alerting; logs not reviewedComprehensive logging; SIEM integration; tested alerting
A10SSRF (Server-Side Request Forgery)Application fetches remote resources without validating URLsAllowlist of permitted URLs; network segmentation; block internal requests

Buffer overflow: Writing data beyond the allocated memory buffer — the data overwrites adjacent memory, potentially including the return address on the call stack. An attacker who controls what is written can overwrite the return address to point to attacker-controlled code (shellcode).

Prevention: memory-safe languages (Go, Rust, Python, Java don't allow direct memory access); address space layout randomization (ASLR); data execution prevention (DEP/NX bit); stack canaries (random values placed between buffer and return address; checked before return).

Cross-Site Scripting (XSS): Attacker injects malicious JavaScript into a web page that executes in other users' browsers. Reflected XSS: payload in URL returned in response. Stored XSS: payload saved to database, executed when other users view the page. DOM-based XSS: payload manipulates the DOM without involving the server.

Prevention: output encoding (convert <script> to &lt;script&gt; before rendering); Content Security Policy (CSP) headers; input validation.

Cross-Site Request Forgery (CSRF): Attacker tricks an authenticated user's browser into submitting a malicious request to a trusted site. The browser automatically includes session cookies, so the request is authenticated. Prevention: CSRF tokens; SameSite cookie attribute; verify Origin/Referer headers.

Race conditions (TOCTOU — Time of Check to Time of Use): A vulnerability where the state of a resource changes between when it is checked and when it is used. Prevention: atomic operations; file locking; database transactions with appropriate isolation levels.

⚠️ Exam Trap: SQL injection is prevented by parameterized queries — NOT by input validation alone. Input validation (rejecting single quotes) is an incomplete defense: attackers can encode their payloads to bypass validation. Parameterized queries separate the SQL structure from the data, making injection structurally impossible regardless of what the user inputs.

Reflection Question: A web application uses the following code to query user records: query = "SELECT * FROM accounts WHERE id = " + request.params["id"]. Describe the attack this enables, provide an example malicious input, explain why input filtering is an incomplete fix, and provide the correct implementation that eliminates the vulnerability structurally.

Alvin Varughese
Written byAlvin Varughese
Founder15 professional certifications