Back to skill

Security audit

Go Data Persistence

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Go database guidance skill, but it includes production-looking transaction examples with serious financial-integrity and cleanup flaws that users should review before relying on it.

Treat this skill as database-design reference material, not drop-in production code. Pin any CLI versions before installing tools, and review or replace the transaction examples before using them for payments, balances, inventory, credits, or other high-impact state changes.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T08 · Insecure Dependencies

Warning
Location
references/migrations.md:9
Finding

Unpinned Executable Dependency Installation

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/transactions.md:18
Finding

Funds Transfer Example Credits an Account Without Confirming the Debit

Content
View full analysis
= $1", amount, from, ) if err != nil { tx.Rollback() return fmt.Errorf("debiting account: %w", err) } // Credit destination account _, err = tx.ExecContext(ctx, "UPDATE accounts SET balance = balance + $1 WHERE id = $2", amount, to, ) if err != nil { tx.Rollback() return fmt.Errorf("crediting account: %w", err) } return tx.Commit() } ``` ### Technical Analysis The debit statement guards against insufficient funds in its `WHERE` clause, but the code discards the returned `sql.Result` and never checks `RowsAffected()`. PostgreSQL does not return an SQL error when an `UPDATE` matches no rows. If the source account does not exist or lacks sufficient funds, the debit can therefore affect zero rows while returning a nil error. The destination account is then credited and the transaction is committed. The function also does not verify that `amount` is positive. A negative value changes the intended arithmetic: subtracting a negative value increases the source balance, while adding it decreases the destination balance. Depending on surrounding authorization and business rules, this could permit balance manipulation. ### Attack Path 1. An application copies this documented function into a transfer endpoint or service. 2. An attacker submits a transfer using a nonexistent or underfunded source accoun ...[truncated 1176 chars]
Remediation
View remediation
= $1", amount, from, ) if err != nil { return fmt.Errorf("debiting account: %w", err) } affected, err := result.RowsAffected() if err != nil { return fmt.Errorf("checking debit result: %w", err) } if affected != 1 { return fmt.Errorf("source account missing or insufficient funds") } ``` 3. Verify that the destination update also affects exactly one row. 4. Add authorization checks ensuring the caller may debit the specified source account. 5. Add database constraints appropriate to the domain, such as nonnegative balances and positive transfer amounts. 6. Add tests for nonexistent accounts, insufficient funds, zero and negative amounts, duplicate requests, and concurrent transfers. 7. Use an idempotency key or uniquely constrained transfer identifier to prevent replayed requests from being credited more than once. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
references/transactions.md:45
Finding

Transaction Helper Does Not Guarantee Rollback After a Panic

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • 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
Findings (1)

Session Persistence

Medium
Category
Rogue Agent
Confidence
55% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/migrations.md (reported line 304)May include surrounding context.

ALTER TABLE users ADD COLUMN IF NOT EXISTS legacy_field TEXT;

text

Document in comments when a down migration cannot fully restore the previous state.

## Migration Rules

Static analysis

No suspicious patterns detected.