Controls and boundaries
| Operation | Control | Incomplete repair | Preserved behavior |
|---|---|---|---|
| Read a private object | Authorize the tenant and object relationship | Check only that the user is signed in | The permitted owner reads the same record |
| Search with SQL | Bind values; allowlist structural identifiers | Strip a familiar OR payload | A legitimate apostrophe still works |
| Render text in HTML | Encode for the actual output context | Encode text, then use it as a URL | Ordinary Unicode remains readable |
| Accept a cookie-authenticated change | Validate a nonempty session-bound request token | Compare two missing token values | The valid POST succeeds |
| Use a signed token | Verify signature and required claims | Decode or check expiry alone | A token for this audience works |
| Fetch a supplied destination | Parse and restrict destinations; control redirects | Test whether a hostname contains a trusted word | The approved document still loads |
| Select a release artifact | Bind approved name, version and digest | Trust a version label alone | The approved artifact is accepted |
| Handle a permission failure | Deny without authorization evidence | Convert a timeout into an allow | Authorized requests recover after the service recovers |
A parameterized query
const rows = db.query(
'SELECT id FROM stock WHERE tenant = $1 AND tag = $2',
[session.tenant, input.tag]
);
The tenant comes from trusted authentication context. Binding protects query structure; it doesn’t authorize the caller. A requested column or sort direction needs a mapping to approved SQL fragments rather than a value parameter.
A repair checklist
Reproduce the unsafe request. Identify the source and the protected operation. Apply the control where that operation runs. Check a different bypass, a legitimate boundary input and the ordinary feature. Review logs and errors for the data the patch exposes.
The course supplies checked exercises; independent interviews add changed requirements. Read the threat modeling example before extending the feature. This reference does not replace a threat model, the ASVS requirements that apply to your application or tests against its deployed stack.
The new lessons and practical interviews in this extension are in English. Earlier translated lessons retain their native versions.