T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/agent2rss.sh:68
- Finding
- Dry-run mode exposes bearer tokens and submitted content<![CDATA[ ## Vulnerability Details **File Location**: `scripts/agent2rss.sh:68-74`; sensitive call sites at `scripts/agent2rss.sh:176-179`, `197-200`, `217-220`, and `241-244` **Vulnerability Type**: Sensitive information exposure through diagnostic output **Risk Level**: Medium ### Vulnerable Code ```bash http_call() { if [ "${DRY_RUN:-0}" = "1" ]; then echo "[DRY_RUN] curl $*" return 0 fi curl "$@" } ``` Authenticated operations pass secrets and content directly to this function. For example: ```bash http_call -fsS -X POST "$(channel_posts_url "$cid")" \ -H "Authorization: Bearer $token" \ -H 'Content-Type: application/json' \ -d "$data" ``` ### Technical Analysis The dry-run implementation serializes every `curl` argument using `$*` without redacting sensitive values. Arguments can include: - `Authorization: Bearer ...` headers containing reusable channel tokens. - Complete JSON article bodies and associated metadata. - Idempotency keys. - Local paths of files selected for upload. Although dry-run mode does not transmit the request, it prints the complete authentication material and payload to standard output. Standard output is frequently retained in CI logs, agent transcripts, terminal capture systems, debugging records, or centralized log platforms. Because the exposed bearer token is sufficient for authenticated channel operations, this is more than informational metadata leakage. ### Attack Path 1. A user or automated workflow enables the documented `DRY_RUN=1` mode to preview an operation. 2. The workflow invokes `update-channel`, `push-file`, or `push-json`. 3. The operation passes its bearer token and request data to `http_call`. 4. `http_call` prints every argument without sanitization. 5. A user, process, CI participant, or log-system operator with access to the captured output obtains the token. 6. The exposed token is reused to update the associated channel or publish content through the Agent2RSS API. ### Impact ...[truncated 511 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Never print raw `curl` argument arrays when they may contain credentials or request bodies. - Replace bearer token values with a fixed marker such as `Authorization: Bearer [REDACTED]`. - Omit or summarize values supplied through `-d`, `--data`, `--data-binary`, and `-F`. - Redact local upload paths if paths may contain sensitive names. - Implement dry-run output as structured data containing only: - HTTP method. - Sanitized destination URL. - Content type. - Names of submitted fields. - Payload size or file size. - Ensure tests verify that representative tokens and article content never appear in dry-run output. - Rotate any channel tokens that may already have been captured in logs. ]]>
