CYBER LIBRARY
Explore the bootcamp
Adversarial thinkingIntermediate

Input validation

Input validation checks that incoming values satisfy the application's expected structure and meaning.

3 min readUpdated 12 Oct 202619 connections
Markdown

What it means

Input validation checks that incoming values satisfy the application's expected structure and meaning. A valid date may still be inappropriate for a booking that cannot occur in the past. Validate on trusted systems before downstream processing, including data received from partners and internal services.

A practical example

A registration service checks the length and format of a display name, then separately verifies that a selected membership plan is available. The browser provides helpful feedback, but the server repeats the checks because callers can bypass the interface.

What to check

List accepted types, ranges, lengths, encodings, and relationships between fields. Reject unexpected properties where appropriate and test boundary values, malformed input, and business-invalid combinations.

A common pitfall

Filtering a few dangerous characters does not establish validity. Validation also does not replace parameterized queries or context-specific output encoding.

Think it through

A discount percentage is numeric but exceeds the allowed maximum. Should a type check accept it?

Answer: No. Semantic validation must enforce the permitted business range before any price is calculated.

Validate a value in its business setting

Suppose a fictional training centre accepts a room booking. A room number, starting time, duration, and attendee count each have a type. Their relationships matter too: the room must exist, its capacity must cover the group, and the requested period must fit an available slot. Individually well-formed fields can still describe an impossible or unauthorized booking.

Represent these requirements explicitly. Maximum string lengths and collection sizes prevent unexpected resource consumption. An enumerated booking status prevents arbitrary internal states. Cross-field checks stop an end time preceding the start time. Authorization decides whether the caller can reserve that room at all. Combining those concerns into a single vague 'clean input' function makes failures harder to explain.

Canonicalization also affects the decision. If different components interpret an encoded value differently, a validator may approve one meaning while a later component processes another. Prefer one documented parsing path and validate the resulting representation. Repeated decoding or ad hoc transformations across services can create disagreement rather than additional safety.

Design useful failure cases

For the room-booking example, write a short table of acceptable and unacceptable requests: a normal booking, too many attendees, an unknown property, a missing duration, and a conflicting time. Include boundary values exactly at the permitted limit. Decide how the API communicates failure without exposing internal implementation details.

A good validation error tells a legitimate caller how to correct a request. It should not include credentials, a full database statement, or a stack trace. Recheck rules whenever the business process changes; a new booking category may need different capacity or approval requirements. Validation describes accepted data, while safe database calls and safe rendering still protect the interpreters that later consume it.

GO TO THE SOURCE

References & further reading

Original explanations, with primary references for deeper study.

OWASP: Input Validation
EXPLORE THIS IDEA’S CONNECTIONS

A small part of a bigger picture.

20 notes · 30 connections
100%
Input validation · depth 1
Drag to pan · Pinch or use +/− to zoom · Click to preview · Double-click to read
Browse notes as a list (20)
FOLLOW ANOTHER THREADExplore the rest of the library
Start with a concept. Follow its connections.
Detection & responseAbuse Elevation Control MechanismElevation-control abuse bypasses or misuses mechanisms governing privileged execution.Making change happenAcceptance criteriaDefine observable conditions for a deliverable to be accepted.Security essentialsAccess controlUnderstand subjects, resources, permissions, and enforcement through a shared-drive example, including how access changes over time.Detection & responseAccess Token ManipulationAccess token manipulation changes or adopts operating-system security contexts.Risk & resilienceAccount Access RemovalAccount access removal disrupts legitimate users by changing, deleting, or restricting their identities.Evidence & investigationAccount DiscoveryAccount discovery enumerates identities available in a system or environment.Detection & responseAccount ManipulationAccount manipulation changes identity settings to preserve or expand access.Adversarial thinkingAcquire InfrastructureInfrastructure acquisition obtains domains, servers, or other resources used to support operations.Adversarial thinkingActive ScanningActive scanning probes target infrastructure to learn reachable services or weaknesses.Security essentialsAdversary in the middleAn intermediary may observe or alter a communication path.Security essentialsAESA symmetric block cipher whose safe use depends on its mode and implementation.Making change happenAgile deliveryUse short feedback cycles to adapt toward a useful outcome.