.swf
IIS 7 または .Net を使用して、たとえばファイルでクエリ文字列パラメーターを許可しない一般的な方法はありますか?
特定のクエリ文字列パラメーターを使用して呼び出すことで XSS を許可するサードパーティの swf ファイルを使用するアプリケーションがあります。したがって、一般的な方法でパラメーターを無効にしたいと考えています。
私の頭に浮かぶ唯一のことは、ファイル呼び出しをパラメーターなしの呼び出しに再ルーティングするハンドラーを作成することです。
は必要ありません。一致Handler
する新しい IIS ルールだけが必要であり、 (明示的に を追加せずに)として書き換えます。Rewrite
yourfile.swf?*
yourfile.swf
querystring
次のようなもの(チェックしませんでした):
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="strip_querystring" patternSyntax="Wildcard" stopProcessing="true">
<match url="yourfile.swf*" />
<action type="Rewrite" url="yourfile.swf" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
Global.asax BeginRequest イベントでこれを試してください
Private Sub Global_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.BeginRequest
Dim httpContext As HttpContext = httpContext.Current
Dim request As HttpRequest = httpContext.Request
Dim response As HttpResponse = httpContext.Response
If request.QueryString.Count > 0 AndAlso request.Url.LocalPath.EndsWith(".swf", StringComparison.InvariantCultureIgnoreCase) = True Then
response.Redirect(request.Url.LocalPath)
End If
End Sub