Skip to main content
miji.be

Input Validation

The process of verifying whether input data from users matches the expected format and range. One of the security measures.

Oct 31, 2026 / About 1 min read

Security

Input validation is the process of verifying whether input data from users matches the expected format and range. OWASP states that SQL injection and XSS require parameterized queries and contextual output encoding in addition to input validation.

Input validation methods include the whitelist approach (defining the patterns to allow and rejecting everything else) and the blacklist approach (defining the patterns to prohibit and allowing everything else). OWASP asks that applications define the values they accept and reject everything else, rather than trying to identify every malicious string.

In URL shorteners, the URLs that users enter are also subject to validation. Items to check include, for example, the URL format (compliance with RFC 3986), that the protocol is http:// or https:// (excluding the javascript: scheme), that the domain is not on a blacklist (excluding phishing sites), and that the URL length is within the limit. OWASP's guide to XSS prevention gives allowing only http and https URLs as an example of a countermeasure for untrusted URLs placed in href or src attributes.

OWASP's guide to input validation recommends validating on the server side even when the same items are checked in the browser, and using client-side validation, which can be bypassed, for immediate feedback.

Was this article helpful?

Related Terms

XSS

Short for Cross-Site Scripting. An attack technique that injects malicious scripts into web pages to steal users' information.

SQL Injection

An attack that inserts malicious SQL code into application queries through user input fields to manipulate the database.

CSP

Content Security Policy - an HTTP header that controls which resources a browser is allowed to load for a given page.

API Rate Limit

A restriction on the number of API requests a client can make within a specified time period.

QR Code Security

Measures to protect users from malicious QR codes that may lead to phishing sites or malware downloads.

SSL/TLS

Cryptographic protocols that provide secure communication over the internet by encrypting data between client and server.

Related Articles

Short URL Security - Phishing Risks, Safe Sharing Practices, and Protection Guide

A comprehensive guide to short URL security. Understand phishing risks, malware distribution via shortened links, and best practices for safe sharing.

URL Shortener API Guide - Generating Short URLs Programmatically

A practical guide to using URL shortener APIs. Learn about request formats, response structures, authentication, and implementation patterns.

Click Fraud Prevention: Protect Short URLs from Bots

Understand click fraud tactics and learn how to defend your short URLs. Covers bot detection, rate limiting, CAPTCHA strategies, and anomaly detection.

FAQ

Should input validation be done on the client side or the server side?
It is done on both. OWASP recommends validating on the server side even the items checked in the browser, and treats client-side validation, which can be bypassed, as something to use for immediate feedback.
What attacks can input validation prevent?
According to OWASP, input validation reduces the risks of malformed data, invalid business operations, and excessive resource consumption. SQL injection and XSS require parameterized queries and output encoding in addition to input validation.

Put the terms to work

Shorten a URL for Free