Skip to content

SEC-2189: <sec:authorize url=""> could use wrong WebInvocationPrivilegeEvaluator #2416

@spring-projects-issues

Description

@spring-projects-issues

q (Migrated from SEC-2189) said:

When using <sec:authorize url=""> it is possible situation when wrong WebInvocationPrivilegeEvaluator is used for access evaluation

It occurs when in security xml descriptor there're different contexts
and in the jsp in second context we use <sec:authorize url=""> to access url from second context.

for example:

in security.xml:

<http pattern="/qwe/" ...>
   ...
</http>
<http pattern="/admin/" ...>
   <intercept-url pattern="/admin/stats/**" access="hasRole('ROLE_ADMIN')"/>
   ...
</http>

in /admin/index.jsp:

<sec:authorize url="/admin/stats/index.jsp">        
   <a href="<spring:url value="/admin/stats/index.jsp"/>">link</a>
</sec:authorize>

on the /admin/index.jsp link will be displayed even if user doesn't have ROLE_ADMIN

It appears that the problem is in

org.springframework.security.taglibs.authz.AbstractAuthorizeTag#getPrivilegeEvaluator:

Map<String, WebInvocationPrivilegeEvaluator> wipes = ctx.getBeansOfType(WebInvocationPrivilegeEvaluator.class);
....
return (WebInvocationPrivilegeEvaluator) wipes.values().toArray()[0];

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: taglibsAn issue in spring-security-taglibsin: webAn issue in web modules (web, webmvc)type: bugA general bugtype: jiraAn issue that was migrated from JIRA

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions