T09 · Insecure Skill Coding Practices
- Location
scripts/buymeapie_api.py:156- Finding
Arbitrary API base URL can disclose reusable account credentials
- Content
View full analysis
Any: url = f"{self.base_url}{path}" if params: query = urllib.parse.urlencode(params) url = f"{url}?{query}" body = None headers = dict(self.headers) if payload is not None: body = json.dumps(payload).encode("utf-8") headers["Content-Type"] = "application/json" request = urllib.request.Request(url, data=body, headers=headers, method=method.upper()) try: with urllib.request.urlopen(request, timeout=self.timeout) as response: return parse_json(response.read()) ``` ```python parser.add_argument("--login", default=os.getenv("BUYMEAPIE_LOGIN"), help="Buy Me a Pie login") parser.add_argument("--pin", default=os.getenv("BUYMEAPIE_PIN"), help="Buy Me a Pie PIN") parser.add_argument("--base-url", default=DEFAULT_BASE_URL, help="API base URL") parser.add_argument("--timeout", type=int, default=15, help="HTTP timeout in seconds") ``` ```python client = BuyMeAPieClient(login=login, pin=pin, base_url=args.base_url, tim ...[truncated 2327 chars]- Remediation
View remediation
