This file is indexed.

/usr/lib/python3/dist-packages/social/tests/backends/test_steam.py is in python3-social-auth 1:0.2.21+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import json
import datetime

from httpretty import HTTPretty

from social.p3 import urlencode
from social.exceptions import AuthFailed

from social.tests.backends.open_id import OpenIdTest


INFO_URL = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?'
JANRAIN_NONCE = datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ')


class SteamOpenIdTest(OpenIdTest):
    backend_path = 'social.backends.steam.SteamOpenId'
    expected_username = 'foobar'
    discovery_body = ''.join([
      '<?xml version="1.0" encoding="UTF-8"?>',
      '<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">',
      '<XRD>',
      '<Service priority="0">',
      '<Type>http://specs.openid.net/auth/2.0/server</Type>',
      '<URI>https://steamcommunity.com/openid/login</URI>',
      '</Service>',
      '</XRD>',
      '</xrds:XRDS>'
    ])
    user_discovery_body = ''.join([
      '<?xml version="1.0" encoding="UTF-8"?>',
      '<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">',
      '<XRD>',
      '<Service priority="0">',
      '<Type>http://specs.openid.net/auth/2.0/signon</Type>		',
      '<URI>https://steamcommunity.com/openid/login</URI>',
      '</Service>',
      '</XRD>',
      '</xrds:XRDS>'
    ])
    server_response = urlencode({
        'janrain_nonce': JANRAIN_NONCE,
        'openid.ns': 'http://specs.openid.net/auth/2.0',
        'openid.mode': 'id_res',
        'openid.op_endpoint': 'https://steamcommunity.com/openid/login',
        'openid.claimed_id': 'https://steamcommunity.com/openid/id/123',
        'openid.identity': 'https://steamcommunity.com/openid/id/123',
        'openid.return_to': 'http://myapp.com/complete/steam/?'
                            'janrain_nonce=' + JANRAIN_NONCE,
        'openid.response_nonce':
            JANRAIN_NONCE + 'oD4UZ3w9chOAiQXk0AqDipqFYRA=',
        'openid.assoc_handle': '1234567890',
        'openid.signed': 'signed,op_endpoint,claimed_id,identity,return_to,'
                         'response_nonce,assoc_handle',
        'openid.sig': '1az53vj9SVdiBwhk8%2BFQ68R2plo=',
    })
    player_details = json.dumps({
        'response': {
            'players': [{
                'steamid': '123',
                'primaryclanid': '1234',
                'timecreated': 1360768416,
                'personaname': 'foobar',
                'personastate': 0,
                'communityvisibilitystate': 3,
                'profileurl': 'http://steamcommunity.com/profiles/123/',
                'avatar': 'http://media.steampowered.com/steamcommunity/'
                          'public/images/avatars/fe/fef49e7fa7e1997310d7'
                          '05b2a6158ff8dc1cdfeb.jpg',
                'avatarfull': 'http://media.steampowered.com/steamcommunity/'
                              'public/images/avatars/fe/fef49e7fa7e1997310d7'
                              '05b2a6158ff8dc1cdfeb_full.jpg',
                'avatarmedium': 'http://media.steampowered.com/steamcommunity/'
                                'public/images/avatars/fe/fef49e7fa7e1997310d7'
                                '05b2a6158ff8dc1cdfeb_medium.jpg',
                'lastlogoff': 1360790014
            }]
        }
    })

    def _login_setup(self, user_url=None):
        self.strategy.set_settings({
            'SOCIAL_AUTH_STEAM_API_KEY': '123abc'
        })
        HTTPretty.register_uri(HTTPretty.POST,
                               'https://steamcommunity.com/openid/login',
                               status=200,
                               body=self.server_response)
        HTTPretty.register_uri(
            HTTPretty.GET,
            user_url or 'https://steamcommunity.com/openid/id/123',
            status=200,
            body=self.user_discovery_body
        )
        HTTPretty.register_uri(HTTPretty.GET,
                               INFO_URL,
                               status=200,
                               body=self.player_details)

    def test_login(self):
        self._login_setup()
        self.do_login()

    def test_partial_pipeline(self):
        self._login_setup()
        self.do_partial_pipeline()


class SteamOpenIdMissingSteamIdTest(SteamOpenIdTest):
    server_response = urlencode({
        'janrain_nonce': JANRAIN_NONCE,
        'openid.ns': 'http://specs.openid.net/auth/2.0',
        'openid.mode': 'id_res',
        'openid.op_endpoint': 'https://steamcommunity.com/openid/login',
        'openid.claimed_id': 'https://steamcommunity.com/openid/BROKEN',
        'openid.identity': 'https://steamcommunity.com/openid/BROKEN',
        'openid.return_to': 'http://myapp.com/complete/steam/?'
                            'janrain_nonce=' + JANRAIN_NONCE,
        'openid.response_nonce':
            JANRAIN_NONCE + 'oD4UZ3w9chOAiQXk0AqDipqFYRA=',
        'openid.assoc_handle': '1234567890',
        'openid.signed': 'signed,op_endpoint,claimed_id,identity,return_to,'
                         'response_nonce,assoc_handle',
        'openid.sig': '1az53vj9SVdiBwhk8%2BFQ68R2plo=',
    })

    def test_login(self):
        self._login_setup(user_url='https://steamcommunity.com/openid/BROKEN')
        with self.assertRaises(AuthFailed):
            self.do_login()

    def test_partial_pipeline(self):
        self._login_setup(user_url='https://steamcommunity.com/openid/BROKEN')
        with self.assertRaises(AuthFailed):
            self.do_partial_pipeline()