Skip to content

Forms: prevent unauthenticated users from pasting images #20224

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

Conversation

AdrienClairembault
Copy link
Contributor

Checklist before requesting a review

  • 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

For unauthenticated forms, disable the enable_images settings for textarea questions.

@AdrienClairembault AdrienClairembault self-assigned this Jul 7, 2025
@AdrienClairembault AdrienClairembault marked this pull request as ready for review July 7, 2025 09:02
@@ -329,7 +329,7 @@ private function applyPredefinedTemplateFields(array $input): array
/** @var \CommonITILObject $itil */
$itil = new $itemtype();
$template = $itil->getITILTemplateToUse(
entities_id: $_SESSION["glpiactive_entity"],
entities_id: $_SESSION["glpiactive_entity"] ?? 0,
Copy link
Member

Choose a reason for hiding this comment

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

The template should be fetched from the target entity (it is configurable in forms).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should probably have been another PR, but I've fixed it.

@trasher
Copy link
Contributor

trasher commented Jul 8, 2025

Please fix tests

@cedric-anne cedric-anne merged commit 6a6926b into glpi-project:main Jul 8, 2025
7 checks passed
@AdrienClairembault AdrienClairembault deleted the prevent-unauthenticated-image-paste branch July 8, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants