Forum Discussion
Philipp_Stadler
Nimbostratus
Feb 17, 2014input validation
Hi all,
I'm wondering that there are no useful search results for input validation of user-input in irules. I want to do a simple task:
when HTTP_REQUEST {
set cookie [HTTP::cookie id]
}
...
Kevin_Stewart
Employee
Feb 18, 2014Here's just one way to do it:
when HTTP_REQUEST {
if { ( [HTTP::cookie exists MYCOOKIE] ) and ( [HTTP::cookie value MYCOOKIE] matches_regex {\d{6}-[0-9A-F]{8}\d{8}} ) } {
log local0. "match"
} else {
log local0. "not match"
}
}
The matches_regex {\d{6}-[0-9A-F]{8}\d{8}} function would validate any value that starts with 6 digits, then a hyphen, then 8 hexadecimal values (0-9A-F), and followed by 6 digits.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects