Skip to content

Commit c6bed25

Browse files
committed
feat: enhance schema fetching and add edge case tests
- Updated schema fetching logic to handle cases where the "servers" key may be absent or empty. - Improved credential redaction patterns for better security. - Introduced a comprehensive suite of edge case tests covering various functions, including authentication parsing, identity handling, instruction processing, and variable parsing. - Refactored planner tests to support asynchronous execution, ensuring robust testing of planning and re-planning functionalities.
1 parent 9ef6841 commit c6bed25

5 files changed

Lines changed: 1336 additions & 13 deletions

File tree

src/secnodeapi/memory/semantic/ingestion.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
TargetProfile,
1717
)
1818

19-
# Credential patterns to redact
19+
# Credential patterns to redact (order matters: more specific first)
2020
_REDACT_PATTERNS = [
21+
(re.compile(r"(?i)authorization\s*:\s*Bearer\s+\S+", re.I), "Authorization: [REDACTED]"),
2122
(re.compile(r"(?i)authorization\s*:\s*[^\s]+", re.I), "Authorization: [REDACTED]"),
2223
(re.compile(r"(?i)x-api-key\s*:\s*[^\s]+", re.I), "X-API-Key: [REDACTED]"),
2324
(re.compile(r"(?i)password['\"]?\s*[:=]\s*['\"]?[^\s'\"]+", re.I), "password=[REDACTED]"),

src/secnodeapi/schema_fetcher.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ def analyze_api_structure(schema: Dict[str, Any], schema_target: Optional[str] =
105105
request_body_schema={"present": has_body}
106106
))
107107

108-
raw_base = schema.get("servers", [{"url": "/"}])[0].get("url", "/")
108+
servers = schema.get("servers") or [{"url": "/"}]
109+
raw_base = servers[0].get("url", "/") if servers else "/"
109110
base_url = _resolve_base_url(raw_base, schema_target)
110111

111112
return SchemaStructure(

0 commit comments

Comments
 (0)