欠落しているセキュリティー・ロールの定義に Java EE デプロイメント記述子を使用する

この規則により、WEB-INF/web.xml ファイル内に見つかり、対応する security-role エレメントが欠落している auth-constraint エレメントおよび role-name エレメントにフラグを立てます。 Apache Tomcat サーバーでは security-role エレメントを定義する必要はありませんが、Java EE 仕様ではこれを定義しなければならないようになっています。

以下は、フラグが立てられる auth-constraint エレメントおよび role-name エレメントの例です。
<web-app>
...
<security-constraint>
<display-name>ThisConstraint</display-name>
<web-resource-collection>
<web-resource-name>adminResources</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<description>The admins</description>
<role-name>admin</role-name>
<role-name>superuser</role-name>
</auth-constraint>
</security-constraint>
</web-app>

<role-name>admin</role-name><role-name>superuser</role-name> の両方の行にフラグが立てられます。

ソース・スキャナーには、欠落している security-role エレメントを追加するクイック・フィックスが含まれています。

この例では、クイック・フィックスが以下のエレメントを web.xml ファイルに追加します。
<security-role>
<role-name>admin</role-name>
</security-role>
<security-role>
<role-name>superuser</role-name>
</security-role>