T09 · Insecure Skill Coding Practices
- Location
scripts/bokatvattid.py:45- Finding
Debug Mode Logs Unredacted Authentication Tokens and Account Data
- Content
View full analysis
Vulnerability Details
File Location:
scripts/bokatvattid.py, lines 45–46 and 58–59
Vulnerability Type: Sensitive information exposure through diagnostic logging
Risk Level: MediumVulnerable code in
_get:python if os.environ.get("BOKA_DEBUG"): print(json.dumps(d, ensure_ascii=False)[:2000], file=sys.stderr)Vulnerable code in
_post:python if os.environ.get("BOKA_DEBUG"): print(json.dumps(d, ensure_ascii=False)[:2000], file=sys.stderr)Technical Analysis
The
_getand_postfunctions serialize API responses without redaction and write up to 2,000 characters to standard error whenever the inheritedBOKA_DEBUGenvironment variable is set.This includes the response to the
checkLogin2authentication request. The project API reference documents that this response contains an authenticationTokenandApartmentID. Other API responses may contain user identifiers, apartment-related information, room details, and current booking records.Truncating the serialized response does not provide effective protection because authentication tokens and identifiers may occur near the beginning of the response. Standard error is also commonly captured by agent runtimes, CI systems, terminal recording, centralized logging, and diagnostic reports.
The network transmission itself is necessary for the declared remote booking functionality and is restricted to fixed HTTPS service endpoints. The vulnerability is the unnecessary secondary disclosure of returned sensitive data through logs.
Attack Path
- A user, parent process, CI configuration, or agent execution environment sets
BOKA_DEBUGto any non-empty value. - The CLI performs the normal login operation using the user's building ID, apartment number, and PIN.
- The remote service returns a response containing an authentication token and account identifier.
_postserializes the complete response with ...[truncated 1094 chars]
- A user, parent process, CI configuration, or agent execution environment sets
- Remediation
View remediation
Remediation Suggestions
- Remove complete response-body logging from both
_getand_post. - If diagnostic logging is required, log only non-sensitive metadata such as the request method, destination host, HTTP status, API error code, response size, and elapsed time.
- Apply recursive redaction before serializing any structured response. At minimum, redact keys such as
Token,token,pincode,PIN,ApartmentID,apartmentID,userid, and fields containing booking or resident information. - Use an allowlist of fields safe to log rather than relying only on a denylist.
- Replace activation through an arbitrary inherited environment variable with an explicit diagnostic option and display a warning when sensitive operations are performed in debug mode.
- Ensure test, CI, agent, and production environments do not enable
BOKA_DEBUGby default. - Review existing logs for exposed tokens or account data, restrict log access, securely delete unnecessary copies, and invalidate affected sessions where feasible.
- Remove complete response-body logging from both
