T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/src/cli.ts:1686
- Finding
- Element Authorization Token Disclosed Through Standard Output<![CDATA[ ## Vulnerability Details **File Location**: `scripts/src/cli.ts:1686-1707` **Vulnerability Type**: Sensitive authentication-token disclosure **Risk Level**: Medium ### Vulnerable Code ```ts const authorization = payload.authorization ?? ( await createAuthorization(payload.chainMId) ).authorization; const result = await postCreateCollectionFlow( { chainMId: payload.chainMId, contractAddress: payload.contractAddress, authorization, imageFilePath: payload.imageFilePath ?? payload.preReveal, pollIntervalMs: payload.pollIntervalMs, timeoutMs: payload.timeoutMs }, { getCollectionContract: graphql.getCollectionContract, getMutateToken: graphql.getMutateToken, getCollectionDetailFromEditors: graphql.getCollectionDetailFromEditors, collectionEdit: graphql.collectionEdit } ); console.log(JSON.stringify({ authorization, ...result }, null, 2)); ``` ### Technical Analysis The `post-create-collection` command obtains or accepts an Element authorization token and then includes that token in its JSON output. Authorization tokens are bearer credentials: possession may be sufficient to perform authenticated actions without access to the wallet private key. Writing the token to standard output exposes it beyond the minimum scope required for the workflow. Standard output may be retained in terminal scrollback, Agent transcripts, CI logs, shell automation output, monitoring systems, or redirected files. This also conflicts with the Skill's reporting contract, which calls for user-visible lifecycle results rather than internal authentication material. The raw wallet private key is not disclosed by this code, but protection of the key does not mitigate reuse of an already-issued session token. ### Attack Path 1. A user or automated Agent invokes the `post-create-collection` command. 2. The command creates or receives an Element authorization token. 3. The command serializes the token under the `authorization ...[truncated 1059 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the authorization token from command output: ```ts console.log(JSON.stringify(result, null, 2)); ``` 2. Keep authorization material internal to the workflow and never include it in user-facing result objects. 3. Add recursive output sanitization that removes or masks fields such as `authorization`, `token`, `security_token`, cookies, signatures, and API keys before serialization. 4. Extend `redactKnownSecrets` so it protects temporary authorization and mutation tokens in addition to the wallet private key. 5. Add regression tests that inject a known token and verify it never appears in standard output, standard error, thrown errors, or structured logs. 6. If tokens previously appeared in retained logs, remove those logs where feasible and invalidate affected sessions. ]]>
