GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (446)

Security Analysis    not enabled

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.

tests/WorkflowInstanceTest.php (1 issue)

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
namespace Symbiote\AdvancedWorkflow\Tests;
4
5
use SilverStripe\Dev\SapphireTest;
6
use SilverStripe\Security\Member;
7
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowActionInstance;
8
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowInstance;
9
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowTransition;
10
11
/**
12
 * Tests for the workflow engine.
13
 *
14
 * @author     [email protected]
15
 * @license    BSD License (http://silverstripe.org/bsd-license/)
16
 * @package    advancedworkflow
17
 * @subpackage tests
18
 */
19
class WorkflowInstanceTest extends SapphireTest
20
{
21
    /**
22
     * @var string
23
     */
24
    protected static $fixture_file = 'useractioninstancehistory.yml';
25
26
    /**
27
     * @var Member
28
     */
29
    protected $currentMember;
30
31
    protected function setUp()
32
    {
33
        parent::setUp();
34
        $this->currentMember = $this->objFromFixture(Member::class, 'ApproverMember01');
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->objFromFixture(\S...ss, 'ApproverMember01') can also be of type object<SilverStripe\ORM\DataObject>. However, the property $currentMember is declared as type object<SilverStripe\Security\Member>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
35
    }
36
37
    /**
38
     * Tests WorkflowInstance#getMostRecentActionForUser()
39
     */
40
    public function testGetMostRecentActionForUser()
41
    {
42
        // Single, AssignUsersToWorkflowAction in "History"
43
        $history01 = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance01');
44
        $mostRecentActionForUser01 = $history01->getMostRecentActionForUser($this->currentMember);
45
        $this->assertInstanceOf(
46
            WorkflowActionInstance::class,
47
            $mostRecentActionForUser01,
48
            'Asserts the correct ClassName is retured #1'
49
        );
50
        $this->assertEquals(
51
            'Assign',
52
            $mostRecentActionForUser01->BaseAction()->Title,
53
            'Asserts the correct BaseAction is retured #1'
54
        );
55
56
        // No AssignUsersToWorkflowAction found with Member's related Group in "History"
57
        $history02 = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance02');
58
        $mostRecentActionForUser02 = $history02->getMostRecentActionForUser($this->currentMember);
59
        $this->assertFalse(
60
            $mostRecentActionForUser02,
61
            'Asserts false is returned because no WorkflowActionInstance was found'
62
        );
63
64
        // Multiple AssignUsersToWorkflowAction in "History", only one with Group relations
65
        $history03 = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance03');
66
        $mostRecentActionForUser03 = $history03->getMostRecentActionForUser($this->currentMember);
67
        $this->assertInstanceOf(
68
            WorkflowActionInstance::class,
69
            $mostRecentActionForUser03,
70
            'Asserts the correct ClassName is retured #2'
71
        );
72
        $this->assertEquals(
73
            'Assign',
74
            $mostRecentActionForUser03->BaseAction()->Title,
75
            'Asserts the correct BaseAction is retured #2'
76
        );
77
78
        // Multiple AssignUsersToWorkflowAction in "History", both with Group relations
79
        $history04 = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance04');
80
        $mostRecentActionForUser04 = $history04->getMostRecentActionForUser($this->currentMember);
81
        $this->assertInstanceOf(
82
            WorkflowActionInstance::class,
83
            $mostRecentActionForUser04,
84
            'Asserts the correct ClassName is retured #3'
85
        );
86
        $this->assertEquals(
87
            'Assigned Again',
88
            $mostRecentActionForUser04->BaseAction()->Title,
89
            'Asserts the correct BaseAction is retured #3'
90
        );
91
92
        // Multiple AssignUsersToWorkflowAction in "History", one with Group relations
93
        $history05 = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance05');
94
        $mostRecentActionForUser05 = $history05->getMostRecentActionForUser($this->currentMember);
95
        $this->assertInstanceOf(
96
            WorkflowActionInstance::class,
97
            $mostRecentActionForUser05,
98
            'Asserts the correct ClassName is retured #4'
99
        );
100
        $this->assertEquals(
101
            'Assigned Me',
102
            $mostRecentActionForUser05->BaseAction()->Title,
103
            'Asserts the correct BaseAction is retured #4'
104
        );
105
    }
106
107
    /**
108
     * Tests WorkflowInstance#canView()
109
     */
110
    public function testCanView()
111
    {
112
        // Single, AssignUsersToWorkflowAction in "History"
113
        $history01 = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance01');
114
        $this->assertTrue($history01->canView($this->currentMember));
115
116
        // No AssignUsersToWorkflowAction found with Member's related Group in "History"
117
        $history02 = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance02');
118
        $this->assertFalse($history02->canView($this->currentMember));
119
120
        // Multiple AssignUsersToWorkflowAction in "History", only one with Group relations
121
        $history03 = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance03');
122
        $this->assertTrue($history03->canView($this->currentMember));
123
124
        // Multiple AssignUsersToWorkflowAction in "History", both with Group relations
125
        $history04 = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance04');
126
        $this->assertTrue($history04->canView($this->currentMember));
127
128
        // Multiple AssignUsersToWorkflowAction in "History"
129
        $history05 = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance05');
130
        $this->assertTrue($history05->canView($this->currentMember));
131
    }
132
133
    public function testValidTransitions()
134
    {
135
        $instance = $this->objFromFixture(WorkflowInstance::class, 'WorkflowInstance06');
136
        $transition1 = $this->objFromFixture(WorkflowTransition::class, 'Transition05');
137
        $transition2 = $this->objFromFixture(WorkflowTransition::class, 'Transition06');
138
        $member1 = $this->objFromFixture(Member::class, 'Transition05Member');
139
        $member2 = $this->objFromFixture(Member::class, 'Transition06Member');
140
141
        // Given logged in as admin, check that there are two actions
142
        $this->logInWithPermission('ADMIN');
143
        $transitions = $instance->validTransitions()->column('ID');
144
        $this->assertContains($transition1->ID, $transitions);
145
        $this->assertContains($transition2->ID, $transitions);
146
147
        // Logged in as a member with permission on one transition, check that only this one is present
148
        $member1->logIn();
149
        $transitions = $instance->validTransitions()->column('ID');
150
        $this->assertContains($transition1->ID, $transitions);
151
        $this->assertNotContains($transition2->ID, $transitions);
152
153
        // Logged in as a member with permissions via group
154
        $member2->logIn();
155
        $transitions = $instance->validTransitions()->column('ID');
156
        $this->assertNotContains($transition1->ID, $transitions);
157
        $this->assertContains($transition2->ID, $transitions);
158
    }
159
}
160