REGEXVAULTv2.0
Security/Audit & Compliance
Verified Safe

OWASP Top 10 Reference Regex for Go

/^A(?:0[1-9]|10):2021$/i

What this pattern does

This page provides a lightweight, single-purpose regular expression for matching owasp top 10 reference, ported and verified for Go. In security-sensitive code, using an unverified regex can open the door to both false positives and denial-of-service attacks. The snippet below is ready to drop into your Go project — whether you're validating in a Gin handler, a gRPC service, or a command-line tool.

Go Implementation

Go
// OWASP Top 10 Reference
// ReDoS-safe | RegexVault — Security > Audit & Compliance

package validation

import "regexp"

var owaspTop10ReferenceRe = regexp.MustCompile(`^A(?:0[1-9]|10):2021$`)

func ValidateOwaspTop10Reference(s string) bool {
    return owaspTop10ReferenceRe.MatchString(s)
}

// Example
// fmt.Println(ValidateOwaspTop10Reference("A01:2021")) // true

Test Cases

Matches (Valid)
Rejects (Invalid)
A01:2021A00:2021
A03:2021A11:2021
A10:2021A01:2023
A1:2021
A01-2021

When to use this pattern

This pattern is drawn from the Security > Audit & Compliance category and carries a ReDoS-safe certification. That matters for Go developers because Go's RE2 engine is inherently safe from catastrophic backtracking, but this pattern has been additionally verified for correctness. RegexVault audits patterns against known backtracking attack vectors, ensuring you have the necessary context before using this regex in a high-stakes production environment.

Common Pitfalls

OWASP Top 10 editions (2013, 2017, 2021) have different category numbering and content. Specify the year edition when referencing. The 2021 list elevated A04 Insecure Design as a new category.

Technical Notes

OWASP Top 10 2021: A01=Broken Access Control, A02=Cryptographic Failures, A03=Injection, A04=Insecure Design, A05=Security Misconfiguration, A06=Vulnerable/Outdated Components, A07=Identification/Authentication Failures, A08=Software/Data Integrity Failures, A09=Security Logging/Monitoring Failures, A10=Server-Side Request Forgery.

Have a pattern that belongs in the vault?

Submit it for review — community-verified patterns get credited to your GitHub handle. Free submissions join the queue. Priority review available for $15.

Submit a Pattern