Back to skill

Security audit

Create Harness Docs

Security checks for vulnerabilities and agentic risk

Overview

This skill appears intended to generate Harness project documentation, but it can overwrite repository policy, CI, and test files without clear safeguards.

Review the generated changes before committing. Do not run --init in an established repository unless you are willing to replace AGENTS.md, docs, CI workflow files, and possibly Java test files; prefer running it in a clean branch and checking the diff carefully.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/create-harness-docs.js:473
Finding

Unconditional Overwrite of Existing Agent Policy, CI, Documentation, and Test Files

Content
View full analysis

Vulnerability Details

File Location: scripts/create-harness-docs.js:473-474, 541, 548, 760, 769, 965
Vulnerability Type: Unsafe file overwrite
Risk Level: Medium

Complete Vulnerable Code Snippets

js
const filePath = path.join(PROJECT_ROOT, 'AGENTS.md');
fs.writeFileSync(filePath, content);
js
const filePath = path.join(PROJECT_ROOT, 'docs/architecture/ARCHITECTURE.md');
fs.writeFileSync(filePath, content);
success(`创建 docs/architecture/ARCHITECTURE.md`);

// Create documentation for each business domain
for (const domain of project.domains) {
  const domainContent = generateDomainDoc(domain, project);
  const domainPath = path.join(PROJECT_ROOT, `docs/architecture/domains/${domain}.md`);
  fs.writeFileSync(domainPath, domainContent);
}
js
const filePath = path.join(PROJECT_ROOT, 'docs/quality/grades.md');
fs.writeFileSync(filePath, content);
js
const filePath = path.join(PROJECT_ROOT, '.github/workflows/harness-ci.yml');
fs.writeFileSync(filePath, content);
js
fs.writeFileSync(path.join(testDir, 'ArchitectureTest.java'), content);

Technical Analysis

The generation functions use fs.writeFileSync() with its default write behavior, which creates a file or truncates and replaces it when it already exists. There is no existence check, confirmation prompt, backup, atomic merge process, or explicit force option.

The documented --init mode invokes all relevant generation functions and can therefore replace existing:

  • AGENTS.md Agent instructions and repository policy;
  • architecture and domain documentation;
  • quality assessment records;
  • .github/workflows/harness-ci.yml;
  • src/test/java/com/example/arch/ArchitectureTest.java.

This is security-relevant because AGENTS.md can govern future Agent behavior and the GitHub Actions workflow governs repository security and quality checks. Replacing either file can r ...[truncated 1913 chars]

Remediation
View remediation

Remediation Suggestions

  1. Refuse to overwrite existing files by default:

    js
    fs.writeFileSync(filePath, content, { flag: 'wx' });
    

    Handle EEXIST by reporting that the destination was preserved.

  2. Add an explicit --force option for intentional replacement. The default execution path must remain non-destructive.

  3. Before writing, display a file-by-file change plan identifying files that will be created, modified, or skipped.

  4. Require interactive confirmation before replacing security-sensitive files such as AGENTS.md and .github/workflows/harness-ci.yml. In non-interactive environments, require the explicit force option.

  5. Create timestamped backups before approved replacement, or use a safe merge mechanism that only updates clearly delimited generated sections.

  6. Write content to a temporary file in the same directory, validate it, and atomically rename it into place only after authorization.

  7. Treat Agent policy, CI workflow, and test files as protected destinations requiring separate opt-in flags, such as --replace-agents, --replace-ci, and --replace-tests.

  8. Add automated tests confirming that existing destination files remain unchanged unless explicit overwrite authorization is supplied.

Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill is presented as a documentation generator, but the documented behavior includes creating CI workflow files, adding architecture test code, and modifying project structure beyond docs. This mismatch can cause users to grant broader trust than warranted, increasing the chance of unintended repository changes and workflow execution in environments where generated files are auto-discovered.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill description and heading present the skill content in Chinese, which implies a fixed language/locale choice without any opt-in or alternative language option. Under the stated policy, language constraints should either be optional for the user or explicitly justified as region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill documentation does not clearly warn that it will write files into the current project, including under .github/workflows and test directories. In a developer environment, silent repository modification can introduce unexpected automation, break builds, or commit unwanted artifacts, especially when users expect a read-only analysis or doc-only operation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill is presented as a documentation generator, but it also writes executable GitHub Actions workflow files and a Java test source file into the repository. That expands its authority from passive doc creation into modifying build and execution behavior, which can change CI outcomes, consume runner resources, and introduce unreviewed executable content under a misleading feature description.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Creating repository CI automation is a privileged action because workflow files execute automatically on pushes and pull requests in many environments. In this skill, that capability is bundled into --init for a tool described as documentation creation, so a user may unintentionally introduce automation that runs commands in CI and alters repository security posture.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill writes a framework-specific architecture test source file into src/test, which is executable code generation beyond the stated documentation purpose. Even though the sample test is not overtly malicious, silently adding source code can affect builds, tests, dependency requirements, and developer trust boundaries when users expect only markdown or metadata changes.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/create-harness-docs.js:344