Skip to content

feat: make plugin CSP compliant - #89

Draft
Rom1-B wants to merge 2 commits into
11.0/bugfixesfrom
csp-compliance
Draft

Rom1-B wants to merge 2 commits into
11.0/bugfixesfrom
csp-compliance

Conversation

@Rom1-B

@Rom1-B Rom1-B commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Summary

The plugin declares support for the Content Security Policy sent by GLPI.
Audit of the PHP, Twig and JavaScript sources found no inline event handler attribute, no javascript: URL, no <script> tag printed from PHP or created from JavaScript, and no core helper emitting an inline handler, so no code change was needed.

The LDAP select question passes on_change to Dropdown::show(). Core renders it as jQuery change handler evaluated with eval(), not as an onchange attribute, so it is allowed by the CSP ('unsafe-eval') and left unchanged.

Changes

  • setup.php: add 'csp_compliant' => true to plugin_version_advancedforms().
  • CHANGELOG.md: entry under Unreleased.

Blocked by

  • Add content security policy glpi-project/glpi#26020 (CSP support) and its 11.0 / 12.0 backports. The csp_compliant declaration only takes effect on GLPI releases shipping the CSP.
  • The minimum GLPI version (PLUGIN_ADVANCEDFORMS_MIN_GLPI_VERSION, currently 11.0.7) must be bumped to the first CSP-enabled 11.0 release before merging.

Manual test checklist

Keep the browser console open. CSP violations appear as Refused to execute inline event handler or Refused to execute inline script.

  • Form editor, LDAP select question: pick an LDAP directory in the dropdown; the filter input is filled from the server (GetAuthLdapFilter). Select the empty value; the filter is cleared.
  • Form editor, Table question: add a row, open a user or item select column; the AJAX dropdown lists entries and selection works.
  • Form editor, Table question: column type select changes the column configuration panel.
  • Form, Tree cascade dropdown question: selecting a parent loads children and the next level appears.
  • Form, LDAP select question (end user): the dropdown lists the directory entries and the search works.
  • No CSP violation logged on these pages.

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