Issues (3948)

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.

app/Validators/SubtaskValidator.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
/*
4
 * This file is part of Jitamin.
5
 *
6
 * Copyright (C) Jitamin Team
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Jitamin\Validator;
13
14
use SimpleValidator\Validator;
15
use SimpleValidator\Validators;
16
17
/**
18
 * Subtask Validator.
19
 */
20
class SubtaskValidator extends BaseValidator
21
{
22
    /**
23
     * Validate creation.
24
     *
25
     * @param array $values Form values
26
     *
27
     * @return array $valid, $errors   [0] = Success or not, [1] = List of errors
28
     */
29
    public function validateCreation(array $values)
30
    {
31
        $rules = [
32
            new Validators\Required('task_id', t('The task id is required')),
33
            new Validators\Required('title', t('The title is required')),
34
        ];
35
36
        $v = new Validator($values, array_merge($rules, $this->commonValidationRules()));
37
38
        return [
39
            $v->execute(),
40
            $v->getErrors(),
41
        ];
42
    }
43
44
    /**
45
     * Validate modification.
46
     *
47
     * @param array $values Form values
48
     *
49
     * @return array $valid, $errors   [0] = Success or not, [1] = List of errors
50
     */
51 View Code Duplication
    public function validateModification(array $values)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
52
    {
53
        $rules = [
54
            new Validators\Required('id', t('The subtask id is required')),
55
            new Validators\Required('task_id', t('The task id is required')),
56
            new Validators\Required('title', t('The title is required')),
57
        ];
58
59
        $v = new Validator($values, array_merge($rules, $this->commonValidationRules()));
60
61
        return [
62
            $v->execute(),
63
            $v->getErrors(),
64
        ];
65
    }
66
67
    /**
68
     * Validate API modification.
69
     *
70
     * @param array $values Form values
71
     *
72
     * @return array $valid, $errors   [0] = Success or not, [1] = List of errors
73
     */
74
    public function validateApiModification(array $values)
75
    {
76
        $rules = [
77
            new Validators\Required('id', t('The subtask id is required')),
78
            new Validators\Required('task_id', t('The task id is required')),
79
        ];
80
81
        $v = new Validator($values, array_merge($rules, $this->commonValidationRules()));
82
83
        return [
84
            $v->execute(),
85
            $v->getErrors(),
86
        ];
87
    }
88
89
    /**
90
     * Common validation rules.
91
     *
92
     * @return array
93
     */
94
    private function commonValidationRules()
95
    {
96
        return [
97
            new Validators\Integer('id', t('The subtask id must be an integer')),
98
            new Validators\Integer('task_id', t('The task id must be an integer')),
99
            new Validators\MaxLength('title', t('The maximum length is %d characters', 255), 255),
100
            new Validators\Integer('user_id', t('The user id must be an integer')),
101
            new Validators\Integer('status', t('The status must be an integer')),
102
            new Validators\Numeric('time_estimated', t('The time must be a numeric value')),
103
            new Validators\Numeric('time_spent', t('The time must be a numeric value')),
104
        ];
105
    }
106
}
107