2015-06-19 25 views
0

我有一個安全漏洞可以通過阻止我的請求中的關鍵字來解決。如果get或post請求中包含關鍵字「ENTITY」,我希望通過url重寫來阻止請求併發送403.如何阻止如果請求中包含單詞get url或post body使用urlrewrite for tomcat

有人可以幫我在urlrewrite.xml中編寫規則嗎? 這是我試過哪些不起作用的東西。

<rule> 
    <note> 
    Restrict keyword ENTITY in get or post request. 
    </note> 
    <name>Restrict URI Access</name> 
    <condition type="request-uri" operator="equal">ENTITY</condition> 
    <from>(/.*)</from> 
    <set type="status">403</set> 
    <to last="true">null</to> 
</rule> 

感謝 ...瑪納斯

回答

0

下面的規則應該做的伎倆。 此處filter是可能包含關鍵字「ENTITY」的請求參數。

PS:因爲它是一個URL,所以可以有許多大寫和小寫的組合,可以寫入參數「filter」。 (例如FILTER,過濾器,過濾器等)

<rule> 
    <note> 
     Stop ENTITY keyword 
    </note> 
    <name>StopENTITYKEYWORD</name> 
    <condition type="parameter" name="filter" next="or">ENTITY</condition> 
    <from>(/.*)</from> 
    <set type="status">403</set> 
    <to last="true">null</to> 
</rule> 
相關問題