J'essaye d'implémenter HDIV avec une application utilisant des entretoises 1.3.8. J'ai ajouté les dépendances dans le fichier pom et l'écouteur, filtrer dans le fichier web.xml. Le jeton _HDIV_STATE_ est injecté dans chaque page, lien .. Donc, pour tester si cela fonctionne comme prévu contre les attaques CSRF, j'ai fait une petite page html en dehors de l'application qui envoie des données à l'application pour modifier certaines données dans afin de simuler une attaque CSRF.HDIV: ne pas rediriger vers la page d'erreur quand HDIV_PARAMETER_NOT_EXISTS
Le test est malheureusement un succès car les données cibles ont été modifiées. Lorsque je vérifie les journaux, il semble que HDIV détecte que la requête ne contient pas _HDIV_STATE_ mais qu'elle ne l'annule pas et qu'elle redirige vers la page d'erreur ou autre chose.
Est-ce que je me trompe dans ma configuration ou simplement que je n'ai pas compris ce que HDIV fait quand le jeton n'existe pas dans la requête?
Merci pour votre aide
pom.xml:
<dependency>
<groupId>org.hdiv</groupId>
<artifactId>hdiv-config</artifactId>
<version>2.1.12</version>
</dependency>
<dependency>
<groupId>org.hdiv</groupId>
<artifactId>hdiv-struts-1</artifactId>
<version>2.1.12</version>
</dependency>
<dependency>
<groupId>org.hdiv</groupId>
<artifactId>hdiv-jstl-taglibs-1.2</artifactId>
<version>2.1.12</version>
</dependency>
web.xml
<listener>
<listener-class>org.hdiv.listener.InitListener</listener-class>
</listener>
<filter>
<filter-name>ValidatorFilter</filter-name>
<filter-class>org.hdiv.filter.ValidatorFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ValidatorFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<jsp-config>
<taglib>
<taglib-uri>/WEB-INF/tld/struts-html-el.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/hdiv-html-el.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tld/struts-logic-el.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/hdiv-logic-el.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tld/c.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/hdiv-c.tld</taglib-location>
</taglib>
</jsp-config>
HdIV-config.hml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hdiv="http://www.hdiv.org/schema/hdiv"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.hdiv.org/schema/hdiv
http://www.hdiv.org/schema/hdiv/hdiv.xsd">
<hdiv:config excludedExtensions="css,png,gif,jpeg,jpg,js" errorPage="/error.jsp"
maxPagesPerSession="2" debugMode="true">
<hdiv:sessionExpired loginPage="/index.jsp" homePage="/"/>
<hdiv:startPages>/index.jsp</hdiv:startPages>
</hdiv:config>
</beans>
Merci beaucoup. Je n'ai pas remarqué ce point. – kkung
parfait merci l'homme. – Amare