{"record":{"id":"3ccf3d99325b9b62","repo":"HKUDS/DeepTutor","slug":"grants-must-not-contain-secret-path-field-trail","errorCode":null,"errorMessage":"Grants must not contain secret/path field: {trail}.{key}","messagePattern":"Grants must not contain secret/path field: (.+?)\\.(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/multi_user/grants.py","lineNumber":128,"sourceCode":"    path = grant_path(user_id)\n    path.parent.mkdir(parents=True, exist_ok=True)\n    path.write_text(json.dumps(grant, indent=2, ensure_ascii=False), encoding=\"utf-8\")\n    return grant\n\n\ndef validate_grant(grant: dict[str, Any]) -> None:\n    \"\"\"Reject accidental secret/path material in grants.\n\n    Grants carry logical ids only. Runtime resolution happens server-side.\n    \"\"\"\n    forbidden = {\"api_key\", \"secret\", \"password\", \"token\", \"path\", \"base_url\"}\n\n    def walk(value: Any, trail: str = \"grant\") -> None:\n        if isinstance(value, dict):\n            for key, child in value.items():\n                lowered = str(key).lower()\n                if lowered in forbidden or lowered.endswith(\"_key\"):\n                    raise ValueError(f\"Grants must not contain secret/path field: {trail}.{key}\")\n                walk(child, f\"{trail}.{key}\")\n        elif isinstance(value, list):\n            for index, child in enumerate(value):\n                walk(child, f\"{trail}[{index}]\")\n\n    walk(grant)\n\n\ndef public_grant(user_id: str) -> dict[str, Any]:\n    return deepcopy(load_grant(user_id))\n","sourceCodeStart":110,"sourceCodeEnd":139,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/multi_user/grants.py#L110-L139","documentation":"Error \"Grants must not contain secret/path field: {trail}.{key}\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/multi_user/grants.py:128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}