Protective Programming
-
Authentication and Authorization in One Request
Authentication establishes an account or other principal. Authorization decides which operations that principal can perform on the identified resource.
-
Defaulting to No Permission
A permission policy can require an explicit reason to allow an action. Unrecognized actions and unsupported states then have a predictable default outcome.
-
Checking Permission for the Selected Resource
Permission to perform an action depends on the actual resource and the requester, along with the policy's relevant context.
-
Roles and Ownership in a Permission Rule
Roles can grant broad capabilities. Resource ownership or membership can refine which objects those capabilities apply to.
-
Modeling Public and Private Records
A record's visibility is a property of the application and should guide lists, direct reads, and related navigation under the same policy.
-
Least Privilege for a Background Job
A component can receive the operations and data it needs for a defined task, keeping unrelated capabilities outside its normal role.
-
Public Errors and Internal Diagnostics
A public response should explain the relevant outcome and how to proceed. Internal diagnostics can record technical context appropriate to designated readers.
-
Input Validation and Output Encoding
Validation checks that input fits its allowed domain. Output encoding represents data safely and correctly within a particular output grammar.
-
Sending Only the Data a Component Needs
A narrow interface can pass the fields needed for a feature without copying unrelated personal data or internal state.
-
Designing Privacy-Aware Event Logs
An event log should contain enough information to understand an operation while avoiding unnecessary sensitive values.
-
Secret Values and Ordinary Configuration
A process can receive settings that select behavior and secrets that grant capabilities. These data need different storage and display rules.
-
Separating Development and Production Data
Development and test environments can use isolated configuration and synthetic data so experiments do not alter live state or disclose real records.
-
Password Verification Without Storing Password Text
A password verifier should store an appropriate salted, costed verification value under a maintained implementation and current guidance.
-
Lifetime and Single Use for a Recovery Grant
Account recovery grants should follow a deliberate expiration and consumption policy so the granted action remains limited in scope and time.
-
Keeping Private Content Out of Shared Reuse
Private views may depend on session identity and permissions. Their cache policy must reflect who is allowed to receive the underlying representation.
-
Public Reads and Authenticated State Changes
A public representation can be readable while editing it requires a separate protected operation with its own method and permission rule.
-
Trust Boundaries in a Data Flow
A trust boundary marks where information or authority moves between components with different assumptions about what can be relied on.
-
Reviewing Dependency Changes for a Release
A dependency update can change both direct and transitive components. Review the resolved versions and the interfaces used by the application.
-
A Checksum and the Authority of Its Expected Value
An integrity comparison checks bytes against a known digest. The trustworthiness of that expected digest depends on where it came from.
-
Protecting a Public Operation with Resource Budgets
A public operation can define limits for input size, concurrent work, or execution time to preserve a predictable service.
-
Separating an Error Report from an Audit Event
An operational error helps maintainers understand a failed request. An audit event records a relevant action and outcome according to an accountability policy.
-
Using a Decision Table to Review Permission Rules
A decision table turns a small access policy into explicit cases that reviewers and tests can compare.
-
Explicit Configuration for Shared Service Access
A component should receive a defined service identity and narrow operational role under an explicit environment configuration.
-
Checking a Backup by Restoring a Representative Copy
A backup is useful when its data can be recovered under the intended version and storage conditions. A restore test exercises that promise.
-
Applying a Visibility Rule to Exported Data
An export can expose more fields or records than a page displays if its access policy and field selection are not explicit.
-
Reviewing an Upload Feature for Defensive Behavior
An upload feature can check size, structural compatibility, visibility, and storage outcome across its normal workflow.
-
How Long an Identity Decision Should Be Used
An authentication result establishes a requester within a defined lifetime. A later request can require a current identity or permission decision under policy.
-
Verifying That a Rejected Update Leaves State Intact
A defensive test should inspect relevant persisted state after a request is rejected. A failure response alone cannot establish that no update occurred.
-
Giving Useful Feedback at a Protective Limit
A rejected operation can explain which input must change without including unnecessary implementation or personal details.
-
Reviewing Where a Feature's Data Goes
A feature's data lifecycle covers collection, storage, sharing, and removal. Reviewing it can reveal where access and retention assumptions need documentation.