Issues (13)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

media.module (2 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * @file
5
 * Contains media.module.
6
 */
7
8
use Drupal\Core\Routing\RouteMatchInterface;
9
use Drupal\Core\Form\FormStateInterface;
10
use Drupal\views\ViewExecutable;
11
12
/**
13
 * Implements hook_help().
14
 */
15
function media_help($route_name, RouteMatchInterface $route_match) {
0 ignored issues
show
The parameter $route_match is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
  switch ($route_name) {
17
    // Main module help for the media module.
18
    case 'help.page.media':
19
      $output = '';
20
      $output .= '<h3>' . t('About') . '</h3>';
21
      $output .= '<p>' . t('Media module for Drupal 8') . '</p>';
22
      return $output;
23
24
    default:
25
  }
26
}
27
28
/**
29
 * Implements hook_form_alter().
30
 */
31
function media_form_alter(&$form, FormStateInterface &$form_state) {
0 ignored issues
show
The parameter $form_state is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
  if ($form['#form_id'] == 'entity_browser_media_library_form') {
33
    // Style the submit button.
34
    $form['actions']['submit']['#attributes']['class'][] = 'button--primary';
35
    $form['actions']['submit']['#attributes']['class'][] = 'entity-browser-modal-target';
36
  }
37
  // Remove the Gallery option from create gallery view's bundle filters.
38
  if ($form['#id'] == 'views-exposed-form-media-library-gallery-media-select-modal' || $form['#id'] == 'views-exposed-form-media-library-gallery-user-media-select-modal') {
39
    unset($form['bundle_1']['#options']['gallery']);
40
  }
41
  if ($form['#form_id'] == 'media_gallery_form') {
42
    $form['#attached']['library'][] = 'media/view';
43
  }
44
}
45
46
/**
47
 * Implements hook_views_pre_render().
48
 *
49
 * Adds the media.view library to the media views.
50
 */
51
function media_views_pre_render(ViewExecutable $view) {
52
  if (isset($view) && ($view->storage->id() == 'media_library' || $view->storage->id() == 'global_media_library')) {
53
    $view->element['#attached']['library'][] = 'media/view';
54
  }
55
}
56
57
/**
58
 * Implements hook_menu_local_actions_alter().
59
 *
60
 * Adds the add media button from media_entity on library pages.
61
 */
62
function media_menu_local_actions_alter(&$local_actions) {
63
  $local_actions['media.add']['appears_on'][] = 'view.media_library.user_media_library';
64
  $local_actions['media.add']['appears_on'][] = 'view.media_library.global_media_library_page';
65
}
66
67
/**
68
 * Implements hook_entity_type_alter().
69
 */
70
function media_entity_type_alter(array &$entity_types) {
71
  $field_name = \Drupal::config('media_entity.bundle.gallery')->get('type_configuration.source_field');
72
  $entity_types['media']->addConstraint('GalleryMediaBundle', array('sourceFieldName' => $field_name));
73
}
74
75
/**
76
 * Implements hook_menu_links_discovered_alter().
77
 */
78
function media_menu_links_discovered_alter(&$links) {
79
  // Media entity module provides a default view which we disable. Since it also
80
  // provides a link entry for it we need to update the route there to point to
81
  // the media library we provide.
82
  $links['entity.media.collection']['route_name'] = 'view.media_library.global_media_library_page';
83
}
84