Issues (162)

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/spec/restproxystore.spec.js (23 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
describe('Rest Proxy in Model', function() {
2
    it('should save entity', function() {
3
        var owner = Ext.create('Test.TestBundle.Entity.CarOwner', {
0 ignored issues
show
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
4
            name: 'James'
5
        });
6
        var runned = false;
7
        runs(function() {
8
            owner.save({
9
                callback: function(record, operation, success) {
0 ignored issues
show
The parameter operation is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
The parameter success is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
10
                    Test.TestBundle.Entity.CarOwner.load(record.getId(), {
0 ignored issues
show
The variable Test seems to be never declared. If this is a global, consider adding a /** global: Test */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
11
                        callback: function(record) {
12
                            owner = record;
13
                            runned = true;
14
                        }
15
                    });
16
                }
17
            });
18
        });
19
        waitsFor(function() {
20
            return runned;
21
        });
22
        runs(function() {
23
            expect(owner.get('name')).toBe('James');
24
        });
25
    });
26
    it('should save existing entity with new hasMany association', function() {
27
        var owner = Ext.create('Test.TestBundle.Entity.CarOwner', {
0 ignored issues
show
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
28
            name: 'James'
29
        });
30
        var runned = false;
31
        runs(function() {
32
            owner.save({
33
                callback: function(record, operation, success) {
0 ignored issues
show
The parameter record is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
The parameter success is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
The parameter operation is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
34
                    owner.cars().add({
35
                        name: 'Ford',
36
                        plateNumber: 'AA1234',
37
                        password: 'xx'
38
                    }, {
39
                        name: 'BMW',
40
                        plateNumber: 'ASF87654',
41
                        password: 'xx'
42
                    });
43
                    owner.cars().sync({
44
                        callback: function() {
45
                            Test.TestBundle.Entity.CarOwner.load(owner.getId(), {
0 ignored issues
show
The variable Test seems to be never declared. If this is a global, consider adding a /** global: Test */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
46
                                callback: function(record) {
47
                                    owner = record;
48
                                    runned = true;
49
                                }
50
                            });
51
                        }
52
                    });
53
                }
54
            });
55
        });
56
        waitsFor(function() {
57
            return runned;
58
        });
59
        runs(function() {
60
            expect(owner).not.toBeNull();
61
            expect(owner.cars().count()).toBe(2);
62
            expect(owner.cars().first().get('name')).toBe('Ford');
63
            expect(owner.cars().first().getCarOwner()).toBe(owner);
64
        });
65
    });
66
    it('should save existing entity with existing hasMany association', function() {
67
        var owner = Ext.create('Test.TestBundle.Entity.CarOwner', {
0 ignored issues
show
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
68
            name: 'James'
69
        });
70
        var runned = false;
71
        runs(function() {
72
            owner.save({
73
                callback: function(record, operation, success) {
0 ignored issues
show
The parameter success is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
The parameter record is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
The parameter operation is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
74
                    var car = Ext.create('Test.TestBundle.Entity.Car', {
0 ignored issues
show
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
75
                        name: 'Ford',
76
                        plateNumber: 'AA1234',
77
                        password: 'xx'
78
                    });
79
                    car.save({
80
                        callback: function(record) {
81
                            owner.cars().add(record);
82
                            owner.cars().sync({
83
                                callback: function() {
84
                                    owner.cars().first().getCarOwner({
85
                                        callback: function() {
86
                                            runned = true;
87
                                        }
88
                                    });
89
                                }
90
                            });
91
                        }
92
                    });
93
                }
94
            });
95
        });
96
        waitsFor(function() {
97
            return runned;
98
        });
99
        runs(function() {
100
            expect(owner).not.toBeNull();
101
            expect(owner.cars().count()).toBe(1);
102
            expect(owner.cars().first().get('name')).toBe('Ford');
103
            expect(owner.cars().first().getCarOwner().getData()).toEqual(owner.getData());
104
        });
105
    });
106
    it('should save existing entity with existing belongTo association', function() {
107
        var car = Ext.create('Test.TestBundle.Entity.Car', {
0 ignored issues
show
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
108
            name: 'Ford',
109
            plateNumber: 'AA1234',
110
            password: 'xx'
111
        });
112
        var runned = false;
113
        var car_owner_id;
114
        runs(function() {
115
            car.save({
116
                callback: function(record) {
0 ignored issues
show
The parameter record is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
117
                    var owner = Ext.create('Test.TestBundle.Entity.CarOwner', {
0 ignored issues
show
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
118
                        name: 'James Y'
119
                    });
120
                    owner.save({
121
                        callback: function(record) {
122
                            car.setCarOwner(record, {
123
                                callback: function() {
124
                                    runned = true;
125
                                    car_owner_id = car.get('car_owner_id');
126
                                }
127
                            });
128
                        }
129
                    });
130
                }
131
            });
132
        });
133
        waitsFor(function() {
134
            return runned;
135
        });
136
137
        // Reload Car entity from REST proxy. Car_owner_id should still be there.
138
        var runned1 = false;
139
        runs(function() {
140
            Test.TestBundle.Entity.Car.load(car.get('id'), {
0 ignored issues
show
The variable Test seems to be never declared. If this is a global, consider adding a /** global: Test */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
141
                callback: function(record) {
142
                    record.set('name', 'Audi');
143
144
                    // Save and reload again. If car_owner_id was not there the belongsTo association is destroyed.
145
                    record.save({
146
                        callback: function(record) {
0 ignored issues
show
The parameter record is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
147
                            Test.TestBundle.Entity.Car.load(car.get('id'), {
0 ignored issues
show
The variable Test seems to be never declared. If this is a global, consider adding a /** global: Test */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
148
                                callback: function(record) {
149
                                    car = record;
150
                                    runned1 = true;
151
                                }
152
                            });
153
                        }
154
                    });
155
                }
156
            });
157
        });
158
        waitsFor(function() {
159
            return runned1;
160
        });
161
162
        runs(function() {
163
            expect(car.getCarOwner()).not.toBeNull();
164
            expect(car.get('car_owner_id')).toBe(car_owner_id);
165
            expect(car.getCarOwner().get('name')).toBe('James Y');
166
            expect(car.get('name')).toBe('Audi');
167
        });
168
    });
169
    it('should update entity', function() {
170
        var car = Ext.create('Test.TestBundle.Entity.Car', {
0 ignored issues
show
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
171
            name: 'Ford',
172
            plateNumber: 'AA1234',
173
            password: 'xx'
174
        });
175
        var originalId;
176
        var runned = false;
177
        runs(function() {
178
            car.save({
179
                callback: function(record) {
180
                    originalId = record.getId();
181
                    record.set('name', 'BMW');
182
                    record.save({
183
                        callback: function(record) {
184
                            car = record;
185
                            runned = true;
186
                        }
187
                    })
188
                }
189
            })
190
        });
191
        waitsFor(function() {
192
            return runned;
193
        });
194
        runs(function() {
195
            expect(originalId).toBe(car.getId());
196
            expect(car.get('name')).toBe('BMW');
197
        });
198
    })
199
});
200
describe('Rest Proxy in Store', function() {
201
    var store = Ext.create('Ext.data.Store', {
0 ignored issues
show
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
202
        model: 'Test.TestBundle.Entity.Car',
203
        autoLoad: false,
204
        proxy: {
205
            type: 'rest',
206
            url: '/mycars',
207
            format: 'json'
208
        }
209
    });
210
    it('should load all the entity', function() {
211
        var runned = false;
212
        runs(function() {
213
            var car = Ext.create('Test.TestBundle.Entity.Car', {
0 ignored issues
show
The variable Ext seems to be never declared. If this is a global, consider adding a /** global: Ext */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
214
                name: 'Ford',
215
                plateNumber: 'AA1234',
216
                password: 'xx'
217
            });
218
            car.save({
219
                callback: function() {
220
                    store.load({
221
                        callback: function() {
222
                            runned = true;
223
                        }
224
                    });
225
                }
226
            });
227
        });
228
        waitsFor(function() {
229
            return runned;
230
        });
231
        runs(function() {
232
            expect(store.count()).toBeGreaterThan(0);
233
        })
234
    });
235
    it('should remove all entity', function () {
236
        var runned = false;
237
        runs(function () {
238
            store.load({
239
                callback: function() {
240
                    store.removeAll();
241
                    store.sync({
242
                        callback: function() {
243
                            store.load({
244
                                callback: function() {
245
                                    runned = true;
246
                                }
247
                            })
248
                        }
249
                    })
250
                }
251
            });
252
        });
253
        waitsFor(function () {
254
            return runned;
255
        });
256
        runs(function () {
257
            expect(store.count()).toBe(0);
258
        });
259
    });
260
    it('should add new entity', function () {
261
        var runned = false;
262
        runs(function () {
263
            store.add([
264
                {
265
                    name: 'Ford',
266
                    plateNumber: 'AA1234',
267
                    password: 'xx'
268
                },
269
                {
270
                    name: 'BMW',
271
                    plateNumber: 'ZZ54',
272
                    password: 'xx'
273
                }
274
            ]);
275
            store.sync({
276
                callback: function() {
277
                    runned = true;
278
                }
279
            });
280
        });
281
        waitsFor(function () {
282
            return runned;
283
        });
284
        runs(function () {
285
            expect(store.count()).toBe(2);
286
            expect(store.getNewRecords().length).toBe(0);
287
        });
288
    });
289
});