Back to skill

Security audit

Arquitecto de migracion

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent migration-planning skill, but it generates ready-to-run destructive rollback and SQL guidance with unsafe automatic rollback defaults that users should review before use.

Review generated SQL and rollback runbooks manually before execution, especially DROP, DELETE, restore, Terraform, Kubernetes, AWS, systemctl, and curl commands. Do not enable automatic rollback actions without explicit human approval, tested backups, staging validation, scoped credentials, and rollback drills.

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

Warning
Location
scripts/compatibility_checker.py:235
Finding
Untrusted Schema Values Embedded in Generated SQL Statements<![CDATA[ ## Vulnerability Details **File Location**: `scripts/compatibility_checker.py`, lines 235–243, 350–356, 408–411, and 526–529 **Vulnerability Type**: SQL injection in generated migration and rollback scripts **Risk Level**: Medium ### Vulnerable Code ```python # Lines 235–243 for table_name in after_tables: if table_name not in before_tables: migration_scripts.append(MigrationScript( script_type="sql", description=f"Create new table {table_name}", script_content=self._generate_create_table_sql(table_name, after_tables[table_name]), rollback_script=f"DROP TABLE IF EXISTS {table_name};", dependencies=[], validation_query=f"SELECT COUNT(*) FROM information_schema.tables WHERE table_name = '{table_name}';" )) ``` ```python # Lines 350–356 scripts.append(MigrationScript( script_type="sql", description=f"Add column {col_name} to table {table_name}", script_content=f"ALTER TABLE {table_name} ADD COLUMN {self._generate_column_definition(col_name, col_def)};", rollback_script=f"ALTER TABLE {table_name} DROP COLUMN {col_name};", dependencies=[], validation_query=f"SELECT COUNT(*) FROM information_schema.columns WHERE table_name = '{table_name}' AND column_name = '{col_name}';" )) ``` ```python # Lines 408–411 script_content=f"ALTER TABLE {table_name} ALTER COLUMN {col_name} TYPE {after_type} USING {col_name}::{after_type};", rollback_script=f"ALTER TABLE {table_name} ALTER COLUMN {col_name} TYPE {before_type};", dependencies=[f"backup_{table_name}"], validation_query=f"SELECT COUNT(*) FROM {table_name} WHERE {col_name} IS NOT NULL;" ``` ```python # Lines 526–529 script_content=f"ALTER TABLE {table_name} ADD CONSTRAINT {constraint_type}_{table_name} {constraint_type.upper()} ({constraint});", rollback_script=f"ALTER TABLE {table_name} DROP CONSTRAINT {constraint_type}_{table_name};", dependencies=[], validation_query=f"SELECT COUNT(*) FROM info ...[truncated 2863 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Validate every SQL identifier** - Restrict table, column, type, and constraint names to a documented allowlist grammar. - Reject identifiers containing quotes, semicolons, comments, control characters, whitespace in unexpected positions, or multiple SQL tokens. - Apply length limits appropriate to the target database. 2. **Use database-aware SQL composition** - Build statements with the target driver’s identifier-composition API, such as `psycopg.sql.Identifier` for PostgreSQL. - Do not treat identifiers as ordinary query parameters because parameter placeholders generally apply only to values. 3. **Parameterize SQL literal values** - Validation queries containing table or column names as string values should use bound parameters when executed. - If the tool must emit standalone SQL text, escape literals through a trusted database-specific quoting implementation. 4. **Allowlist data types** - Map schema types to a fixed set of supported database types. - Do not insert arbitrary `before_type` or `after_type` strings into `ALTER TABLE` statements. 5. **Represent constraints structurally** - Parse constraints into validated fields such as type, columns, referenced table, and referenced columns. - Generate SQL from those fields rather than accepting and embedding raw constraint expressions. 6. **Separate analysis from executable output** - Clearly mark generated SQL as untrusted and requiring manual review. - Consider producing a structured migration representation rather than immediately emitting executable statements. - Require an explicit opt-in mode before producing destructive rollback commands. 7. **Add adversarial tests** - Test identifiers and constraints containing single quotes, double quotes, semicolons, SQL comments, newline characters, and appended statements. - Verify that malicious or malformed schema values are rejected rather than included in output. ]]>
Vulnerability Patterns
  • 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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (20)

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill instructs the agent to invoke local Python scripts and read reference files, which implies shell and file access, but it does not declare any explicit tool scope or permissions boundary. Without an allowlist, a host system may grant broader-than-necessary capabilities, increasing the chance of unintended file access, arbitrary command execution, or network-enabled side effects if the referenced scripts are modified or misused.

Missing User Warnings

Medium
Confidence
85% confidence
Finding
The CDC reconciliation example applies INSERT, UPDATE, and DELETE operations directly, including deletion of target records, without a clear warning that the example is state-changing and potentially destructive. In migration contexts, delete behavior is especially risky because replay, malformed CDC events, or targeting mistakes can remove valid data and amplify operational impact.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The document includes concrete automated correction logic that inserts and updates target data, and the surrounding markdown does not prominently warn that these actions can modify production systems if dry-run protections are disabled. In a migration skill, operators may treat reference code as implementation guidance, so omission of explicit safety guardrails increases the risk of unintended data corruption or unauthorized production changes.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The example includes `DROP COLUMN email` and renaming steps in a reference catalog without an explicit warning that the contract phase is destructive and should only occur after verified backups, rollback readiness, and migration validation. In a migration-planning skill, users may copy these snippets into real runbooks, so omission of cautionary guidance increases the chance of irreversible data loss or premature schema removal.

External Transmission

Medium
Category
Data Exfiltration
Content
async def external_api_check():
    """Check external API availability"""
    response = await http_client.get("https://api.example.com/health")
    return response.status_code == 200

async def memory_check():
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The tool auto-generates executable rollback SQL containing destructive operations such as DROP TABLE IF EXISTS and presents them as migration guidance without prominent safety warnings, confirmation requirements, or environment scoping. In a migration skill, operators may copy these scripts directly into production workflows, increasing the chance of accidental data loss or service disruption during rollback or testing.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The generated rollback for added columns uses ALTER TABLE ... DROP COLUMN, which can permanently delete data accumulated after deployment. Because the script is emitted as a ready-to-use rollback artifact without explicit disclosure of destructive consequences, users may execute it under incident pressure and unintentionally lose production data.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
condition: str
    metric_threshold: Optional[Dict[str, Any]]
    evaluation_window_minutes: int
    auto_execute: bool
    escalation_contacts: List[str]
Confidence
85% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
condition: str
    metric_threshold: Optional[Dict[str, Any]]
    evaluation_window_minutes: int
    auto_execute: bool
    escalation_contacts: List[str]
Confidence
85% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
condition: str
    metric_threshold: Optional[Dict[str, Any]]
    evaluation_window_minutes: int
    auto_execute: bool
    escalation_contacts: List[str]
Confidence
85% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
condition: str
    metric_threshold: Optional[Dict[str, Any]]
    evaluation_window_minutes: int
    auto_execute: bool
    escalation_contacts: List[str]
Confidence
85% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
condition: str
    metric_threshold: Optional[Dict[str, Any]]
    evaluation_window_minutes: int
    auto_execute: bool
    escalation_contacts: List[str]
Confidence
85% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
The generator emits rollback scripts containing destructive SQL, Kubernetes, Terraform, AWS, and file operations directly into output artifacts without any explicit danger labeling, approval gate, or safeguards. In the context of a migration skill, operators may treat generated runbooks as trusted and execute them during incidents, increasing the chance of accidental destructive actions against production systems.

External Transmission

Medium
Category
Data Exfiltration
Content
},
                "configuration_rollback": {
                    "restore_config_map": "kubectl apply -f {original_config_file}",
                    "revert_feature_flags": "curl -X PUT {feature_flag_api}/flags/{flag_name} -d '{\"enabled\": false}'",
                    "restore_environment_vars": "kubectl set env deployment/{deployment_name} {env_var_name}={original_value}"
                }
            },
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
"curl -f {health_check_url}",
                "kubectl get pods -l app={service_name} --field-selector=status.phase=Running",
                "kubectl logs deployment/{service_name} --tail=100 | grep -i error",
                "curl -f {service_endpoint}/api/v1/status"
            ],
            "infrastructure": [
                "aws ec2 describe-instances --instance-ids {instance_id} --query 'Reservations[*].Instances[*].State.Name'",
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
"duration_minutes": 5
                },
                evaluation_window_minutes=5,
                auto_execute=True,
                escalation_contacts=["on_call_engineer", "migration_lead"]
            ),
            RollbackTriggerCondition(
Confidence
85% confidence
Finding
The generated runbook includes rollback triggers marked auto_execute=True for error-rate spikes. In a migration context, publishing auto-executing rollback conditions without mandatory human approval, environment constraints, or anti-flapping controls can lead downstream automation to trigger disruptive production reversions automatically.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
"duration_minutes": 2
                },
                evaluation_window_minutes=2,
                auto_execute=True,
                escalation_contacts=["sre_team", "incident_commander"]
            )
        ])
