Recap Security Guide
Home/Security topics/Application security

Security essentials

Application security

How to build software, interfaces and data handling that resist abuse, from design through testing and review.

3 min read

Key points

  • Treat all input as untrusted until it has been checked.
  • Injection and cross-site flaws come from mixing data with instructions.
  • Dependencies bring risk that must be tracked and updated.
  • Testing and review catch different classes of defect.

Application security is the discipline of building and maintaining software so that it does what it should and nothing more, even when someone is trying to misuse it. It applies to websites, mobile apps, desktop programs and the interfaces between them.

Security across the lifecycle

Fixing a flaw late costs far more than avoiding it early, so security belongs in every stage. Requirements state what must be protected. Design chooses structures that limit damage. Coding follows safe habits. Testing looks for defects. Operations watch the running system and patch it. Treating security as a final inspection tends to find problems too late to fix cleanly.

Input handling

Most application flaws begin with input. Anything that arrives from a user, a file, another system or a network request must be treated as untrusted. Programs should check that data has the expected type, length and format, and should reject anything else. Checking on the server matters most, because controls in a browser can be bypassed.

Common flaw classes

Injection happens when untrusted data is interpreted as an instruction, for instance when text typed into a form is passed into a database query or a system command. The defence is to keep data and instructions separate, using mechanisms that never mix them.

Cross-site problems arise when one site can be made to run script or perform actions in the context of another site that a user trusts. Careful encoding of output and checks that a request really came from the user help prevent them.

Authentication flaws include weak password storage, predictable session identifiers and sessions that never expire. These connect to the topics in identity and access.

Memory and logic errors in lower-level code can let an attacker turn a bug into an exploit. A vulnerability is simply a flaw that can be abused.

Dependencies

Modern software is mostly assembled from libraries written by others. A flaw in a library becomes a flaw in every program that uses it. Teams keep an inventory of what they depend on, remove what is unused and apply updates promptly.

Secure design

Good design reduces risk before any code is written. Build a threat model, give each component only the access it needs, and protect sensitive data with the techniques described under cryptography. Fail safely: when something goes wrong, the program should deny access rather than grant it.

Testing and review

Static analysis reads the code without running it and flags risky patterns. Dynamic testing exercises the running program, much as an attacker would. Fuzzing feeds large amounts of unexpected input to a program to provoke crashes that reveal bugs. Code review by a second person catches design and logic problems that tools miss. Each approach finds different faults, so mature teams use several. Findings feed back into the basics checklist of habits that prevent repeat mistakes.