Skip to content

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

I tried again to run a security analysis on our code with Psalm, and now we have fixed many escaping issues, it seems that results are consistents. Also, maybe a few issues have been fixed in Psalm.

For the moment, I silented all errors expect the TaintedTextWithQuotes errors.

I did not fixed all detected errors yet, this will be done in the next few days.

@cedric-anne cedric-anne added this to the 11.0.0 milestone Jul 24, 2025
@cedric-anne cedric-anne self-assigned this Jul 24, 2025
@cedric-anne cedric-anne force-pushed the 11.0/psalm-security-analysis branch from 381f91e to 8bbcc3f Compare July 24, 2025 14:10
@cedric-anne cedric-anne mentioned this pull request Jul 28, 2025
2 tasks
@cedric-anne cedric-anne changed the base branch from main to 11.0/bugfixes July 29, 2025 13:17
@cedric-anne cedric-anne force-pushed the 11.0/psalm-security-analysis branch from 8bbcc3f to c163ac4 Compare July 31, 2025 14:09
@cedric-anne cedric-anne changed the title Add Psalm security checks and fix detected issues Add Psalm security checks (has_quotes only) and fix detected issues Jul 31, 2025
Comment on lines -6593 to -6597
// Display extra html if needed
if (!empty($options['after_display'] ?? "")) {
echo $options['after_display'];
}

Copy link
Member Author

Choose a reason for hiding this comment

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

This was used only by front/problem.form.php and front/ticket.form.php, and was now a security flaw since the request is not anymore autosanitized.


if (!$compat) {
echo htmlescape(Plugin::messageIncompatible(
echo Plugin::messageIncompatible(
Copy link
Member Author

Choose a reason for hiding this comment

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

This message and the following are caught inside an output buffer that is later escaped (see $error .= "<span class='error'>" . htmlescape(ob_get_contents()) . "</span>"; in src/Glpi/Marketplace/View.php).

The buffer content can also contain messages outputed by plugins, it is safer to escape its whole content.

@cedric-anne cedric-anne marked this pull request as ready for review July 31, 2025 14:18
@cedric-anne cedric-anne force-pushed the 11.0/psalm-security-analysis branch from c163ac4 to a7b7cb4 Compare July 31, 2025 14:21
@cedric-anne cedric-anne merged commit f8888e3 into glpi-project:11.0/bugfixes Jul 31, 2025
8 checks passed
@cedric-anne cedric-anne deleted the 11.0/psalm-security-analysis branch July 31, 2025 20:13
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.

2 participants