Repository Threat Model: Protect Assets and Trust Boundaries
Start with what matters
A threat model is a structured way to decide what must be protected, who can affect it, and which controls reduce the risk. In our fictional garden project, source history, release bytes, credentials and CI infrastructure are separate assets. A contributor may read code and propose changes without needing production access.
Draw the boundaries
Think of the flow as contributor → pull request → review and CI → protected main → release → deployment. Every arrow crosses a decision point. A pull request title, file, test output or artifact is input, not proof of trust. Authentication identifies an actor; authorization grants a particular operation.
Choose minimal permissions
This is a fictional permission map, not GitHub role definitions. A contributor proposes changes; a reviewer reads and reviews; a release service publishes only after verified review. Deny unknown actors and unlisted operations. Separate production access from repository administration, and review service identities as well as people.
{ "contributor": [ "read", "propose" ], "reviewer": [ "read", "review" ], "release-service": [ "publish" ]}Reason about a failure
If a release identity can edit branch rules, an error or compromise can weaken review before publication. Remove that unnecessary permission, require independently verified checks, and keep an audit trail. A control reduces risk but does not eliminate it: reviewers can miss defects and trusted dependencies can become compromised.
Practice and verify
Run chapter33.py from the package root. The offline policy fixture checks allowed and denied actions and an unknown role. Draw a separate boundary for the build runner and list one failure and one mitigation for each asset. Check that no contributor can publish in your proposed policy. The model does not authorize real GitHub requests.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Repository Threat Model: Protect Assets and Trust Boundaries — knowledge check
Reason about repository trust, security controls and incident response.
What is an asset in a repository threat model?
Which fictional role needs publish permission?
What is a trust boundary?
What does authentication establish?
What should happen to unlisted actions in this model?