Skip to content
Slim PrepLearning
Log inCreate account
Course chapters
  1. 01Map what your coding agent can touch
  2. 02Protect credentials in source, builds and logs
  3. 03Secure registration, sign-in and recovery
  4. 04Enforce permissions for each workspace
  5. 05Protect data from collection to recovery
  6. 06Validate input and keep data out of commands
  7. 07Protect browser content, sessions and private data
  8. 08Review dependencies and agent tools
  9. 09Restrict file uploads and URL previews
  10. 10Grant paid access from verified payments
  11. 11Limit AI access, actions and spend
  12. 12Limit deployment access and respond to alerts
  13. 13Test security controls before release
  14. 14Contain incidents and verify recovery

CHAPTER 01

Map what your coding agent can touch

Map assets and trust boundaries, write abuse stories and limit the coding agent’s task.

35 min readVersion security-2026-11-16-web-4Draft · editorial review pending
This is a public chapter preview. Register and enroll to save your progress and take assessments.
  • Run a small app locally.

  • Read basic JavaScript or TypeScript.

  • Follow an HTTP request.

  • Use environment variables.

  • Save or review changes with Git.

  • Next.js App Router.

  • React.

  • TypeScript.

  • PostgreSQL through node-postgres.

  • The Stripe Node SDK.

  • GitHub Actions.

  • PocketDesk is fictional. Its people, records, prices and incidents are fictional too.

  • These selected educational patterns are not a complete PocketDesk starter app or a complete security implementation.

  • Labs use only your own local or isolated app with synthetic data. No third-party testing is authorised.

  • Labs are self-checked, not automatically inspected. They are not a penetration test or a certification that your app is secure. Passing the course shows assessed learning. It does not provide independent assurance of PocketDesk or promise that incidents can no longer happen.

By the end of this chapter, you should be able to:

  • Identify assets and realistic misuse in a small SaaS.
  • Trace trust boundaries across the complete feature.
  • Constrain coding-agent tools, data, and authority.
  • Prioritise controls using a concrete failure story.

List assets and what could happen to them

A private note is an asset because disclosure can harm the client. A session token can let someone act as an account. Billing state controls paid access. Source code, deployment permissions, signing secrets and backups also matter. For each asset, explain what harm its loss or misuse could cause. A list of database tables is not enough.

Include these actors and their capabilities:

  • An unauthenticated visitor.

  • A legitimate workspace member.

  • A revoked member who still has an old link.

  • A compromised dependency.

  • An imported document containing hostile instructions.

Do not assume every attacker starts with administrator access. Include accidental harm too: a generated migration deletes notes, or a debugging response includes private records.

Map the request and who controls each step

PocketDesk request and access map

1
Browser

Untrusted request fields and the user’s session.

2
Application server

Checks the request before granting access.

3
Private storage

Tenant-scoped notes, files, and operational records.

4
External services

Stripe, email, and optional AI processing.

5
Build and deploy

Coding agent, dependencies, CI runner, and limited credentials.

Every arrow is a question about data, authority, and failure. A polished screen does not establish the checks behind it.

The application server checks:

  • Identity.

  • Workspace membership.

  • The requested action.

  • Input.

  • Paid entitlement.

A trust boundary is a point where control or authority changes. The browser can propose a note ID. It cannot declare itself the note’s owner. Stripe can supply a signed payment event. The app must still map it to the correct internal account and product. A coding agent can suggest code. Tool permissions determine whether it can run a destructive command.

Restrict the coding agent’s tools and access

Give the agent a narrow task, a disposable branch, synthetic fixtures and only the tools it needs. Keep live customer exports, production secrets, cloud administrator credentials and unrestricted database access outside its workspace. The execution environment must enforce network and filesystem permissions. A prompt saying “do not read secrets” does not withhold access to them.

Tempting instructionSafer task scope

Fix everything and deploy when it looks good.

Implement one note-read path; show the diff and local test results.

Use this production database to reproduce the bug.

Use two synthetic workspaces in a disposable database.

Run any installation script needed to make tests pass.

Explain each new dependency and inspect commands before execution.

Ignore failing checks so the demo works.

Keep the failed check visible and explain the underlying assumption.

Review what the patch changes. Look for:

  • New external calls.

  • Permission checks removed for convenience.

  • Broadly scoped credentials.

  • Disabled tests.

  • Changed package scripts.

  • Data returned to the client.

A passing build shows that the build succeeded under its test conditions. It does not show that Cy cannot read Ada’s notes.

Turn an access failure into a test

Write: “Cy can change a note ID and retrieve a note in workspace A because the read endpoint checks sign-in but not membership.” Add a server-side authorisation check for the note’s workspace. Test it with two owned synthetic accounts. Confirm that the wrong-workspace request returns no private note. This gives you a specific control and test, rather than a task called “add enterprise security.”

Prioritise by consequence, reachability, exposure and the test results or records you have. A public cross-workspace read needs attention before a cosmetic warning. Record unknowns and restrict release where needed. Review the threat model when a new connector, role, payment action or AI tool changes what the feature can do.

Optional isolated practice

OPTIONAL PRACTICE

Draw the PocketDesk threat map

Optional solo lab: Sketch the note-read and AI-summary flows. Add one attacker story and one accidental-agent failure, then identify where each must be stopped. Use only an application you own on localhost or an explicitly isolated test environment, synthetic accounts, and disposable data. A written walkthrough is sufficient if you have no running app. Keep your practice notes locally.

  • Asset and boundary map.

  • Two failure stories with controls and observable tests.

Self-checkResults in your notes

Assets

Explain consequences for notes, sessions, billing, secrets, and backups.

Boundaries

Mark browser, application, storage, external services, and agent tooling.

Who decides

Separate proposed input from server-derived permission.

Test

State a failing condition and the evidence that would show it is blocked.

Chapter assessment

Take the chapter assessment on assets, trust boundaries, agent access and threat-model tests.

Sources and further reading

  1. OWASP: Threat Modeling

    Model the system, threats, mitigations, and whether the mitigations work. Checked 16 November 2026.

  2. OWASP Application Security Verification Standard

    Security requirements framework; official site currently offers ASVS 5.0.0. Select and version relevant requirements; this course is not an ASVS assessment or certification. Checked 16 November 2026.

  3. Docker: Compose uses

    Optional disposable local services; not a required course dependency. Checked 16 November 2026.

  4. Mailpit: Test email capture

    Optional local SMTP capture and inbox for synthetic email tests. Checked 16 November 2026.

  5. Stripe: CLI

    Optional Stripe test tooling; use its current installation and webhook-forwarding instructions. Checked 16 November 2026.

Original Slim Prep teaching.

YOUR NEXT CHECKPOINT

Ready to check your understanding?

Mark your reading complete, then take the chapter assessment. Reading progress is separate from your assessment result. Save the related course project checkpoint as you work through each chapter.

View course enrollment