Back to skill

Security audit

js2java

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent JS-to-Java teaching/code-generation skill, but its authentication example promotes unsafe plaintext password storage and raw-password lookup patterns.

Review before installing if you may ask it for login, registration, or account code. Do not copy its auth example into real projects without replacing raw password storage and findByEmailAndPassword with a PasswordEncoder-based hash-and-verify flow. Also expect verbose full Spring Boot scaffolding and Chinese output by default.

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

Error
Location
README.md:87
Finding

Generated Authentication Example Stores and Compares Plaintext Passwords

Content
View full analysis
{ boolean existsByEmail(String email); Optional findByEmailAndPassword(String email, String password); } ``` ```java UserEntity entity = new UserEntity(); entity.setName(request.getName()); entity.setEmail(request.getEmail()); entity.setPassword(request.getPassword()); // Actual projects should encrypt this entity.setCreatedAt(LocalDateTime.now()); UserEntity saved = userRepository.save(entity); return toDTO(saved); ``` ```java public UserDTO login(String email, String password) { UserEntity user = userRepository.findByEmailAndPassword(email, password) .orElseThrow(() -> new UserNotFoundException("Invalid email or password")); return toDTO(user); } ``` ### Technical Analysis The reference implementation assigns the submitted password directly to a persistent entity without hashing it. Authentication is then performed through `findByEmailAndPassword`, which requires the database to compare the submitted plaintext password with a stored plaintext value. The comment stating that real projects should encrypt the password does not mitigate the vulnerability. Passwords should not be reversibly encrypted; they must be processed with a password-specific, salted, computationally expensive one-way hashing algorithm. Because this project is an AI coding skill, the vulnerable example can influence generated Spring Boot applications. A user who follows or deploys the generated pattern may unintentionally create a production database containing recoverable passwords. ### Attack Path 1. A user invokes the skill to generate a registration and login implementation. 2. The generated ...[truncated 1290 chars]
Remediation
View remediation
findByEmail(String email); ``` 5. Verify the submitted password using a constant-time password-encoder operation: ```java UserEntity user = userRepository.findByEmail(email) .orElseThrow(() -> new UserNotFoundException("Invalid email or password")); if (!passwordEncoder.matches(rawPassword, user.getPasswordHash())) { throw new UserNotFoundException("Invalid email or password"); } ``` 6. Never include password or password-hash fields in DTOs, API responses, exceptions, application logs, query logs, or audit events. 7. Add an explicit rule to `SKILL.md` requiring secure password hashing whenever authentication code is generated. 8. Add evaluation cases that reject direct password persistence and repository methods that query by raw password. 9. If this pattern has already been deployed, force password resets, invalidate active sessions, rotate affected credentials, and inspect backups and logs for plaintext password exposure. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (13)

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger condition is mandatory and overly broad, requiring invocation for essentially any natural-language Java-related request. This can hijack unrelated developer workflows, cause inappropriate tool selection, and force generation of heavyweight backend artifacts that the user did not ask for, increasing the chance of unsafe or irrelevant code being introduced into production contexts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The entire skill is written as a directive in Chinese and does not indicate that users may choose another language for explanations or output. This creates a language/locale policy concern because it implicitly fixes the interaction language without opt-in or an explicit multilingual option.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The example code shows entity.setPassword(request.getPassword()) and a repository method findByEmailAndPassword(...), which normalizes insecure authentication patterns: storing plaintext passwords and querying by raw password. In a code-generation skill aimed at learners, this is especially dangerous because users may copy the pattern into real projects, leading to credential disclosure if the database is leaked and encouraging unsafe login design.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The natural-language description is written as a Chinese-only assistant persona and does not indicate that the user may choose another language for explanations or output. This can violate language/locale policy when the skill implicitly forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The listed invocation phrases are generic enough to overlap with ordinary programming help, which can cause the skill to activate when the user only wants explanation, review, or small code snippets. In context, this is more dangerous because the skill is designed to emit complete Spring Boot layers, so accidental activation can materially change the nature and scale of the response.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest frames the skill as a translation and learning assistant for converting JavaScript logic into Java, but it explicitly requires generation of full Spring Boot layers including Repository and database-oriented structures. That goes beyond pure code translation into application and persistence design, which may materially alter the user's requested scope.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The limits section explicitly excludes complex multithreading and concurrency, yet the earlier 'JS 异步模式' section presents CompletableFuture-based async service generation as a translation target. That creates an internal contradiction about whether asynchronous/concurrent patterns are within scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire skill is written to operate in Chinese and instructs the assistant to provide explanations, templates, and interaction in Chinese, but it does not offer the user any language or locale choice. This can violate language/locale policy requirements when a skill forces a specific language without explicit user opt-in or documented justification.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The eval examples and surrounding metadata encourage activation for a very broad set of requests, including both pasted code and loosely described backend needs, without clear scope boundaries or disambiguation criteria. This can cause the skill to over-trigger outside its intended domain, leading to incorrect routing, unintended code generation behavior, and reduced safety controls when other more appropriate skills should handle the request.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The title and core description specify the skill behavior entirely in Chinese, including the promise to output code explanations, comparison tables, and study questions, but there is no indication that users may choose another language. This can violate a language/locale policy if the organization expects language choice or user opt-in rather than an implicit forced locale.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The skill's declared purpose is translating JavaScript logic into Java/Spring Boot code with teaching comments, primarily for common business logic and REST backends. Including concrete guidance for @Scheduled jobs and CompletableFuture async services introduces backend execution patterns that are not obviously required for normal JS-to-Java translation, especially given the stated limits excluding complex concurrency.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The inline teaching comment says 'Java: 必须显式遍历,不能用箭头函数', implying Java cannot express this pattern concisely. However, the very next lines use Stream API and a method reference, which is a functional shorthand and contradicts the stated teaching point. This is an intent/documentation mismatch in the instructional content rather than a code-execution issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

All included prompts and expected outputs are written as Chinese-language interactions, and the file provides no indication that language selection is optional or that the skill is intentionally limited to Chinese users. This can imply a fixed locale expectation without user opt-in, which may conflict with language choice policy.

Content

No source excerpt is available for this finding.