Back to skill

Security audit

lgpd-encryption-keys

Security checks for vulnerabilities and agentic risk

Overview

The verdict is benign with high confidence: the scanners found no AIG issues, and the single reported credential-access pattern was judged expected in context of encryption key handling.

The scanners completed with full coverage of the two reported components, and the verdict is benign. Consider whether you are comfortable installing a skill that includes executable TypeScript and handles encryption keys; the credential-access alerts were treated as expected, but benign does not mean risk-free.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (27)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 44)May include surrounding context.

md
import { createPrismaModelEncryptionHandlers } from "@/lib/privacy/field-encryption";

const guardianEncryption = createPrismaModelEncryptionHandlers({
  keyring: {
    currentVersion: 2,
    keys: {
      1: Buffer.from(process.env.KMS_DATA_KEY_V1_B64!, "base64"),

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 12)May include surrounding context.

ts
const IV_LENGTH = 12;
const AUTH_TAG_LENGTH = 16;

export interface Keyring {
  /** Versão ativa usada para novas gravações (ex.: 1, 2). */
  currentVersion: number;
  /** Mapa versão -> chave AES-256 de exatos 32 bytes. */

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 19)May include surrounding context.

ts
keys: Readonly<Record<number, Buffer>>;
}

export function assertValidKeyring(keyring: Keyring): void {
  const activeKey = keyring.keys[keyring.currentVersion];
  if (!activeKey || activeKey.byteLength !== 32) {
    throw new Error(

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 19)May include surrounding context.

ts
keys: Readonly<Record<number, Buffer>>;
}

export function assertValidKeyring(keyring: Keyring): void {
  const activeKey = keyring.keys[keyring.currentVersion];
  if (!activeKey || activeKey.byteLength !== 32) {
    throw new Error(

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 44)May include surrounding context.

ts
*/
export function encryptField(
  plaintext: string,
  keyring: Keyring,
  aadContext?: string,
): string {
  assertValidKeyring(keyring);

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 47)May include surrounding context.

ts
keyring: Keyring,
  aadContext?: string,
): string {
  assertValidKeyring(keyring);
  if (isEncryptedField(plaintext)) {
    return plaintext;
  }

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 68)May include surrounding context.

ts
export function decryptField(
  encoded: string,
  keyring: Keyring,
  aadContext?: string,
): string {
  assertValidKeyring(keyring);

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 71)May include surrounding context.

ts
keyring: Keyring,
  aadContext?: string,
): string {
  assertValidKeyring(keyring);
  if (!encoded.startsWith(CIPHERTEXT_PREFIX)) {
    throw new Error("Malformed encrypted field: missing enc:v{N}: prefix.");
  }

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 129)May include surrounding context.

ts
}

export interface FieldEncryptionOptions {
  keyring: Keyring;
  blindKey?: Buffer;
  fields: ReadonlyArray<EncryptedFieldSpec>;
}

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 224)May include surrounding context.

ts
* `upsert`, `findUnique`, `findUniqueOrThrow`, `findFirst`, `findFirstOrThrow` e `findMany`.
 */
export function createPrismaModelEncryptionHandlers(options: FieldEncryptionOptions) {
  assertValidKeyring(options.keyring);

  async function intercept({
    operation,

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 19)May include surrounding context.

ts
keys: Readonly<Record<number, Buffer>>;
}

export function assertValidKeyring(keyring: Keyring): void {
  const activeKey = keyring.keys[keyring.currentVersion];
  if (!activeKey || activeKey.byteLength !== 32) {
    throw new Error(

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 20)May include surrounding context.

ts
}

export function assertValidKeyring(keyring: Keyring): void {
  const activeKey = keyring.keys[keyring.currentVersion];
  if (!activeKey || activeKey.byteLength !== 32) {
    throw new Error(
      `Invalid active AES-256 key for version ${keyring.currentVersion}: expected 32 bytes.`,

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 20)May include surrounding context.

ts
}

export function assertValidKeyring(keyring: Keyring): void {
  const activeKey = keyring.keys[keyring.currentVersion];
  if (!activeKey || activeKey.byteLength !== 32) {
    throw new Error(
      `Invalid active AES-256 key for version ${keyring.currentVersion}: expected 32 bytes.`,

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 23)May include surrounding context.

ts
const activeKey = keyring.keys[keyring.currentVersion];
  if (!activeKey || activeKey.byteLength !== 32) {
    throw new Error(
      `Invalid active AES-256 key for version ${keyring.currentVersion}: expected 32 bytes.`,
    );
  }
  for (const [ver, key] of Object.entries(keyring.keys)) {

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 26)May include surrounding context.

ts
`Invalid active AES-256 key for version ${keyring.currentVersion}: expected 32 bytes.`,
    );
  }
  for (const [ver, key] of Object.entries(keyring.keys)) {
    if (key.byteLength !== 32) {
      throw new Error(`Invalid AES-256 key for version ${ver}: expected 32 bytes.`);
    }

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 44)May include surrounding context.

ts
*/
export function encryptField(
  plaintext: string,
  keyring: Keyring,
  aadContext?: string,
): string {
  assertValidKeyring(keyring);

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 47)May include surrounding context.

ts
keyring: Keyring,
  aadContext?: string,
): string {
  assertValidKeyring(keyring);
  if (isEncryptedField(plaintext)) {
    return plaintext;
  }

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 52)May include surrounding context.

ts
return plaintext;
  }

  const version = keyring.currentVersion;
  const key = keyring.keys[version]!;
  const iv = randomBytes(IV_LENGTH);
  const cipher = createCipheriv("aes-256-gcm", key, iv);

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 53)May include surrounding context.

ts
}

  const version = keyring.currentVersion;
  const key = keyring.keys[version]!;
  const iv = randomBytes(IV_LENGTH);
  const cipher = createCipheriv("aes-256-gcm", key, iv);
  if (aadContext) {

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 68)May include surrounding context.

ts
export function decryptField(
  encoded: string,
  keyring: Keyring,
  aadContext?: string,
): string {
  assertValidKeyring(keyring);

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 71)May include surrounding context.

ts
keyring: Keyring,
  aadContext?: string,
): string {
  assertValidKeyring(keyring);
  if (!encoded.startsWith(CIPHERTEXT_PREFIX)) {
    throw new Error("Malformed encrypted field: missing enc:v{N}: prefix.");
  }

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 82)May include surrounding context.

ts
}

  const version = Number(encoded.slice(CIPHERTEXT_PREFIX.length, sepIdx));
  const key = keyring.keys[version];
  if (!key) {
    throw new Error(`Unknown encryption key version: v${version}`);
  }

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 129)May include surrounding context.

ts
}

export interface FieldEncryptionOptions {
  keyring: Keyring;
  blindKey?: Buffer;
  fields: ReadonlyArray<EncryptedFieldSpec>;
}

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 152)May include surrounding context.

ts
let plain: string | null = null;
    if (typeof rawVal === "string") {
      plain = rawVal;
      out[spec.field] = encryptField(rawVal, options.keyring, spec.aadContext);
    } else if (
      typeof rawVal === "object" &&
      "set" in (rawVal as Record<string, unknown>)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · assets/field-encryption.ts (reported line 162)May include surrounding context.

ts
plain = setVal;
        out[spec.field] = {
          ...(rawVal as Record<string, unknown>),
          set: encryptField(setVal, options.keyring, spec.aadContext),
        };
      } else if (setVal === null && spec.blindIndexField) {
        out[spec.blindIndexField] = null;