Confidence
85% confidence
Finding
This generated availability-based trigger is marked auto_execute=True, enabling autonomous rollback on a short two-minute window. In migration operations, brief telemetry dips or monitoring faults can cause unnecessary rollback of critical systems, creating cascading outages or reverting healthy changes.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
"duration_minutes": 1
                    },
                    evaluation_window_minutes=1,
                    auto_execute=True,
                    escalation_contacts=["dba_team", "data_team"]
                ),
                RollbackTriggerCondition(
Confidence
85% confidence
Finding
The data-integrity trigger is configured for auto_execute=True, which could cause immediate automated rollback when any validation failure is observed. Although data integrity is sensitive, blindly automating rollback on single-failure signals can worsen incidents, especially if the signal is noisy or the rollback itself is destructive.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
"duration_minutes": 20
                    },
                    evaluation_window_minutes=20,
                    auto_execute=True,
                    escalation_contacts=["development_team", "sre_team"]
                )
            ])
Confidence
85% confidence
Finding
The memory-leak trigger is generated with auto_execute=True, encouraging unsupervised rollback based on inferred resource trends. In a zero-downtime migration setting, autonomous rollback from heuristic metrics can create instability, churn, and repeated reversion if thresholds are mis-tuned.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
for trigger in runbook.trigger_conditions:
            output.append(f"• {trigger.name}")
            output.append(f"  Condition: {trigger.condition}")
            output.append(f"  Auto-Execute: {'Yes' if trigger.auto_execute else 'No'}")
            output.append(f"  Evaluation Window: {trigger.evaluation_window_minutes} minutes")
            output.append(f"  Contacts: {', '.join(trigger.escalation_contacts)}")
            output.append("")
Confidence
85% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Static analysis

No suspicious patterns detected.