Back to skill

Security audit

Node.js Project Architecture

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Node.js architecture skill, but it broadly encourages generated admin/config patterns that can expose secrets and change live application settings.

Install only if you want this opinionated architecture guidance and will review generated admin/config code before use. Do not ship its admin dashboard or config examples as-is in production: keep secrets out of config.json, expose only allowlisted public config, use proper authentication and authorization, validate all config updates, audit changes, and make restore/write actions explicit and reversible.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:44
Finding

Public Configuration Endpoint Can Expose Nested Third-Party Credentials

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:44-50
Related Locations: README.md:123-128, references/tool.md:122-138
Vulnerability Type: Improper removal of sensitive data before transmission
Risk Level: High

Vulnerable Code

The universal configuration pattern uses a shallow copy and removes only the admin property:

javascript
// Server: load and serve config
const config = JSON.parse(fs.readFileSync('./config.json', 'utf8'));
app.get('/api/config', (req, res) => {
  const safe = { ...config };
  delete safe.admin; // strip secrets
  res.json(safe);
});

The recommended data-tool configuration places other credentials outside the removed admin property:

json
{
  "app": { "name": "Project Name", "port": 3456 },
  "schedule": {
    "enabled": true,
    "interval": "*/30 * * * *",
    "retryCount": 3
  },
  "api": { "rateLimit": 100, "timeout": 30000 },
  "thirdParty": {
    "feishu": { "appId": "", "appSecret": "" }
  },
  "admin": { "password": "xxx" }
}

The associated rules state:

text
- All tunable params in config.json
- Server loads at startup, serves `/api/config` (strip secrets)
- Admin dashboard hot-reloads config (no restart needed)
- Secrets never exposed to frontend

Technical Analysis

The public endpoint uses a shallow object spread and then deletes only safe.admin. This operation does not remove sensitive values in other top-level or nested properties. In the recommended configuration structure, thirdParty.feishu.appSecret remains present and is therefore serialized by res.json(safe).

