Threat modeling and least privilege
Quick answer
A threat model identifies what needs protection, who may access it, and how an unwanted action could occur. Least privilege grants only the access necessary for a defined task.
For a read-only report service, a useful policy is access to the report directory but no write access to application code. Test both a permitted read and a denied write using a disposable identity. Document the asset, trust boundary and expected denial.
Prepare the practice environment
Run python3 lab-fixtures/security/setup.py from the extracted root as an ordinary user. Enter the printed fresh private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. Run each snippet in a separate Bash process, not your interactive shell. Only private files are used; optional examples require an authorized snapshot VM. Do not modify system services or security policy. Review the lab guide.
Prerequisites
Review: Deployment and rollback, PAM and NSS foundations, Permission troubleshooting.
How it works
Begin with a fictional reporting service: its assets are report data and configuration, its authorized users are operators, and its trust boundary separates the public web proxy from the private backend. Identify threats such as unintended data exposure, accidental changes and service interruption; rank them by impact and likelihood in context. A dedicated non-root service account limits ordinary discretionary access, but does not itself enforce network or mandatory access policies. Bind a backend to loopback when only a local proxy needs it; other local processes can still connect unless another control restricts them. Protect configuration from unintended writes, test the required operation, then test a denied operation. The supplied inventory is synthetic, not a scan of your computer.
Try the examples
The fictional backend is configured for a dedicated account and local listener. This record does not establish actual runtime state.
Expected stdout:
user=bm-reportlisten=127.0.0.1:8080asset=report-dataRun as an ordinary account; UID zero would fail this check. Non-root is necessary for this lab, not a complete security guarantee.
Expected stdout:
non-rootOnly ordinary owner read/write bits are set. ACLs, privileged access and other policy layers are separate.
Expected stdout:
600Common mistakes
Do not assume a private port or a non-root identity makes an application secure. Verify required access and document remaining risks.
Practice
Identify the report asset, proxy boundary, operator role, one unnecessary permission and one verification check. Explain why the inventory is not runtime evidence.
Related references
Study: id, ss. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Threat modeling and least privilege — Knowledge Check
Apply defensive security concepts to synthetic fixtures and VM-only scenarios.
What should a threat model start with?
What does least privilege mean?
Who can potentially reach a loopback listener?
Does an inventory prove a service is running securely?