-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
Bug: Custom Auth Path Validation Fails Due to Incorrect Path Parsing
Description
When using custom authentication with a module path containing a class name (e.g., src.auth.custom_auth:SignedHeaderAuth), the path validation in graph_config.py fails because it checks if the entire path including the class name exists as a file.
Current Behavior
The current code in graph_config.py (around line 71) does:
if method == "custom" and path:
if Path(path).exists(): # This fails for "module.path:ClassName"
return {...}When path = "src.auth.custom_auth:SignedHeaderAuth":
Path("src.auth.custom_auth:SignedHeaderAuth").exists()→ always returnsFalse- This causes
ValueError: Unsupported auth methodeven when the module file exists
Expected Behavior
The path validation should:
- Extract the file path portion before the
:separator (class name) - Convert the module path (dots) to filesystem path (slashes)
- Check if that converted path exists
Proposed Fix
if method == "custom" and path:
# Extract file path before the ':' for existence check
file_path = path.split(":")[0] if ":" in path else path
# Convert module path (dots) to file path (slashes) and add .py
if "." in file_path and "/" not in file_path:
file_path = file_path.replace(".", "/") + ".py"
if Path(file_path).exists():
return {
"method": "custom",
"path": path,
}File Location
agentflow_cli/src/app/core/config/graph_config.py - auth_config() method
Example Configuration
{
"auth": {
"method": "custom",
"path": "src.auth.custom_auth:SignedHeaderAuth"
}
}Impact
- Severity: High
- Affected Users: Anyone using custom authentication with module:class path format
- Workaround: Manually patch the library file locally
Environment
- Python 3.13
- agentflow_cli (latest version)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels