Issues (1098)

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.

src/records/fields.php (1 issue)

Encourage use of @property annotation when providing magic access

Documentation Minor

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
//
5
//  eTraxis - Records tracking web-based system
6
//  Copyright (C) 2010-2011  Artem Rodygin
7
//
8
//  This program is free software: you can redistribute it and/or modify
9
//  it under the terms of the GNU General Public License as published by
10
//  the Free Software Foundation, either version 3 of the License, or
11
//  (at your option) any later version.
12
//
13
//  This program is distributed in the hope that it will be useful,
14
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
//  GNU General Public License for more details.
17
//
18
//  You should have received a copy of the GNU General Public License
19
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
//
21
//------------------------------------------------------------------------------
22
23
/**
24
 * @package eTraxis
25
 * @ignore
26
 */
27
28
/**#@+
29
 * Dependency.
30
 */
31
require_once('../engine/engine.php');
32
require_once('../dbo/accounts.php');
33
require_once('../dbo/fields.php');
34
require_once('../dbo/values.php');
35
require_once('../dbo/records.php');
36
require_once('../dbo/views.php');
37
/**#@-*/
38
39
init_page(LOAD_TAB, GUEST_IS_ALLOWED);
40
41
// check that requested record exists
42
43
$id     = ustr2int(try_request('id'));
44
$record = record_find($id);
45
46
if (!$record)
47
{
48
    debug_write_log(DEBUG_NOTICE, 'Record cannot be found.');
49
    exit;
50
}
51
52
// get current user's permissions and verify them
53
54
$permissions = record_get_permissions($record['template_id'], $record['creator_id'], $record['responsible_id']);
55
56
if (!can_record_be_displayed($permissions))
57
{
58
    debug_write_log(DEBUG_NOTICE, 'Record cannot be displayed.');
59
    exit;
60
}
61
62
// mark the record as read
63
64
record_read($id);
65
66
// generate general information
67
68
$xml = '<group title="' . get_html_resource(RES_GENERAL_INFO_ID) . '">'
69
     . '<text label="' . get_html_resource(RES_SUBJECT_ID)     . '">' . update_references($record['subject'], BBCODE_MINIMUM) . '</text>'
70
     . '<text label="' . get_html_resource(RES_STATE_ID)       . '">' . ustr2html($record['state_name']) . '</text>'
71
     . '<text label="' . get_html_resource(RES_RESPONSIBLE_ID) . '">' . (is_null($record['username']) ? get_html_resource(RES_NONE_ID) : ustr2html(sprintf('%s (%s)', $record['fullname'], account_get_username($record['username'])))) . '</text>'
72
     . '<text label="' . get_html_resource(RES_AUTHOR_ID)      . '">' . ustr2html(sprintf('%s (%s)', $record['author_fullname'], account_get_username($record['author_username']))) . '</text>'
73
     . '<text label="' . get_html_resource(RES_AGE_ID)         . '">' . get_record_last_event($record) . '/' . get_record_age($record) . '</text>'
74
     . '<text label="' . get_html_resource(RES_PROJECT_ID)     . '">' . ustr2html($record['project_name']) . '</text>'
75
     . '<text label="' . get_html_resource(RES_TEMPLATE_ID)    . '">' . ustr2html($record['template_name']) . '</text>';
76
77 View Code Duplication
if (is_record_postponed($record))
78
{
79
    $xml .= '<text label="' . get_html_resource(RES_POSTPONED_ID) . '">' . get_date($record['postpone_time']) . '</text>';
80
}
81
82
$xml .= '</group>';
83
84
// go through the list of all states and their fields
85
86
$states = dal_query('records/elist.sql', $id);
87
88
while (($state = $states->fetch()))
89
{
90
    $fields = dal_query('records/flist.sql',
91
                        $id,
92
                        $state['state_id'],
93
                        $record['creator_id'],
94
                        is_null($record['responsible_id']) ? 0 : $record['responsible_id'],
95
                        $_SESSION[VAR_USERID],
96
                        FIELD_ALLOW_TO_READ);
97
98
    if ($fields->rows != 0)
0 ignored issues
show
The property $rows is declared protected in CRecordset. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
99
    {
100
        $xml .= '<group title="' . ustr2html($state['state_name']) . '">';
101
102 View Code Duplication
        while (($field = $fields->fetch()))
103
        {
104
            $value = value_find($field['field_type'], $field['value_id']);
105
106
            if ($field['field_type'] == FIELD_TYPE_CHECKBOX)
107
            {
108
                $value = get_html_resource($value ? RES_YES_ID : RES_NO_ID);
109
            }
110
            elseif ($field['field_type'] == FIELD_TYPE_LIST)
111
            {
112
                $value = (is_null($value) ? NULL : value_find_listvalue($field['field_id'], $value));
113
            }
114
            elseif ($field['field_type'] == FIELD_TYPE_RECORD)
115
            {
116
                $value = (is_null($value) ? NULL : 'rec#' . $value);
117
            }
118
119
            $xml .= '<text label="' . ustr2html($field['field_name']) . '">'
120
                  . (is_null($value) ? get_html_resource(RES_NONE_ID) : update_references($value, BBCODE_ALL, $field['regex_search'], $field['regex_replace']))
121
                  . '</text>';
122
123
            if ($field['add_separator'])
124
            {
125
                $xml .= '<hr/>';
126
            }
127
        }
128
129
        $xml .= '</group>';
130
    }
131
}
132
133
echo(xml2html($xml));
134
135
?>
136