Forum Discussion
Yozzer
Nimbostratus
Jun 27, 2012Spaces 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
4 Replies
- nitass
Employee
is this applicable?
by the way, do you know starting from 9.4.4 $:: prefix is no longer required to reference class object and it is cmp compatible?
CMP Compatibility
https://devcentral.f5.com/wiki/iRules.cmpcompatibility.ashx[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 - Yozzer
Nimbostratus
Thanks
What needs to be done to also prevent spaces in the I'd name? (I%20d) - nitass
Employee
What 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. - Yozzer
Nimbostratus
Thanks
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
