Issues (73)

Security Analysis    no request data  

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

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

code/extensions/StripeSlackSiteConfigExtension.php (13 issues)

1
<?php
2
3
4
/**
5
 * Class StripeSlackSiteConfigExtension
6
 *
7
 * @property SiteConfig|StripeSlackSiteConfigExtension $owner
8
 * @property string $SlackURL
9
 * @property string $SlackClientID
10
 * @property string $SlackClientSecret
11
 * @property string $SlackChannel
12
 * @property string $SlackToken
13
 * @property boolean $ClearSecrets
14
 * @property int $SlackBackURLID
15
 * @property int $SlackErrorBackURLID
16
 * @method SiteTree SlackBackURL()
17
 * @method SiteTree SlackErrorBackURL()
18
 */
19
class StripeSlackSiteConfigExtension extends DataExtension
0 ignored issues
show
The type DataExtension was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
{
21
    private static $db = [
22
        'SlackURL'          => 'Varchar(255)',
23
        'SlackClientID'     => 'Varchar(255)',
24
        'SlackClientSecret' => 'Varchar(255)',
25
        'SlackChannel'      => 'Varchar(255)',
26
        'SlackToken'        => 'Varchar(255)',
27
        // This is here to support the IDE's
28
        'ClearSecrets'      => 'Boolean(false)'
29
    ];
30
31
    private static $has_one = [
0 ignored issues
show
The property $has_one is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
32
        'SlackBackURL'      => SiteTree::class,
0 ignored issues
show
The type SiteTree was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
33
        'SlackErrorBackURL' => SiteTree::class
34
    ];
35
36
    private static $helptexts = [
37
        'Link'         => 'To activate your StripeSlack, Please have an admin activate StripeSlack by clicking on this link.',
38
        'ClearSecrets' => 'Checking this checkbox will clear out the Client Secret and (invisible in the CMS) Client Token. In case your admin left the group, or you want a new admin to sent the invite',
39
        'Channel'      => 'You can get the ID by right clicking on your channel and select "copy link". Open the copied link in a browser and copy the part after "messages/" in to this field',
40
        'URLHelp'      => 'Include the "https://" part',
41
        'Extended'     => '<p><a href="https://github.com/Firesphere/silverstripe-stripeslack/blob/master/readme.md">Extensive instructions can be found on GitHub</a></p>'
42
    ];
43
44
    public function updateFieldLabels(&$labels)
45
    {
46
        $labels['SlackURL'] = _t('StripeSlackSiteConfigExtension.SlackURL', 'URL Of the Slack channel');
0 ignored issues
show
The function _t was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
        $labels['SlackURL'] = /** @scrutinizer ignore-call */ _t('StripeSlackSiteConfigExtension.SlackURL', 'URL Of the Slack channel');
Loading history...
47
        $labels['SlackClientID'] = _t('StripeSlackSiteConfigExtension.SlackClientID', 'Client ID for your Slack App');
48
        $labels['SlackClientSecret'] = _t(
49
            'StripeSlackSiteConfigExtension.SlackClientSecret',
50
            'Client Secret for your Slack App'
51
        );
52
        $labels['SlackChannel'] = _t('StripeSlackSiteConfigExtension.SlackChannel', 'The ID of your channel');
53
        $labels['ClearSecrets'] = _t('StripeSlackSiteConfigExtension.ClearSecrets', 'Clear Secrets and Tokens');
54
        $labels['SlackBackURL'] = _t(
55
            'StripeSlackSiteConfigExtension.SlackBackURL',
56
            'URL to redirect when request is successful (leave empty if you want use the Stripe Slack Page)'
57
        );
58
        $labels['SlackErrorBackURL'] = _t(
59
            'StripeSlackSiteConfigExtension.SlackErrorBackURL',
60
            'URL to redirect when request is unsuccessful (leave empty if you want to use the Stripe Slack Page)'
61
        );
62
    }
63
64
    public function updateCMSFields(FieldList $fields)
0 ignored issues
show
The type FieldList was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
65
    {
66
        $fields->removeByName(['SlackToken']);
67
        $fields->addFieldsToTab('Root.Slack', [
68
            $url = TextField::create('SlackURL', $this->owner->fieldLabel('SlackURL')),
0 ignored issues
show
The type TextField was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
69
            $channel = TextField::create('SlackChannel', $this->owner->fieldLabel('SlackChannel')),
70
            TextField::create('SlackClientID', $this->owner->fieldLabel('SlackClientID')),
71
            PasswordField::create('SlackClientSecret', $this->owner->fieldLabel('SlackClientSecret')),
0 ignored issues
show
The type PasswordField was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
72
            TreeDropdownField::create('SlackBackURLID', $this->owner->fieldLabel('SlackBackURL'), 'SiteTree'),
0 ignored issues
show
The type TreeDropdownField was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
73
            TreeDropdownField::create('SlackErrorBackURLID', $this->owner->fieldLabel('SlackErrorBackURL'), 'SiteTree'),
74
        ]);
75
        if (
76
            $this->owner->SlackURL &&
77
            $this->owner->SlackClientID &&
78
            $this->owner->SlackClientSecret &&
79
            !$this->owner->SlackToken
80
        ) {
81
            $domain = Director::absoluteURL('/SlackAuthorization/');
82
            $text = LiteralField::create(
0 ignored issues
show
The type LiteralField was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
83
                'link',
84
                '<p><a href="' . $this->owner->SlackURL . '/oauth/authorize?client_id=' . $this->owner->SlackClientID . '&scope=client&redirect_uri=' . $domain . '">' .
85
                static::$helptexts['Link'] .
0 ignored issues
show
Since $helptexts is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $helptexts to at least protected.
Loading history...
86
                '</a></p>'
87
            );
88
            $fields->addFieldToTab('Root.Slack', $text);
89
        } else {
90
            $fields->addFieldsToTab(
91
                'Root.Slack',
92
                [
93
                    $secretField = CheckboxField::create('ClearSecrets', $this->owner->fieldLabel('ClearSecrets')),
0 ignored issues
show
The type CheckboxField was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
94
                    ReadonlyField::create('Users on Slack', SlackStatusController::create()->usercount(new SS_HTTPRequest('GET', '/SlackStatus/usercount')))
0 ignored issues
show
The type ReadonlyField was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
The type SS_HTTPRequest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
95
                ]
96
            );
97
            $secretField->setDescription(static::$helptexts['ClearSecrets']);
98
        }
99
        $channel->setDescription(static::$helptexts['Channel']);
100
        $url->setDescription(static::$helptexts['URLHelp']);
101
102
        $fields->addFieldToTab('Root.Slack', LiteralField::create('instructions', static::$helptexts['Extended']));
103
    }
104
105
    /**
106
     * Clear out the secrets if the checkbox is checked
107
     */
108
    public function onBeforeWrite()
109
    {
110
        parent::onBeforeWrite();
111
        if ($this->owner->ClearSecrets) {
112
            $this->owner->SlackClientSecret = '';
113
            $this->owner->SlackToken = '';
114
        }
115
        // Always set back to false so the checkbox won't stay ticked
116
        $this->owner->ClearSecrets = false;
117
    }
118
}
119