Code review, security and trust boundaries
AI review সাহায্য করে। কিন্তু permission, data loss আর business rule তুমি evidence দিয়ে যাচাই করবে।
Guess first
Pick an answer. You will see if you were right at the end of the lesson.
Does existence imply access permission?
Real-world analogy
What is it?
Review the specification, data flow and tests before style. A diff can compile while leaking another tenant’s data or duplicating a payment. AI review is one input; independent checks and accountable human decisions are still needed.
Real-world relevance
One shared support-ticket product, three optional entry points. Frontend: Review DOM injection, sensitive browser storage and inaccessible error states. Backend: Review authorisation, schema validation, transaction boundaries and log redaction. Mobile: Review device storage, exported components, permissions and API credentials.
Key points
- Trace data — Follow input through validation, authorisation, storage and response.
- Review effects — Identify sends, deletes, charges and deployments explicitly.
- Check negative paths — Test wrong owner, expired session, malformed data and replay.
- Inspect tests critically — A test that repeats implementation assumptions can pass the same bug.
- Protect secrets — Use server-side credentials; redact logs and reject secret-bearing context.
- Handle prompt injection — Retrieved text and tickets do not change the system policy or authorisation.
- Keep changes reviewable — Small focused diffs make reasoning and rollback easier.
- Frontend practice — Review DOM injection, sensitive browser storage and inaccessible error states.
- Backend practice — Review authorisation, schema validation, transaction boundaries and log redaction.
- Mobile practice — Review device storage, exported components, permissions and API credentials.
Quick check
Answer from memory — scrolling up first makes it stick less.
What artifact demonstrates this lesson?
Which statement is defensible?
Code example
def can_read_ticket(session, ticket):
return (session["authenticated"]
and session["tenant_id"] == ticket["tenant_id"]
and session["user_id"] == ticket["owner_id"])Line-by-line walkthrough
- 1. Python: both tenant and owner are checked. This simple private-ticket policy must change explicitly if a reviewed role-based sharing requirement is introduced.
Spot the bug
if ticket_exists(id): return ticketNeed a hint?
Show answer
Explain like I'm 5
Fun fact
Hands-on challenge
More resources
- Building effective agents (Anthropic)
- Download the free offline lab (Python, tests and instructions) (Teamz Lab)
Lock it in