Forum Discussion
Matt_Breedlove_
Nimbostratus
Feb 06, 2007URI::Decode or not to URI::Decode when filtering
I am writing a basic URL filter to allow a handful of URLS.
Is it more secure to filter on the raw URL or the URI:Decode'd URL?
The biggest concern is security. I don't people to be able to use %/hex codes to bypass the URL filter
Here are the two options I see
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
/webserver/login* {
pool web.acmehosting.com
}
/webserver/logout* {
pool web.acmehosting.com
}
default {
drop
}
}
}
or should I be using
when HTTP_REQUEST {
switch -glob [URI::decode [string tolower [HTTP::uri]]] {
/webserver/login* {
pool web.acmehosting.com
}
/webserver/logout* {
pool web.acmehosting.com
}
default {
drop
}
}
}
- It's always best to decode the URI if you are concerned with users trying to bypass your filter. The overhead is minimal but it allows you to bring the URL into it's base form so there will be no question about it.
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