Skip to content

Add a guide on input validation#44287

Merged
wbamberg merged 13 commits into
mdn:mainfrom
wbamberg:input-validation-guide
Jun 19, 2026
Merged

Add a guide on input validation#44287
wbamberg merged 13 commits into
mdn:mainfrom
wbamberg:input-validation-guide

Conversation

@wbamberg

@wbamberg wbamberg commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Adds a new guide page on input validation.

@github-actions github-actions Bot added Content:Security Security docs size/m [PR only] 51-500 LoC changed labels May 28, 2026
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated
@github-actions

github-actions Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Preview URLs (2 pages)

External URLs (9)

URL: /en-US/docs/Web/Security/Defenses/Input_validation
Title: Input validation

(comment last updated: 2026-06-19 03:19:47)

wbamberg and others added 3 commits May 28, 2026 14:50
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ut-validation-guide

* origin/input-validation-guide:
  Update files/en-us/web/security/defenses/input_validation/index.md
@wbamberg wbamberg marked this pull request as ready for review May 29, 2026 02:47
@wbamberg wbamberg requested a review from a team as a code owner May 29, 2026 02:47
@wbamberg wbamberg requested review from hamishwillee and removed request for a team May 29, 2026 02:47
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated
Comment on lines +12 to +14
Users typically provide input using {{htmlelement("input")}} elements in a {{htmlelement("form")}} element on the site's front end, and the input is typically sent to the server as the body of a {{httpmethod("POST")}} request, or as URL parameters appended to a {{httpmethod("GET")}} request. However, input might also arrive on the server via other means, such as cookie values or additional HTTP headers.

If the input provided by the user doesn't have the form or content that the server expects — for example, if they enter an invalid email address — this can cause the site to malfunction. Catching problems like this as early as possible improves the user's experience.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels quite server centric. But I do think it is important to highlight both cases of what is effectively catching user error vs malicious usage.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"server"->"site" change is made in 8290e28, which I agree is better, but otherwise I'm not sure what this comment is asking for.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I was saying is that this is about server validation, but there is also validation on the client. Most of that client side validation is really about catching mistakes in user input, while the server testing exists primarily to catch malicious use.

Anyway, it's a bit of a ramble - wasn't really asking for anything except perhaps thinking "this is all about validation, but the client side stuff isn't being mentioned at all". Might be a very reasonable approach.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we do talk about client-side validation, a lot, notably in "when to validate" and the whole section on client-side validation. This preamble doesn't really talk about validation at all, on client or server, it's mostly concerned with where input comes from, how to gets into the server, and how bad input can cause problems.

Comment thread files/en-us/web/security/defenses/input_validation/index.md
wbamberg and others added 4 commits June 9, 2026 09:35
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
@hamishwillee hamishwillee force-pushed the input-validation-guide branch from 14c09c1 to 8202d32 Compare June 8, 2026 23:35
@wbamberg wbamberg mentioned this pull request Jun 8, 2026
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated
Comment thread files/en-us/web/security/defenses/input_validation/index.md Outdated

@hamishwillee hamishwillee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wbamberg It's good structurally and clear. You may find my current suggestions helpful, but I wouldn't block on them - so this is approved but not merged.

wbamberg and others added 2 commits June 18, 2026 20:16
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
@wbamberg wbamberg merged commit f14623f into mdn:main Jun 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:Security Security docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants