T09 · Insecure Skill Coding Practices
- Location
scripts/dify-workflow.sh:8- Finding
Hardcoded Dify API Bearer Credential
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is purpose-built to query a Dify knowledge base, but it ships a hardcoded API key and sends credentials and user queries to a default HTTP endpoint.
Review before installing. Do not use the packaged default credential; rotate or revoke it, require a user-provided secret, and configure an HTTPS Dify endpoint before sending real internal queries or conversation IDs.
scripts/dify-workflow.sh:8Hardcoded Dify API Bearer Credential
scripts/dify-workflow.sh:115Dify Credentials and Query Data Transmitted over Plaintext HTTP
scripts/dify-workflow.sh:83JSON Request Injection through Unescaped Command-Line Input
The skill describes multi-turn querying and workflow execution against an internal HTTP API but does not warn users that their prompts and conversation IDs/content may be transmitted to another service. This omission is dangerous because users may share sensitive internal data under the assumption it stays local, while the skill forwards it over an internal endpoint with no clear consent or sensitivity notice.
The script embeds a default Dify API key directly in the code and uses it automatically for authenticated requests. Anyone with access to the script can extract and reuse the credential, potentially invoking the remote app, consuming paid resources, accessing protected workflows, or pivoting into connected data sources.
Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.
print("ERROR_NO_ANSWER")
sys.exit(1)
# Extract conversation_id for multi-turn support
conv_id = data.get("conversation_id", "")
# Output using a delimiter that won't appear in normal text
The trigger conditions are overly broad and map ordinary user language to an action that sends content to an internal API, increasing the chance of unintentional activation. In a skill that can transmit prompts and conversation context to a backend service, broad triggers create a security and privacy risk because users may not realize their request is being forwarded externally.
The configuration section shows how to set API credentials but fails to warn that the key is sensitive and must not be exposed, logged, or committed. In combination with the included default key and internal service URL, this normalizes insecure secret handling and increases the likelihood of credential leakage and misuse.
The skill embeds a live default API key directly in documentation/configuration, giving any user of the skill an immediate authenticated capability to an internal Dify service. Hardcoded credentials are dangerous because they can be copied, reused outside intended scope, and remain valid long after the skill is distributed, enabling unauthorized access to internal knowledge bases or workflows.
This curl invocation sends data and a bearer token to an external service, and the configured default endpoint is an internal-looking IP over unencrypted HTTP. In the context of an agent skill, that is dangerous because arbitrary user input is exfiltrated off-host and authentication material may be exposed in transit or misused by the remote service.
# Execute request with timeout
echo "" >&2
echo "🚀 Sending request..." >&2
RESPONSE=$(curl -s -X POST "$ENDPOINT" \
-H "Authorization: Bearer ${DIFY_API_KEY}" \
-H "Content-Type: application/json" \
--max-time "$DEFAULT_TIMEOUT" \
The script transmits user-supplied query content and optional conversation context to a remote endpoint by default, and the default base URL uses plain HTTP rather than HTTPS. This creates both a privacy risk from undisclosed data sharing and a transport-security risk, because sensitive prompts and conversation IDs may be intercepted or logged by intermediaries.
The usage examples are exclusively written with Chinese query phrases such as '你好' and '如何部署?', which signals a language-specific default interaction pattern. There is no accompanying note that other languages are supported or that Chinese is merely illustrative, so this can be read as an implicit language preference without user opt-in.