Background information

Problem/Motivation

Passing user input to Htmx::trigger() could be used for DDOS attacks if the trigger is set to a very low interval.
This is slightly mitigated by the fact HTMX waits for the current request to complete before starting the next.

It should be fairly obvious that passing user input to this method is a bad idea but we might still want to state that explicitly in the docblock.

Steps to reproduce

$userProvidedValue = 'every 0.001s';

// The browser will start spamming the URL.
Htmx::trigger('click', $userProvidedValue);

Proposed resolution

Add a warning to the docblock saying $triggerDefinition should not be provided by untrusted users.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3614219

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

prudloff created an issue. See original summary.

prudloff’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Seems straight forward enoguh

fathershawn’s picture

+1 from me. As a general principal, no HTMX attribute values should be constructed using user input.

  • godotislate committed 49373f8d on 11.x
    task: #3614219 Add warning about DDOS to Htmx::trigger()
    
    By: prudloff...

  • godotislate committed 924d5089 on main
    task: #3614219 Add warning about DDOS to Htmx::trigger()
    
    By: prudloff...
godotislate’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 924d508 to main and 49373f8 to 11.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.