Issues (273)

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.

assets/js/src/servers.js (7 issues)

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
var crel = require('crel');
2
var tinysort = require('tinysort');
3
4
var $servers = $('.js-server');
5
6
/**
7
 * The JS object for servers
8
 *
9
 * @constructor
10
 * @param object {Node}
11
 */
12
function Server(object) {
13
    this.$object = $(object);
14
    this.url = baseURLNoHost + '/servers/status/' + this.$object.data('id');
15
    this.token = this.$object.data('token');
16
17
    // Alias for this object for callback functions
18
    var server = this;
19
20
    // Set up the 'force refresh' button
21
    this.$object.find('.js-refresh').click(function (event) {
22
        event.preventDefault();
23
24
        var $this = $(this);
25
26
        $this.addClass('fa-spin');
27
        server.updateServer(true, function () {
28
            $this.removeClass('fa-spin');
29
        });
30
    });
31
32
    this.updateCard = function (data) {
33
        this.$object.find('.js-server__last-update').html(data['last_update']);
0 ignored issues
show
['last_update'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
34
        this.$object.find('.js-server__player-count').html(data['player_count']);
0 ignored issues
show
['player_count'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
35
        this.$object.attr('data-player-count', data['player_count']);
0 ignored issues
show
['player_count'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
36
37
        // Statuses
38
        var status = (data['player_count'] > 0) ? 'active' : data['status'];
0 ignored issues
show
['player_count'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
['status'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
39
        this.$object.find('.js-server__status').attr('data-status', status);
40
    };
41
42
    /**
43
     * Enable the spinner element for the server card
44
     * @returns {Server}
45
     */
46
    this.startSpinners = function () {
47
        this.$object
48
            .find('.js-dimmable')
49
            .find('.dimmer, .spinner')
50
            .fadeIn('fast')
51
        ;
52
53
        return this;
54
    };
55
56
    /**
57
     * Hide the spinner element
58
     * @returns {Server}
59
     */
60
    this.stopSpinners = function () {
61
        this.$object
62
            .find('.js-dimmable')
63
            .find('.dimmer, .spinner')
64
            .fadeOut('fast')
65
        ;
66
67
        return this;
68
    };
69
70
    /**
71
     * Update the server card with information we're pulling via AJAX
72
     */
73
    this.updateServer = function (forceUpdate, onDoneCallback) {
74
        this.startSpinners();
75
76
        var urlCall = this.url;
77
        forceUpdate = (typeof forceUpdate === 'undefined') ? false : forceUpdate;
78
79
        if (forceUpdate) {
80
            urlCall += '?forced=1';
81
        }
82
83
        jQuery
84
            .post(urlCall, {
85
                token: this.token
86
            })
87
            .done(function(data) {
88
                server.updateCard(data);
89
                server.stopSpinners();
90
91
                (typeof onDoneCallback === 'function') && onDoneCallback();
0 ignored issues
show
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
92
            })
93
        ;
94
    }
0 ignored issues
show
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
95
}
96
97
function initialize() {
98
    // Hide any dimmers that might have been left
99
    $('.dimmer, .spinner').fadeOut('fast');
100
101
    var dimmer  = crel('div', { 'class': 'dimmer' });
102
    var spinner = crel('div', { 'class': 'spinner' }, 'Loading...');
103
104
    $('.js-dimmable')
105
        .prepend(dimmer)
106
        .prepend(spinner)
107
    ;
108
109
    loadAllServers();
110
}
111
112
function loadAllServers() {
113
    $servers.each(function () {
114
        new Server(this).updateServer();
115
    });
116
}
117
118
function sortServers() {
119
    var servers = $('.js-server');
120
121
    tinysort(servers, { attr: 'data-player-count', order: 'ASC' });
122
}
123
124
module.exports = function () {
125
    // If this page has no .js-server components, then no need to proceed
126
    if (!$servers.length) {
127
        return;
128
    }
129
130
    initialize();
131
    sortServers();
132
};
133