Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix routing of plugins public PHP scripts #18786

Conversation

cedric-anne
Copy link
Member

Checklist before requesting a review

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.

Description

In GLPI 11.0, a request to /plugins/myplugin/myscript.php should serve the /plugins/myplugin/public/myscript.php file and the default firewall strategy should be the same as any other legacy PHP script of the plugin.

This PR:

  • fixes the default strategy applied to /public/*.php scripts,
  • handles URLs explicitely containing the /public path, but triggers a deprecation indicating that /public should not be present in the URL (URL /plugins/myplugin/public/myscript.php shoudl be replaced by /plugins/myplugin/myscript.php).

@cedric-anne cedric-anne added this to the 11.0.0 milestone Jan 22, 2025
@cedric-anne cedric-anne self-assigned this Jan 22, 2025
Copy link
Contributor

@trasher trasher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested, but seems technically OK.

From my point of view, there should be no PHP scripts in public directory though.

Copy link
Collaborator

@tsmr tsmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests ok

@cedric-anne
Copy link
Member Author

From my point of view, there should be no PHP scripts in public directory though.

I agree. It is just to handle legacy PHP scripts that were not in the ajax/front directory of the plugin. They can be moved in the public directory to make the migration easier (no need to change the URLs), but they will have to be converted in a Symfony controller in the long term.

@trasher trasher merged commit 51387d7 into glpi-project:main Jan 22, 2025
9 checks passed
@cedric-anne cedric-anne deleted the 11.0/fix-public-scripts-firewall-strategy branch January 22, 2025 12:45
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.

5 participants