Problem/Motivation

Potentially malicious actors have been accessing my Drupal website, making requests for /webform/javascript/[form_name]. In diagnosing this issue and looking for a solution, it came to my attention that any webform on a Drupal website, whether or not it has any custom CSS or JS attached, creates routes /webform/javascript/[form_name] and /webform/css/[form_name] that return 200.

Proposed resolution

in WebformEntityController.php, the methods for javascript and css should do some sort of check to see if any CSS or JS has actually been added for the webform. If no code is available, the route in question should return 404 instead of 200.

Issue fork webform-3277936

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aaronpinero created an issue. See original summary.

aaronpinero’s picture

Alternative solution: make this optional, like site-wide dialog support. In my case, I (now) have no forms to which custom CSS or JS has been added. In this case, I'd want to shut off this option so that the /webform/javascript and /webform/css routes are closed.

cilefen’s picture

Version: 6.1.2 » 6.1.x-dev

jrockowitz made their first commit to this issue’s fork.

jrockowitz’s picture

Status: Active » Needs review

Good catch!!!

Please review the MR.

  • jrockowitz committed e079a57 on 6.1.x
    Issue #3277936: WebformEntityController does not check for CSS or JS...
jrockowitz’s picture

Status: Needs review » Fixed

  • jrockowitz committed e079a57 on 6.x
    Issue #3277936: WebformEntityController does not check for CSS or JS...

  • jrockowitz committed e079a57 on 6.2.x
    Issue #3277936: WebformEntityController does not check for CSS or JS...

Status: Fixed » Closed (fixed)

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