{"record":{"id":"e491c0c663a7630b","repo":"infiniflow/ragflow","slug":"unsupported-auth-type-auth-type","errorCode":null,"errorMessage":"Unsupported auth_type: {auth_type}","messagePattern":"Unsupported auth_type: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":400,"severity":"error","filePath":"api/apps/restful_apis/agent_api.py","lineNumber":1926,"sourceCode":"                logging.warning(\n                    \"Webhook denied: anonymous access missing explicit opt-in agent_id=%s method=%s\",\n                    agent_id,\n                    request.method,\n                )\n                raise Exception(\"Anonymous webhook access requires allow_anonymous to be true\")\n            return\n\n        if auth_type == \"token\":\n            _validate_token_auth(security_cfg)\n\n        elif auth_type == \"basic\":\n            _validate_basic_auth(security_cfg)\n\n        elif auth_type == \"jwt\":\n            _validate_jwt_auth(security_cfg)\n\n        else:\n            raise Exception(f\"Unsupported auth_type: {auth_type}\")\n\n    async def _validate_max_body_size(security_cfg):\n        \"\"\"Check request size does not exceed max_body_size.\"\"\"\n        max_size = security_cfg.get(\"max_body_size\")\n        if not max_size:\n            max_size = \"10MB\"\n\n        # Convert \"10MB\" → bytes\n        units = {\"kb\": 1024, \"mb\": 1024**2}\n        size_str = max_size.lower()\n\n        for suffix, factor in units.items():\n            if size_str.endswith(suffix):\n                limit = int(size_str.replace(suffix, \"\")) * factor\n                break\n        else:\n            raise Exception(\"Invalid max_body_size format\")\n        MAX_LIMIT = 10 * 1024 * 1024  # 10MB","sourceCodeStart":1908,"sourceCodeEnd":1944,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/apps/restful_apis/agent_api.py#L1908-L1944","documentation":"In validate_webhook_security, after handling 'none', 'token', 'basic', and 'jwt', any other auth_type value falls through to Exception(f\"Unsupported auth_type: {auth_type}\") (agent_api.py:1926). The bad value is echoed in the message, making typos easy to spot.","triggerScenarios":"security config auth_type set to values like 'apiKey', 'bearer', 'oauth', 'Token' (capitalized), 'none ' (trailing space), or null-ish strings like 'undefined'; hand-edited webhook security JSON.","commonSituations":"Copy-pasting auth type names from other systems; case or whitespace slips; editing agent JSON directly instead of through the UI.","solutions":["Set auth_type to exactly one of: 'none', 'token', 'basic', 'jwt' (lowercase, no whitespace).","If you wanted no authentication, remember 'none' additionally requires allow_anonymous: true.","Fix the value in the agent's webhook/security config and re-publish.","Validate the security JSON before applying it (see the guard snippet) so typos fail fast at config time, not request time."],"exampleFix":"// before\n\"security\": {\"auth_type\": \"bearer\", \"token\": \"abc\"}\n\n// after\n\"security\": {\"auth_type\": \"token\", \"token\": \"abc\"}","handlingStrategy":"type-guard","validationCode":"VALID_AUTH_TYPES = {\"none\", \"token\", \"basic\", \"jwt\"}\nauth_type = str(security_cfg.get(\"auth_type\", \"none\")).strip().lower()\nif auth_type not in VALID_AUTH_TYPES:\n    raise ValueError(f\"auth_type must be one of {sorted(VALID_AUTH_TYPES)}, got {auth_type!r}\")","typeGuard":"def is_supported_webhook_auth_type(sec: dict) -> bool:\n    return str(sec.get(\"auth_type\", \"none\")).strip().lower() in {\"none\", \"token\", \"basic\", \"jwt\"}","tryCatchPattern":"try:\n    resp = await invoke_webhook(session, url, payload)\nexcept WebhookRejected as e:\n    if \"Unsupported auth_type\" in str(e):\n        raise ConfigError(f\"Fix webhook security config: {e}\") from e\n    raise","preventionTips":["Constrain the auth_type field to a dropdown/enum in any tooling that edits webhook security.","Normalize (strip + lower) auth_type on save to absorb case and whitespace slips.","Validate the full security block against a schema before publishing the webhook."],"tags":["webhook","agent","security","configuration","validation"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}