The design also permits arbitrary future credentials to be added to config.json, while the public filtering logic relies on a denylist containing only one known property. Any API key, token, webhook credential, database connection string, or integration secret stored under another property can consequently be return ...[truncated 1664 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace denylist-based filtering with an explicit allowlist of public properties:

    javascript
    app.get('/api/config', function(req, res) {
      res.json({
        app: {
          name: config.app.name
        },
        gameplay: config.gameplay,
        difficulty: config.difficulty,
        rewards: config.rewards,
        social: config.social
      });
    });
    
  2. Maintain separate server and client configuration objects or files. Sensitive server configuration must never pass through frontend serialization code.

  3. Store credentials in environment variables or a dedicated secret manager rather than in the hot-reloadable general configuration file.

  4. Validate public configuration against a strict schema that rejects unknown fields.

  5. Add automated tests that seed every known secret field with sentinel values and verify that none appear in /api/config responses.

  6. Ensure application logs, error responses, backup files, and admin API responses also redact secrets.

  7. Rotate any credential that may already have been returned by a deployed endpoint.

T09 · Insecure Skill Coding Practices

Warning
Location
docs/Config-Pattern.md:6
Finding

Architecture Prescribes Plaintext Reusable Administrator Passwords

Content
View full analysis

Vulnerability Details

File Location: docs/Config-Pattern.md:6-11
Related Locations: references/tool.md:127-130, SKILL.md:63-67, docs/Admin-Dashboard.md:3-19, references/game.md:65-76
Vulnerability Type: Plaintext storage and transmission model for administrative credentials
Risk Level: Medium

Vulnerable Configuration and Authentication Guidance

The documented configuration stores the administrator password directly:

json
{
  "app": { "name": "Project", "port": 3000 },
  "gameplay": { "dropRate": 0.08, "maxLevel": 50 },
  "admin": { "password": "secret" }
}

The prescribed dashboard authentication mechanism is:

text
Every project includes `admin.html` with:

1. **Password login** — `x-admin-password` header auth
2. **Config editor** — Visual form auto-generated from config.json structure
3. **Hot-reload** — Save = immediate effect, no restart
4. **Stats overview** — Users, data volume, uptime
5. **Backup history** — Auto-backup before each save, one-click restore

The protected operations include:

text
GET  /admin/config          ← Read current config
POST /admin/config          ← Update (auto-backup old)
GET  /admin/config/history  ← List backups
POST /admin/config/restore  ← Restore from backup
GET  /admin/stats           ← Project statistics

Technical Analysis

The Skill recommends storing a reusable administrator password as plaintext in config.json and presenting it on requests through the custom x-admin-password header. It does not prescribe password hashing, an external secret store, TLS enforcement, credential rotation, rate limiting, lockout controls, short-lived sessions, or constant-time credential comparison.

Plaintext configuration makes the original password recoverable from the active file and potentially from the automatically generated backup. Because the password controls configuration hot-reload and restoratio ...[truncated 2291 chars]

Remediation
View remediation

Remediation Suggestions

  1. Do not store the administrator's plaintext password in config.json.
  2. Prefer an established identity provider or an authenticated reverse proxy with role-based access control.
  3. If password authentication is necessary:
    • Store only an Argon2id or bcrypt password hash.
    • Load the hash from an environment variable or secret manager.
    • Compare derived values using a vetted authentication library.
    • Never write the credential or hash through the generic configuration editor.
  4. Require HTTPS and reject administrative requests received through insecure transport.
  5. Exchange the password for a short-lived, securely generated session token rather than transmitting the reusable password on every request.
  6. Add rate limiting, progressive delays, temporary lockout, credential rotation, and failed-login monitoring.
  7. Restrict administrative endpoints by network policy where practical.
  8. Apply a strict schema and field-level authorization to configuration updates; do not persist req.body wholesale.
  9. Exclude secrets from configuration backups and secure backup files with restrictive filesystem permissions.
  10. Prevent reverse proxies and application telemetry from logging authentication headers, and explicitly redact x-admin-password if legacy compatibility requires retaining it.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (10)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README recommends an admin dashboard with live config editing, backup history, and one-click restore, but gives little warning about the risks of changing production configuration or restoring prior states. In context, the same document also suggests storing API keys in config.json and demonstrates hot-reload/admin write patterns, so an agent following this guidance could generate unsafe operational features that expose secrets, alter runtime behavior, or damage data integrity.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill advertises auto-activation on very broad prompts such as creating a Node.js project, refactoring a codebase, or splitting a file. In an agent ecosystem, this can cause the skill to engage outside its narrowly intended scope and inject architecture patterns like admin dashboards or config handling into unrelated projects without explicit user consent. The surrounding README also promotes opinionated patterns with security implications, which makes accidental overreach more dangerous.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The description says to use the skill for creating new Node.js projects, refactoring large single-file codebases, or when the AI context window is consumed by oversized files, then lists many project types. This is broad and does not define exclusion conditions or a precise trigger phrase, which could cause unintended invocation across routine development tasks.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill provides a concrete pattern for an admin endpoint that writes arbitrary request data directly into config files and backup files on disk, with only a vague requireAdmin placeholder and no validation, schema enforcement, atomic writes, or warning about file modification risk. In the context of a reusable architecture skill, this is more dangerous because it encourages propagation of an unsafe pattern across many projects, potentially enabling config tampering, persistence of malicious settings, accidental secret exposure, or service disruption.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documentation describes hot-reload config saves and one-click restore for an admin dashboard without any warning that these actions immediately affect the live system state. In practice, this can lead operators or AI-assisted implementers to expose dangerous controls that change runtime behavior, break availability, or roll back security-sensitive settings without adequate confirmation, auditing, or maintenance safeguards.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documented example exposes an admin endpoint that directly writes attacker-controlled request data to config files and immediately applies it to live process state. Even though it is gated by requireAdmin, the pattern is dangerous because it encourages unsafe state-changing behavior without validation, schema enforcement, atomic writes, rollback handling, or safeguards against breaking the application, persisting malicious settings, or altering security-sensitive values.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The installation text states that the skill 'auto-triggers when you create or refactor Node.js projects' without defining scope, boundaries, or gating conditions. In an agent skill context, broad automatic activation can cause the skill to influence unrelated tasks, increase prompt-surface exposure, and make it easier for unsafe or adversarial instructions inside the skill to be applied unexpectedly.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guidance explicitly recommends an admin API protected only by a static x-admin-password header. In practice, shared static secrets are weak authentication for high-privilege operations, are often hardcoded or reused, and can be exposed via logs, client code, proxies, or repository history; this is especially dangerous because the same section grants read/write config, restore, and stats access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file documents admin endpoints that can update config.json and restore from backup, which can materially change or overwrite game behavior and state. The description mentions authentication but does not warn users that these actions are write/restore operations with potentially destructive or irreversible effects.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
72% confidence
Finding

The document includes a dedicated "WeChat WebView Compatibility" section with prescriptive requirements tied to a specific platform and regional ecosystem. This can amount to a locale/platform policy constraint because it forces one context without stating that the skill is specifically intended for that region or offering an alternative.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.