moodle-external-api-development
Pass
Audited by Gen Agent Trust Hub on Nov 13, 2026
Risk Level: SAFEINDIRECT_PROMPT_INJECTIONDATA_EXFILTRATIONPRIVILEGE_ESCALATION
Full Analysis
- [INDIRECT_PROMPT_INJECTION]: The skill describes building APIs that ingest untrusted data via request parameters.
- Ingestion points: API request parameters (
userid,courseid,options) in theexecutemethod withinSKILL.md. - Boundary markers: The instructions mandate
validate_parameters()but do not describe the use of delimiters or warnings for downstream LLM consumers of the API output. - Capability inventory: The implementation logic performs database operations (
$DB->get_records_sql,$DB->insert_record,$DB->set_field) and local file writes (file_put_contents). - Sanitization: The skill explicitly teaches input sanitization using Moodle's
PARAM_*types and the use of parameterized SQL queries to prevent injection. - [PRIVILEGE_ESCALATION]: The implementation example for error logging in Step 6 includes a call to
mkdir($logdir, 0777, true). Using0777permissions creates a world-writable directory, which is a privilege-related security risk on multi-user systems. - [DATA_EXFILTRATION]: The suggested error handling logic logs sensitive technical details to a local file (
api_debug.log). Specifically, it captures the output of$DB->get_last_sql()and$e->getTraceAsString(). Logging raw SQL queries and full stack traces can result in the exposure of sensitive database schemas or internal system information if the log file is improperly secured.
Audit Metadata