Back to skill

Security audit

angular-expert

Security checks for vulnerabilities and agentic risk

Overview

This Angular guidance skill is instructional only, but it includes security-sensitive examples that users should review before reusing.

Use this skill as general Angular guidance, but review security-sensitive output carefully. Do not copy the bearer-token interceptor as-is; restrict credentials to trusted HTTPS API origins and remove full form-value console logging before production use.

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
references/examples.md:450
Finding

Bearer Token Forwarded to Unrestricted Request Destinations

Content
View full analysis

Vulnerability Details

File Location: references/examples.md, lines 450–460
Vulnerability Type: Unrestricted credential forwarding
Risk Level: High

typescript
const token = authService.getToken();

if (token) {
  req = req.clone({
    setHeaders: {
      Authorization: `Bearer ${token}`
    }
  });
}

return next(req);

Technical Analysis

The example interceptor adds the user's bearer token to every request processed by Angular's HTTP client. It does not verify that the request uses HTTPS or that its destination origin belongs to the application's trusted API.

Angular interceptors can process both relative same-origin requests and absolute requests to third-party origins. Consequently, application code or a compromised dependency can initiate a request to an attacker-controlled server and cause the interceptor to attach the authentication token. An attacker-controlled server can permit the browser's CORS preflight and receive the resulting request with its Authorization header.

Credential forwarding exceeds the minimum privilege needed for an authentication interceptor. The token should only be attached to explicitly trusted API origins and paths.

Attack Path

  1. A compromised dependency, injected application component, or other attacker-controlled frontend code initiates an Angular HTTP request to an attacker-controlled HTTPS origin.
  2. The global interceptor processes the outbound request without validating its destination.
  3. The interceptor retrieves the active bearer token and adds it to the Authorization header.
  4. The attacker-controlled server permits the CORS request and records the bearer token.
  5. The attacker replays the token against the legitimate API until it expires or is revoked.

Impact Assessment

Disclosure gives an attacker the same API access represented by the bearer token. Depending on the token's scopes and the authenticated user's privileges, ...[truncated 283 chars]

Remediation
View remediation

Remediation Suggestions

  • Parse each request URL and attach the token only when its exact origin matches an explicit trusted API allowlist.
  • Restrict credential attachment further by validating expected API path prefixes.
  • Reject or omit credentials for non-HTTPS destinations.
  • Avoid suffix-based or substring hostname checks; compare normalized origins exactly.
  • Consider secure, HttpOnly, Secure, and appropriately configured SameSite cookies where the application's architecture supports them.
  • Add unit tests proving that the interceptor does not add Authorization to third-party, malformed, look-alike, or non-HTTPS URLs.
  • Apply short token lifetimes, narrow scopes, rotation, and prompt revocation to reduce the impact of disclosure.

T09 · Insecure Skill Coding Practices

Note
Location
references/examples.md:401
Finding

Personal Form Data Exposed Through Console Logging

Content
View full analysis

Vulnerability Details

File Location: references/examples.md, lines 401–405
Vulnerability Type: Sensitive information exposure through logging
Risk Level: Low

typescript
onSubmit() {
  if (this.form.valid) {
    console.log('Form data:', this.form.value);
  }
}

Technical Analysis

The submission handler writes the entire form value to the browser console. The corresponding form contains personal data, including the user's name and email address. Full-object logging provides no field-level redaction and may persist sensitive values in developer tools or in production monitoring systems that collect console output.

Console output can be viewed by anyone with local access to the browser session and may also be accessible to browser extensions, remote support tooling, automated test artifacts, or client-side telemetry integrations.

Attack Path

  1. A user enters their name, email address, and skills into the form.
  2. The user submits the valid form.
  3. The handler logs the complete form object to the browser console.
  4. A person with access to the browser session, a privileged extension, support tooling, or a console-log collection service reads or retains the personal data.

Impact Assessment

The issue can disclose personal information entered into the form. It does not grant additional system privileges by itself, but it unnecessarily broadens access to user data and may create privacy, retention, and compliance risks. The practical scope depends on whether production console output is collected and who can access the browser or resulting telemetry.

Remediation
View remediation

Remediation Suggestions

  • Remove the full form-value log from production code.
  • If diagnostics are necessary, enable them only in an explicit development environment.
  • Log non-sensitive operational events rather than user-provided field values.
  • Apply structured redaction or allowlisting before any diagnostic data is emitted.
  • Configure production builds and telemetry integrations to suppress console output containing user data.
  • Define retention and access controls for any necessary client-side diagnostic records.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep

Static analysis

No suspicious patterns detected.