T09 · Insecure Skill Coding Practices
- Location
scripts/register.mjs:13- Finding
Local Hostname Disclosed During Default Agent Registration
- Content
View full analysis
Vulnerability Details
File Location:
scripts/register.mjs, lines 13–19
Vulnerability Type: Unnecessary disclosure of local system metadata
Risk Level: LowVulnerable Code
js const agentName = process.argv[2] || `agent-${hostname()}`; console.log(`Registering agent "${agentName}" with Citedy...`); const res = await fetch(`${BASE_URL}/api/agent/register`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ agent_name: agentName }), });The behavior is also documented in
SKILL.md, lines 66–69:markdown **Preferred: run the included registration script:** ```bash node scripts/register.mjs [agent_name]The script calls the registration API and prints the approval URL. If
agent_nameis omitted, it defaults toagent-<hostname>.text ### Technical Analysis When the optional command-line argument is omitted, the registration script obtains the machine's hostname through Node.js's `os.hostname()` function. It incorporates that value into `agent_name` and transmits it to `https://www.citedy.com/api/agent/register`. A hostname can contain identifying or operational information, including a username, employee or asset identifier, organization name, internal naming convention, environment type, or infrastructure role. Registration only needs an agent identifier, so transmitting the actual hostname is not necessary for the stated functionality. This is an unnecessary metadata disclosure rather than arbitrary file access or credential theft. The request uses HTTPS, and the reviewed code sends the hostname only to the declared Citedy endpoint. ### Attack Path 1. A user follows the documented setup command without providing an explicit agent name: `node scripts/register.mjs`. 2. The script calls `hostname()` and constructs an identifier such as `agent-workstation-alice`. 3. The identifier is included in the JSON registra ...[truncated 890 chars]- Remediation
View remediation
Remediation Suggestions
- Do not use the local hostname as the default external identifier.
- Require the user to provide an explicit, non-sensitive agent name, or generate a random identifier such as
agent-<random UUID>. - If hostname use remains available, require explicit informed consent before reading and transmitting it.
- Update
SKILL.mdto state precisely which local metadata is collected, its destination, purpose, and retention policy. - Apply data minimization by transmitting only values required for registration.
- Consider validating explicit agent names to reject accidental secrets, filesystem paths, email addresses, or other sensitive identifiers.
A safer implementation would be:
js import { randomUUID } from "crypto"; const agentName = process.argv[2] || `agent-${randomUUID()}`;Alternatively, terminate with a usage message when no explicit agent name is supplied.
