T09 · Insecure Skill Coding Practices
- Location
scripts/job-code.mjs:5- Finding
Purge confirmation code does not bind the complete deletion scope
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is openly designed for Discord cleanup, but its destructive Discord deletion features have under-scoped confirmation checks that could allow broader deletion than the preview implied.
Review before installing. Use a least-privileged Discord bot token, prefer DISCORD_BOT_TOKEN over --token, test with dry runs, and do not rely on the provided confirmation codes as strong proof that the exact previewed deletion scope is what will run. Avoid nuke mode with --delete-old unless you are prepared for irreversible loss of the original channel.
scripts/job-code.mjs:5Purge confirmation code does not bind the complete deletion scope
scripts/purge-nuke.mjs:57Nuke confirmation does not distinguish cloning from deletion of the original channel
scripts/purge-runner.mjs:123Message purge runner does not enforce the documented guild-channel restriction
scripts/common.mjs:68Bot token command-line option can expose credentials to local process inspection and shell history
Referenced artifact was not completely inspected
- Run `purge-preview.mjs` first for every destructive request.
Referenced artifact was not completely inspected
- Run `purge-preview.mjs` first for every destructive request.
Referenced artifact was not completely inspected
- Run `purge-preview.mjs` first for every destructive request.
Referenced artifact was not completely inspected
- Run `purge-preview.mjs` first for every destructive request.
Referenced artifact was not completely inspected
node scripts/purge-runner.mjs \
Referenced artifact was not completely inspected
node scripts/purge-runner.mjs \
Referenced artifact was not completely inspected
node scripts/purge-runner.mjs \
Referenced artifact was not completely inspected
node scripts/purge-nuke.mjs --channel-id 123456789012345678 --confirm "NUKE-XXXXXXXX" --out ./tmp/nuke.json
Referenced artifact was not completely inspected
node scripts/purge-nuke.mjs --channel-id 123456789012345678 --confirm "NUKE-XXXXXXXX" --out ./tmp/nuke.json
Referenced artifact was not completely inspected
node scripts/purge-nuke.mjs --channel-id 123456789012345678 --confirm "NUKE-XXXXXXXX" --out ./tmp/nuke.json
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
## Core Endpoints
- List messages: `GET /channels/{channel.id}/messages`
- Delete one message: `DELETE /channels/{channel.id}/messages/{message.id}`
- Bulk delete: `POST /channels/{channel.id}/messages/bulk-delete`
- Get channel: `GET /channels/{channel.id}`
- Create guild channel: `POST /guilds/{guild.id}/channels`
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
- Bulk delete: `POST /channels/{channel.id}/messages/bulk-delete`
- Get channel: `GET /channels/{channel.id}`
- Create guild channel: `POST /guilds/{guild.id}/channels`
- Delete channel: `DELETE /channels/{channel.id}`
## Bulk Delete Rules
The bulkDeleteMessages and deleteMessage helpers perform irreversible deletion of Discord messages, yet there is no confirmation prompt, user-facing notice, or inline documentation warning about the destructive effect. Code-file guidance calls for disclosure around destructive or irreversible operations when no other warning is present.
The deleteChannel function issues a DELETE request that can permanently remove a Discord channel, but the file contains no confirmation prompt, user-facing log, or explanatory comment/docstring disclosing that destructive action. This matches the missing-warning criterion for destructive or irreversible operations in code files.
This code performs authenticated HTTP requests to the Discord API using a token in the Authorization header and may send request bodies, but the file provides no confirmation prompt, user-facing log, or explanatory comment/docstring warning that external network transmission occurs. For a code file, network calls that transmit user or system data should have some visible disclosure unless clearly documented elsewhere.
resolveToken reads DISCORD_BOT_TOKEN from the environment, which is access to sensitive credential material. This file does not include any user-facing notice, comment, or docstring explaining that the skill may obtain authentication data from environment variables.
The writeJson helper creates directories and writes JSON to an arbitrary resolved path, which is a safety-relevant file modification operation. In this file there is no confirmation prompt, user-facing log/print, or explanatory comment/docstring disclosing that behavior.
This function calls fetchMessagesPage with a token and channel ID to retrieve message data from an external service, which is a network operation involving potentially sensitive user or system data. In this file there is no confirmation prompt, logging, comment, or docstring disclosing that message content will be fetched and scanned.