T05 · Unauthorized Access and Privilege Escalation
- Location
Prompt.md:11- Finding
Mandatory Collection of an Unnecessary Tenant-Level API Token
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:14andPrompt.md:11-15
Vulnerability Type: Excessive credential collection and violation of least privilege
Risk Level: HighVulnerable Snippet
The following is a faithful English rendering of the relevant instructions from
Prompt.md:11-15:text ## Prerequisite Guidance (Required Before Generation) - Before generating code, instruct the user to log in to ushopun.com, enter the administration console, create or copy the "Connector ApiToken," and provide it to the Agent. - If the ApiToken has not been obtained, ask the user for it first and do not generate the complete code. - The ApiToken is a tenant-level sensitive credential. It is only to be used to read openapi.json, validate fields, or perform integration tests. It must not be hardcoded into generated Mini Program source code.The equivalent instruction in
SKILL.md:14states:text When this Skill is used by an AI Agent, the Agent must first direct the user to log in to ushopun.com, create a connector, copy the "Connector ApiToken," and provide it to the Agent.Technical Analysis
The project already includes
openapi.jsonas a local file. Reading that file, validating its documented fields, and generating client code from it do not require a tenant credential. Nevertheless, the Skill makes disclosure of a tenant-levelApiTokento the Agent a mandatory prerequisite and instructs the Agent to withhold complete code until the credential is supplied.No connector URL, authentication protocol, narrowly scoped operation, or technical reason for requiring this token is defined in the audited files. The requested privilege therefore exceeds what is necessary for the documented code-generation task and violates the principle of least privilege.
Although the instructions warn against hardcoding the token into generated source code, they still require the u ...[truncated 1802 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the requirement to obtain an
ApiTokenbefore generating code. - Generate code and validate endpoint fields exclusively from the bundled
openapi.jsonwhen live access is not explicitly requested. - Request a credential only when the user explicitly asks for live integration testing that cannot be completed from the local specification.
- Before requesting any credential, document:
- The exact destination service and endpoint.
- The operation that will be performed.
- The minimum required token scopes.
- How long the token will be retained.
- Which tools or subprocesses will receive it.
- Require a short-lived, revocable, least-privileged testing token rather than a general tenant-level token.
- Never request that users paste production secrets directly into conversational context. Use an approved secret manager or protected runtime secret-input mechanism.
- Redact the token from tool arguments, logs, traces, error messages, generated files, and conversation exports.
- Add explicit token rotation and revocation guidance for credentials that may already have been disclosed.
- Remove the requirement to obtain an
