(注:このブログはもう更新していません)この日記は私的なものであり所属会社の見解とは無関係です。 GitHub: takahashikzn

[クラウド帳票エンジンDocurain]

struts-2.3.15.2リリース。しかしエンバグした模様

Struts-2.3.15.2がリリースされています。
しかし残念なことに、深刻なエンバグが入ってしまったようです。

https://issues.apache.org/jira/browse/WW-4204


僕もこれにぶち当たりました。

Struts-2.3.15.2でFIXされた内容

Struts2には、特定のパラメータをリクエストに含めることで、POST先のURLとは関係なく遷移先アクションを指定できる機能が存在します。
しかしこの機能はかつて深刻な脆弱性を生み出した(参考: https://cwiki.apache.org/confluence/display/WW/S2-016)ことから、大きく改修が入ったようです。
詳しくはこちら。
https://struts.apache.org/release/2.3.x/docs/s2-018.html


意訳は次の通り。

Problem


The Struts 2 action mapping mechanism supports the special parameter prefix action: which is intended to help with attaching navigational information to buttons within forms.
In Struts 2 before 2.3.15.2, under certain conditions this can be used to bypass security constraints. More details will available later on when the patch will be widely adopted.


Struts2のアクションマッピングにおいて、"action:"接頭辞から始まる特別なパラメータを使うことによって、行ったり来たりするような画面遷移をフォーム内のボタンで実現することができます。
ただしStruts-2.3.15.2よりも前では、とある条件下においてセキュリティチェックが無効化されてしまうことが判明しました。

Solution


In Struts 2.3.15.2 the action mapping mechanism was changed to avoid circumventing security constraints.
Another option is to write your own ActionMapper and completely drop support for "action:" prefix if support for multiple submit buttons isn't used. Consult manual how to write your own ActionMapper.



Struts-2.3.15.2では、上記のセキュリティチェック無効化ができないように、アクションマッピングの仕組みを変更しました。
単一フォーム内で複数のサブミットボタンを使うことがないならば、自分でActionMapperクラスを書いて"action:"接頭辞から始まる特別なパラメータを完全に無視することが出来ます。
やり方はマニュアルを参照して下さい。

Struts-2.3.15.2でエンバグした内容

https://issues.apache.org/jira/browse/WW-4204
の内容は以下の通りです。

Struts 2.3.15.2 brings 404 error on press submit named 'action:some-action-name'.
S2-018 says 'After upgrading to Struts >= 2.3.15.2, applications using the "action:" should still work as expected.', but it seems not to be working.
You can see it in example application 'Struts2 Showcase - Validation - Store Errors Across Request Example' > Cancel.



Struts-2.3.15.2で、"action:some-action-name"のようなパラメータを送っても404エラーになってしまう。
S2-018によると、2.3.15.2へアップグレードしても、"action:"パラメータは依然としてサポートされるはずである。しかし実際は動作しないようだ。
例えば、Struts2 Showcase - Validation - Store Errors Across Request Example' からCancelボタンを押すとこうなる。


このようにエンバグしてしまっているものの、既にトランクでの修正は済んでいるようなので、Struts-2.3.15.3(または2.3.16)が近日中にリリースされると思います。
皆様に於かれましては、一旦Struts-2.3.15.2へのアップグレードは見送り、次のリリースを待ったほうが良いと思われます。
それか、"action:"パラメータを使うのをやめるか。