T09 · Insecure Skill Coding Practices
- Location
adapters/gitlab_adapter.py:25- Finding
GitLab access token can be transmitted to an arbitrary or plaintext endpoint
- Content
View full analysis
list: """Paginated GET helper. Returns all results across pages.""" results: list = [] params = params or {} params.setdefault("per_page", 100) page = 1 while True: params["page"] = page try: resp = requests.get( f"{self.url}/api/v4{path}", headers=self.headers, params=params, timeout=30, ) resp.raise_for_status() ``` The same behavior is present in the API connection check at `em_intel.py:135-143`. ### Technical Analysis `GITLAB_URL` is accepted without validating its scheme, hostname, port, or destination. The application then attaches the GitLab personal access token as a `PRIVATE-TOKEN` header to requests made to that configured URL. A configuration mistake or malicious modification of `.env` can therefore redirect the credential-bearing request to an attacker-controlled server. The code also permits an `http://` URL, allowing the token and returned project information to traverse the network without transport encryption. Although configurable GitLab endpoints are needed to support self-hosted GitLab installations, sending credentials to an unrestricted URL exceeds safe endpoint configurability. ### Attack Path 1. An attacker modifies `.env`, supplies a deceptive setup value, or convinces the user to configure `GITLAB_URL` as an attacker-controlled endpoint. 2. The user runs `doctor`, `morning-brief`, `team-report`, or ...[truncated 613 chars]- Remediation
View remediation
