T09 · Insecure Skill Coding Practices
- Location
scripts/publish.js:97- Finding
Post publication and image upload proceed without code-enforced confirmation
- Content
View full analysis
Vulnerability Details
File Location:
scripts/publish.js:97-100, 114-175
Vulnerability Type: Missing confirmation gate for public publication
Risk Level: MediumVulnerable Code
js const [, , htmlPath] = process.argv; if (!htmlPath) { console.error('Usage: node publish.js <html-file-path>'); process.exit(1); } let content = fs.readFileSync(htmlPath, 'utf-8'); console.log(`Content length: ${content.length} chars`);js // Deferred local-image upload: this is the ONLY moment the images // leave the user's machine (compose.js keeps everything local). try { content = await uploadLocalImages(content, htmlPath); } catch (err) { if (err instanceof SessionExpiredError) { console.error(`❌ ${err.message}`); process.exitCode = 2; return; } console.error(`\n❌ Image upload failed: ${err.message}`); console.error(' Nothing was posted. Fix the issue and re-run publish.js ' + '(already-uploaded images are reused, not re-uploaded).'); process.exitCode = 1; return; }js const postData = { type: 'text', content, ...(locInfo ? { lng: locInfo.lng, lat: locInfo.lat, locationName: locInfo.name, isLocationExposed: true, } : { isLocationExposed: false }), }; console.log('\nPublishing...'); try { const post = await publishWithRetry(postData);Technical Analysis
SKILL.mdrequires the Agent to show a preview and obtain an explicit publication decision before posting. However, this control exists only as an instruction to the Agent. The executable entry point accepts only an HTML path and does not require a confirmation flag, one-time token, preview digest, or interactive approval.Once invoked with a valid stored session, the script immediately processes the draft. If the draft contains
powpow-local://Nreferences, it uploads the corresponding local files before submitting the post. It then sends the content toPOST /api/posts, publishing it u ...[truncated 1392 chars]- Remediation
View remediation
Remediation Suggestions
- Require a non-default confirmation argument, such as
--confirm-publish <token>, before any upload or publication occurs. - Generate the token only after displaying the final account, content digest, image list, location, and public-map status.
- Bind the token to:
- The authenticated account ID.
- A cryptographic digest of the final HTML.
- A digest of the image manifest.
- The selected location and exposure setting.
- A short expiration time.
- Validate the token before calling
uploadLocalImages, ensuring that unconfirmed execution cannot upload local files. - Alternatively, require an interactive confirmation when attached to a terminal and reject non-interactive execution unless a valid confirmation token is supplied.
- Preserve the server-side authentication, moderation, and rate-limit controls as defense in depth.
- Require a non-default confirmation argument, such as
