You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bounty proposal] fix(notion): sanitize uid and eliminate reflected parameter injection in html routes ($25 proposed) #14490
In plugins/omi-notion-app/main.py, the root HTML presentation endpoint (GET /) accepts a uid query parameter without strict formatting validation or escaping:
Reflected URL / Attribute Injection in GET /:
When uid is supplied, it is formatted directly into links:
Supplying malicious query values (e.g. "><script src=//evil.com/x.js></script> or javascript:...) breaks out of standard link attributes and creates reflected script injection risks.
Unvalidated Query Parameters in OAuth & Setup Endpoints:
The /auth/notion, /setup/notion, and /disconnect endpoints accept arbitrary string lengths and control characters as uid.
Root Cause
Missing canonical UID format validation (_sanitize_uid) and missing HTML attribute escaping (html.escape(..., quote=True)).
Proposed Fix
Implement _sanitize_uid(uid: Optional[str]) -> Optional[str] enforcing strict alphanumeric, underscore, and hyphen format (max 128 chars).
Apply _sanitize_uid in GET /, falling back to the default service metadata JSON if the UID is absent or malformed.
Escape rendered attributes via html.escape(clean_uid, quote=True).
Validate uid in /auth/notion (returning 400 Bad Request on invalid format), /setup/notion (returning {"is_setup_completed": False}), and /disconnect.
Add comprehensive unit tests in test_notion_security.py verifying valid formats, attack payloads, and response escaping.
@josancamon19 Following the contribution guidelines, a $25 bounty is proposed for this security hardening fix and unit test suite.
Activity
fix(notion): import re and html in main.py for uid validation and esc…
fix(notion): sanitize uid and eliminate reflected parameter injection…