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/snyk report #18077

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Fix/snyk report #18077

wants to merge 4 commits into from

Conversation

orthagh
Copy link
Contributor

@orthagh orthagh commented Oct 16, 2024

  • 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

Working on the reports of local scans with snyk (as we can only scan the default branch with their saas)

Copy link

sonarcloud bot commented Oct 17, 2024

Comment on lines +49 to +52
// limit to GLPI Classes
if (!class_exists($link_class) && !is_subclass_of($_POST["itemtype"], "CommonDBTM")) {
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

We should always use getItemForItemtype() to instanciate classes from a dynamic classname.

@@ -717,6 +717,8 @@ private static function getTabIconClass(?string $form_itemtype = null): string
**/
public static function createTabEntry($text, $nb = 0, ?string $form_itemtype = null, string $icon = '')
{
$text = htmlspecialchars($text);
Copy link
Member

Choose a reason for hiding this comment

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

I created a PR for this one as it requires some calls to be adapted. See #18121.

Copy link
Member

Choose a reason for hiding this comment

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

We can even drop the GLPI_DEMO_MODE constant and its different usages. See #18122.

Comment on lines +176 to +178
if (isset($_POST['language']) && $_POST['language'] != '' && isset($CFG_GLPI['languages'][$_POST['language']])) {
$_SESSION["glpilanguage"] = $_POST['language'];
}
Copy link
Member

Choose a reason for hiding this comment

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

I guess the purpose of this is to be able to display a confirmation message in the target language when the user uses the language switch feature. This can probably be done in User::prepareInputForUpdate() when the target user is the current user.

It would prevent side effects, for instance when the language present in the $_POST variable is related to something else than the current user.

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.

2 participants