Read a sample: 1. Authorization as a Testable Boundary
A user signs in to a project-tracking application and opens a project they created. The page loads, the project title appears, and an edit button allows the user to change its description. Nothing about that sequence is surprising: the user has identified themselves and is working with a record they own.
Now consider a different question. If the same user asks the application for a project owned by someone else, what should happen?
That question is the beginning of an authorization test. It is not enough to know that the user has a valid account or that the application has a sign-in page. The relevant issue is whether this particular user may perform this particular action on this particular record under the conditions that currently apply.
Authorization testing makes those conditions explicit and compares them with observable behavior. It turns statements such as “users can edit their own projects” into controlled questions that can be answered with evidence.
Throughout this course, you will practice that process in a fictional application called Workroom. The examples use test accounts and synthetic records rather than real users’ information. Workroom gives us a consistent setting for learning how to define boundaries, prepare comparisons, interpret results, and report findings without confusing an unexpected response with a proven security issue.
This first chapter establishes the concepts and introduces a diagnostic exercise. You do not need to send any requests yet. The immediate goal is to learn what a useful authorization question looks like.
Authentication and authorization are related, but they answer different questions.
Authentication establishes the identity associated with a session or request. In ordinary language, it asks, “Who are you?” A user might authenticate with a password, a security key, or another mechanism supported by the application.
Authorization determines what that identity is permitted to do. It asks questions such as:
- May this user view this project?
- May this user change the project’s description?
- May this user invite another person to the project?
- May this user use an administrative function?
A successful sign-in does not answer those questions. It gives the application an identity to consider when making access decisions. The application must still decide which records and functions that identity can use.
The distinction matters because an authorization failure can occur even when authentication works exactly as intended. Two users may both sign in successfully, but one may be able to view or modify the other’s private record when the rules say otherwise. Conversely, an application may correctly prevent access to a record even though the user knows its address or identifier.
Authorization can also apply without a signed-in user. A public help page, for example, may be intended to be visible to anyone. The relevant rule still describes who may perform an action: in that case, an unauthenticated visitor may view the page. In this course, most examples focus on authenticated accounts because comparing their permissions makes ownership and role boundaries easier to see.
A practical way to describe an access decision is to identify three elements:
- Subject: the user or other identity requesting access.
- Object: the record or resource involved, such as a project.
- Action: what the subject wants to do, such as view, edit, or delete.
A fourth element, context, often determines the outcome. Context can include a user’s role, ownership of the record, a sharing relationship, the current state of a record, or the organization to which a user belongs.
For example:
> Maya may edit a project when she owns it.
Here, Maya is the subject, the project is the object, editing is the action, and ownership is the relevant condition. If the project belongs to someone else, the subject and action have not changed, but the context has. The expected decision may therefore change.
This way of thinking prevents an overly broad conclusion such as “Maya can edit projects.” Perhaps she can edit only her own projects. Perhaps she can edit shared projects but cannot delete them. Perhaps she can edit a project until it is archived. Each condition represents a boundary worth understanding before it is tested.
Some functions do not appear to act on a single business record. An administrative page for changing account roles is still an authorization target: the subject requests a function, and the application must decide whether that subject may use it. The exact object may be the account being changed, the administrative capability itself, or both. What matters is that the test identifies the resource or function and the action clearly enough to state an expected outcome.
Workroom is a fictional web application used by a small team to keep track of projects. For the exercises in this chapter, assume the following business rules have been confirmed by the application owner:
1. An ordinary member may create projects.
2. An ordinary member may view and edit projects they own.
3. An ordinary member may not view or edit another member’s private projects.
4. A project owner may share a project with another member as a viewer.
5. A viewer may view the shared project but may not edit it or change its sharing settings.
6. An administrator may view and edit all projects and may manage members’ roles.
7. Ordinary members may not manage members’ roles.
These rules are deliberately compact. Real applications can have more roles, exceptions, and state-dependent permissions. The method remains…