Problem/Motivation

The LegalLogin form does not perform any checks on the values retrieved from cookies. If the cookie values get tampered with this can cause a fatal PHP error.

Steps to reproduce

Setup the module and log in with a user who's required to accept legal terms. When viewing the terms, go to the inspector and find the cookie values. Edit the Drupal.visitor.legal_id value to be a non-existing user ID integer. Submit the form and notice the PHP error.

Proposed resolution

Add some more checks to exit gracefully if the cookie value is not a valid ID.

Remaining tasks

n/a

User interface changes

n/a

API changes

n/a

Data model changes

n/a

CommentFileSizeAuthor
legal_form_checks.patch2.76 KBalecsmrekar

Comments

alecsmrekar created an issue. See original summary.

plach’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me and works well here.

anybody’s picture

anybody’s picture

Version: 2.0.x-dev » 3.0.x-dev

@alecsmrekar could you reroll this against 3.0.x as MR perhaps?

robert castelo’s picture

Why do we need to "exit gracefully" if someone tampers with the cookie value?

robert castelo’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.