Forum Discussion
Yozzer
Jun 27, 2012Nimbostratus
Spaces in the machine
Hi
I have the following command that searches for "id" in the url and then performs an action if the id value is contained in the data group list:
if {[matchclass [string tolower [URI::query [HTTP::uri] id]] contains $::Portlet_ref]} {
However if i add a space (%20) before, in the middle or after the id value (%20id, i%20d and id%20) then it can be bypassed. This also happens if i add a space in the value (%20hello, He%20llo and hello%20)
How can i trim spaces from both the id parameter name and its value so that it wont be bypassed?
Thanks
- nitassEmployeeis this applicable?
[root@ve1024:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve1024:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { log local0. "[HTTP::uri]" log local0. "[string map {%20 ""} [HTTP::uri]]" log local0. "[string tolower [URI::query [string map {%20 ""} [HTTP::uri]] id]]" if {[matchclass [string tolower [URI::query [string map {%20 ""} [HTTP::uri]] id]] contains $::Portlet_ref]} { log local0. "gotcha" } else { log local0. "not match" } } } [root@ve1024:Active] config b class Portlet_ref list class Portlet_ref { "hello" } /var/log/ltm Jun 26 22:58:29 local/tmm info tmm[4861]: Rule myrule : /test?id=%20he%20llo%20&temp=1234 Jun 26 22:58:29 local/tmm info tmm[4861]: Rule myrule : /test?id=hello&temp=1234 Jun 26 22:58:29 local/tmm info tmm[4861]: Rule myrule : hello Jun 26 22:58:29 local/tmm info tmm[4861]: Rule myrule : gotcha
- YozzerNimbostratusThanks
- nitassEmployeeWhat needs to be done to also prevent spaces in the I'd name? (I%20d)it already does since we use string map against HTTP::uri, all space (%20) will be removed.
- YozzerNimbostratusThanks
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