OWASP / OWASP/ASVS

Clarification: 1.2.9 "typically using a backslash"

Open
#3,229 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1) Discussion ongoing 3) awaiting proposal V1 (prev V5)
Dominant language
HTML
Stars
3.6k
Forks
831
Avg merge
7h 55m
Merged PRs (30d)
4

Description

1.2.9 Verify that the application escapes special characters in regular expressions (typically using a backslash) to prevent them from being misinterpreted as metacharacters.

  • The phrase “typically using a backslash” is oversimplified. While backslash escaping is common in some regex engines, it’s not universal,different regex engines (like PCRE, Java, Python JavaScript) handle metacharacters differently. Manually escaping with backslashes is risky, error-prone, and can lead to vulnerabilities.
  • Instead of saying “typically using a backslash”, it’s better to recommend built-in, language-safe escaping functions like re.escape, Regex.Escape, etc., because they handle escaping correctly for that specific language and engine.
  • Escaping should not be the default solution in every case. In some situations, strict allowlist validation and input size limits are better than trying to escape everything into a regex.
  • The requirement misses an important point,dynamic regex construction should be avoided unless it’s absolutely necessary.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the raw Markdown source for ASVS 5.0 requirement 1.2.9, linked from the issue, rather than the derived formats. Compare the current wording with the concerns about language-specific escaping, allowlists, input limits, and dynamic regex construction; done means the requirement accurately reflects the agreed security guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript, python
Domain
documentation, security
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.