Benign python Download

forjio-linksnap 0.1.1

Legitimate Python SDK package

“Official Python SDK for LinkSnap — short links, QR codes, click analytics, custom domains, workspaces, and billing with Huudis OIDC device-…”

Declares OIDC provider JWKS URIDeclares OIDC provider authorization endpoint

Evidence

imports httpx lines 8–55
8:27… SDK is configured against.
9"""
10
11from __future__ import annotations
12
13import time
14from dataclasses import dataclass
15from typing import Any, Callable, Dict, Optional
16
17import httpx
18
19from .errors import LinkSnapAuthError, RefreshError
20
21
22@dataclass
23class DiscoveryDocument:
24 issuer: str
25 device_authorization_endpoint: str
26 token_endpoint: str
27 jwks_uri: str
28 authorization_endpoint: Optional[str] = None
29 userinfo_endpoint: Optional[str] = None
30 end_session_endpoint: Optional[str] = None
31
32
33@dataclass
34class DeviceFlowStart:
35 device_code: str
36 user_code: str
37 verification_uri: str
38 expires_in: int
39 interval: int
40 verification_uri_complete: Optional[str] = None
41
42
43@dataclass
44class DeviceTokens:
45 access_token: str
46 expires_at: int # unix epoch seconds
47 token_type: str = "Bearer"
48 refresh_token: Optional[str] = None
49 scope: Optional[str] = None
50
51
52_DISCOVERY_CACHE: Dict[str, DiscoveryDocument] = {}
53
54
55def clear_discovery_cache() -> None:
Service endpoint configuration key lines 78–81
78:67… ry failed: {res.status_code}")
79 payload = res.json()
80 if not payload.get("device_authorization_endpoint") or not payload.get("token_endpoint"):
81 raise LinkSnapAuthError("DISCOVERY_INCOMPLETE", "OIDC discovery missing require …
Declares OIDC provider authorization endpoint lines 82–102
82:27… t(
83 issuer=payload.get("issuer", issuer),
84 device_authorization_endpoint=payload["device_authorization_endpoint"],
85 token_endpoint=payload["token_endpoint"],
86 jwks_uri=payload["jwks_uri"],
87 authorization_endpoint=payload.get("authorization_endpoint"),
88 userinfo_endpoint=payload.get("userinfo_endpoint"),
89 end_session_endpoint=payload.get("end_session_endpoint"),
90 )
91 _DISCOVERY_CACHE[issuer] = doc
⋯4 lines
96 *,
97 issuer: str,
98 client_id: str,
99 scope: Optional[str] = None,
100 http: Optional[httpx.Client] = None,
101) -> DeviceFlowStart:
102 disco = fetch_discove …
Uses URL-encoded HTTP form content lines 105–115
105:19… e"] = scope
106 client = http or _http()
107 try:
108 res = client.post(
109 disco.device_authorization_endpoint,
110 data=body,
111 headers={"content-type": "application/x-www-form-urlencoded"},
112 )
113 except httpx.HTTPError as e:
114 raise LinkSnapAuthError("DEVICE_AUTH_NETWORK_ERROR", str(e)) from e
115 f …
OAuth device code response field lines 120–127
120:14… Dict[str, Any] = res.json()
121 return DeviceFlowStart(
122 device_code=payload["device_code"],
123 user_code=payload["user_code"],
124 verification_uri=payload["verification_uri"],
125 verification_uri_complete=payload.get("verification_uri_complete"),
126 expires_in=int(payload["expires_in"]),
127 interval=int(payload.get("inter …

Showing the top 5 files — 2 more files (13 regions) not shown.

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.