T09 · Insecure Skill Coding Practices
- Location
scripts/compatibility_checker.py:235- Finding
Untrusted Schema Values Embedded in Generated SQL Statements
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
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.
scripts/compatibility_checker.py:235Untrusted Schema Values Embedded in Generated SQL Statements
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.
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.
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.
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.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
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():
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.
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.
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.
condition: str
metric_threshold: Optional[Dict[str, Any]]
evaluation_window_minutes: int
auto_execute: bool
escalation_contacts: List[str]
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.
condition: str
metric_threshold: Optional[Dict[str, Any]]
evaluation_window_minutes: int
auto_execute: bool
escalation_contacts: List[str]
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.
condition: str
metric_threshold: Optional[Dict[str, Any]]
evaluation_window_minutes: int
auto_execute: bool
escalation_contacts: List[str]
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.
condition: str
metric_threshold: Optional[Dict[str, Any]]
evaluation_window_minutes: int
auto_execute: bool
escalation_contacts: List[str]
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.
condition: str
metric_threshold: Optional[Dict[str, Any]]
evaluation_window_minutes: int
auto_execute: bool
escalation_contacts: List[str]
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.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
},
"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}"
}
},
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
"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'",
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.
"duration_minutes": 5
},
evaluation_window_minutes=5,
auto_execute=True,
escalation_contacts=["on_call_engineer", "migration_lead"]
),
RollbackTriggerCondition(
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.
"duration_minutes": 2
},
evaluation_window_minutes=2,
auto_execute=True,
escalation_contacts=["sre_team", "incident_commander"]
)
])
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.
"duration_minutes": 1
},
evaluation_window_minutes=1,
auto_execute=True,
escalation_contacts=["dba_team", "data_team"]
),
RollbackTriggerCondition(
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.
"duration_minutes": 20
},
evaluation_window_minutes=20,
auto_execute=True,
escalation_contacts=["development_team", "sre_team"]
)
])
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.
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("")