Skip to content

LUT-32919 : CSRF token and open redirect control on comment add/remove#21

Open
FrancoisEricMerlin wants to merge 1 commit into
lutece-platform:develop_core7from
FrancoisEricMerlin:LUT-32919-develop_core7
Open

LUT-32919 : CSRF token and open redirect control on comment add/remove#21
FrancoisEricMerlin wants to merge 1 commit into
lutece-platform:develop_core7from
FrancoisEricMerlin:LUT-32919-develop_core7

Conversation

@FrancoisEricMerlin

Copy link
Copy Markdown
Member

Fixes the Open Redirect via CSRF reported on the extend-comment module.

  • CSRF: add a security token (SecurityTokenService) to the doAddComment action, scoped per ( idExtendableResource, extendableResourceType ); the removeComment token is aligned on the same couple.
  • Open redirect: both redirections (redirectToLastUrl, doRemoveComment) now validate the target with SecurityUtil.isInternalRedirectUrlSafe, falling back to the site base URL for external URLs.

Redmine: https://dev.lutece.paris.fr/bugtracker/issues/32919

Add a per-resource CSRF security token (SecurityTokenService) to the
doAddComment action and align the removeComment token on the same
( idExtendableResource, extendableResourceType ) couple.

Guard both redirections (redirectToLastUrl, doRemoveComment) with
SecurityUtil.isInternalRedirectUrlSafe to prevent open redirect via the
from_url parameter, with fallback to the site base URL.
@FrancoisEricMerlin
FrancoisEricMerlin force-pushed the LUT-32919-develop_core7 branch from 301fbec to 03914de Compare July 8, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant