Issues (38)

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/PlayerTest.php (4 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
<?php
2
3
require_once('BaseTester.php');
4
5
/** @group Player */
6
class PlayerTest extends BaseTester {
0 ignored issues
show
There is at least one abstract method in this class. Maybe declare it as abstract, or implement the remaining methods: artisan, be, call, seed
Loading history...
7
8
    /** @test */
9
    public function it_gets_the_steam_level_by_user_id()
10
    {
11
        $steamLevel = $this->steamClient->player($this->id64)->GetSteamLevel();
12
13
        $this->assertIsInt($steamLevel);
14
    }
15
16
    /** @test */
17
    public function it_gets_the_player_details_by_user_id()
18
    {
19
        $details = $this->steamClient->player($this->id64)->GetPlayerLevelDetails();
20
21
        $this->assertInstanceOf('Syntax\SteamApi\Containers\Player\Level', $details);
22
23
        $attributes = [
24
            'playerXp', 'playerLevel', 'xpToLevelUp', 'xpForCurrentLevel', 'currentLevelFloor',
25
            'currentLevelCeiling', 'percentThroughLevel'
26
        ];
27
        $this->assertObjectHasAttributes($attributes, $details);
28
    }
29
30
    /** @test */
31
    public function it_gets_the_badges_by_user_id()
32
    {
33
        $badges = $this->steamClient->player($this->id64)->GetBadges();
34
35
        $attributes = ['badges', 'player_xp', 'player_level', 'player_xp_needed_to_level_up', 'player_xp_needed_current_level'];
36
        $this->assertObjectHasAttributes($attributes, $badges);
37
38
        $attributes = ['badgeid', 'level', 'completion_time', 'xp', 'scarcity'];
39
        $this->assertObjectHasAttributes($attributes, $badges->badges[0]);
40
    }
41
42
    /** @test */
43
    public function it_gets_the_badge_progress_by_user_id()
44
    {
45
        $progress = $this->steamClient->player($this->id64)->GetCommunityBadgeProgress();
46
47
        $this->assertObjectHasAttribute('quests', $progress);
48
49
        $attributes = ['questid', 'completed'];
50
        $this->assertObjectHasAttributes($attributes, $progress->quests[0]);
51
    }
52
53
    /** @test */
54 View Code Duplication
    public function it_gets_the_owned_games_by_user_id()
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...
55
    {
56
        $games = $this->steamClient->player($this->id64)->GetOwnedGames();
57
58
        $this->assertInstanceOf('Illuminate\Support\Collection', $games);
59
        $this->assertInstanceOf('Syntax\SteamApi\Containers\Game', $games->first());
60
61
        $attributes = [
62
            'appId', 'name', 'playtimeTwoWeeks', 'playtimeTwoWeeksReadable', 'playtimeForever', 'playtimeForeverReadable',
63
            'icon', 'logo', 'header', 'hasCommunityVisibleStats'
64
        ];
65
        $this->assertObjectHasAttributes($attributes, $games->first());
66
    }
67
68
    /** @test */
69
    public function it_gets_the_owned_games_by_user_id_without_app_details()
70
    {
71
        $games = $this->steamClient->player($this->id64)->GetOwnedGames(false);
72
73
        $this->assertInstanceOf('Illuminate\Support\Collection', $games);
74
        $this->assertInstanceOf('Syntax\SteamApi\Containers\Game', $games->first());
75
76
        $attributes = [
77
            'appId', 'name', 'playtimeTwoWeeks', 'playtimeTwoWeeksReadable', 'playtimeForever', 'playtimeForeverReadable',
78
            'icon', 'logo', 'header', 'hasCommunityVisibleStats'
79
        ];
80
        $this->assertObjectHasAttributes($attributes, $games->first());
81
82
        $this->assertNull($games->first()->name);
83
        $this->assertNull($games->first()->icon);
84
        $this->assertNull($games->first()->logo);
85
    }
86
87
    /** @test */
88
    public function it_filters_the_owned_games_by_user_id()
89
    {
90
        $games = $this->steamClient->player($this->id64)->GetOwnedGames(true, false, $this->appId);
0 ignored issues
show
$this->appId is of type integer, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
91
92
        $this->assertInstanceOf('Illuminate\Support\Collection', $games);
93
        $this->assertInstanceOf('Syntax\SteamApi\Containers\Game', $games->first());
94
        $this->assertEquals(1, $games->count());
95
96
        $attributes = [
97
            'appId', 'name', 'playtimeTwoWeeks', 'playtimeTwoWeeksReadable', 'playtimeForever', 'playtimeForeverReadable',
98
            'icon', 'logo', 'header', 'hasCommunityVisibleStats'
99
        ];
100
        $this->assertObjectHasAttributes($attributes, $games->first());
101
    }
102
103
    /** @test */
104 View Code Duplication
    public function it_gets_recently_played_games_by_user_id()
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...
105
    {
106
        $games = $this->steamClient->player($this->id64)->GetRecentlyPlayedGames();
107
108
        $this->assertInstanceOf('Illuminate\Support\Collection', $games);
109
        $this->assertInstanceOf('Syntax\SteamApi\Containers\Game', $games->first());
110
111
        $attributes = [
112
            'appId', 'name', 'playtimeTwoWeeks', 'playtimeTwoWeeksReadable', 'playtimeForever', 'playtimeForeverReadable',
113
            'icon', 'logo', 'header', 'hasCommunityVisibleStats'
114
        ];
115
        $this->assertObjectHasAttributes($attributes, $games->first());
116
    }
117
118
    /** @test */
119
    public function it_gets_a_single_recently_played_game_by_user_id()
120
    {
121
        $games = $this->steamClient->player($this->id64)->GetRecentlyPlayedGames(1);
122
123
        $this->assertInstanceOf('Illuminate\Support\Collection', $games);
124
        $this->assertInstanceOf('Syntax\SteamApi\Containers\Game', $games->first());
125
        $this->assertEquals(1, $games->count());
126
127
        $attributes = [
128
            'appId', 'name', 'playtimeTwoWeeks', 'playtimeTwoWeeksReadable', 'playtimeForever', 'playtimeForeverReadable',
129
            'icon', 'logo', 'header', 'hasCommunityVisibleStats'
130
        ];
131
        $this->assertObjectHasAttributes($attributes, $games->first());
132
    }
133
134
    /** @test */
135
    public function it_checks_if_playing_a_shared_game_by_user_and_app_id()
136
    {
137
        $playingSharedGame = $this->steamClient->player($this->id64)->IsPlayingSharedGame($this->appId);
138
139
        $this->assertNotNull($playingSharedGame);
140
    }
141
}
142