Documenting application security architecture and coding assumptions
Secure coding requires deliberate trust boundaries, defensive behaviour and safe handling of shared state. Understanding application security architecture and coding assumptions helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Security architecture describes assets, identities, trust boundaries and the controls expected between components. Documentation is useful when it reflects real deployment and helps reviewers test important assumptions, rather than simply listing products or broad intentions.
Many requirements for establishing a secure and defensible architecture depend on clear documentation of decisions made regarding the implementation of specific security controls and the components used within the application.
A component with "dangerous functionality" may be an internally developed or third-party component that performs operations such as deserialisation of untrusted data, raw file or binary data parsing, dynamic code execution, or direct memory manipulation. Vulnerabilities in these types of operations pose a high risk of compromising the application and potentially exposing its underlying infrastructure.
Why it matters
Consider a realistic failure: two individually valid code paths combine to violate an important application permission or transaction assumption.
An undocumented trust assumption can leave a feature depending on a check that no component actually performs. Gaps may span applications, services and operational processes, making ownership and verification especially important.
A code audit connects a stated requirement to the implementation responsible for enforcing it. Source review and targeted behavioural checks should explain the same boundary and any relevant exceptions.
How penetration testers check for it
Review the specific control expectations below against the code, deployment and observable application behaviour.
- Confirm that application documentation defines risk based remediation time frames for 3rd party component versions with vulnerabilities and for updating libraries in general, to minimise the risk from these components.
- Confirm that an inventory catalog, such as software bill of materials (SBOM), is maintained of all third-party libraries in use, including verifying that components come from pre-defined, trusted, and continually maintained repositories.
- Confirm that the application documentation identifies functionality which is time-consuming or resource-demanding. This must include how to prevent a loss of availability due to overusing this functionality and how to avoid a situation where building a response takes longer than the consumer's timeout. Potential defenses may include asynchronous processing, using queues, and limiting parallel processes per user and per application.
- Confirm that application documentation highlights third-party libraries which are considered to be "risky components".
- Confirm that application documentation highlights parts of the application where "dangerous functionality" is being used.
- Compare documented trust relationships with deployment and code.
- Record assumptions, exceptions and evidence of enforcement.
How to fix it
Implement the required boundary in the component that actually performs the sensitive operation and retain focused regression coverage.
- Make security requirements concrete and assign owners.
- Keep diagrams and inventories aligned with releases.
- Reduce unnecessary trust and privilege between components.
- Verify important requirements through focused review and testing.
A diagram or checklist is planning evidence, not proof that a control works. Assurance comes from connecting the stated requirement to implementation and observed behaviour.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- Documenting browser security assumptions and frontend boundaries
- Documenting security assumptions in application business rules
- Documenting security architecture for distributed applications
Read about our methodology or contact pentested.com to discuss the security of your application code.