T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/search_notes.py:25- Finding
Workspace-Wide Notion Search Exceeds the Declared Single-Page Scope
- Content
View full analysis
Vulnerability Details
File Location:
scripts/search_notes.py:25-46
Vulnerability Type: Excessive Notion data access and insufficient scope restriction
Risk Level: MediumVulnerable Code
python def search(query, page_size=10): """Search using Notion Search API with retry on rate limit.""" body = { "query": query, "page_size": page_size, "sort": { "direction": "descending", "timestamp": "last_edited_time", }, } for attempt in range(3): data = json.dumps(body).encode() req = urllib.request.Request( f"{BASE_URL}/search", data=data, headers=get_headers(), method="POST", ) try: resp = urllib.request.urlopen(req) return json.loads(resp.read())Technical Analysis
The Skill is described as operating on a single Notion page identified by
NOTION_PARENT_PAGE_ID. However, the search implementation calls Notion's general/v1/searchendpoint and does not restrict or post-filter results to that configured page or its descendants.The endpoint searches objects visible to the Notion integration. If the integration has access to multiple pages or data sources, the script may retrieve metadata for content unrelated to the configured target page. Returned results are subsequently formatted to expose page titles, edit dates, and portions of page URLs.
The request necessarily transmits the Notion integration token and user-supplied search term to Notion. Sending these values to the official Notion API is consistent with search functionality, but using the integration's entire visible workspace scope is broader than the declared single-page behavior.
Attack Path
- A user grants the Notion integration access to the intended page and one or more unrelated pages or data sources.
- An agent or user in ...[truncated 773 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace workspace-wide search with traversal and local filtering of blocks beneath
NOTION_PARENT_PAGE_ID. - If the Notion Search API must be used, validate every returned page against the configured page hierarchy before displaying it.
- Explicitly document workspace-wide search and request informed user consent if that broader scope is intentional.
- Recommend that users authorize the integration only for the target page and avoid granting workspace-wide access.
- Add tests proving that search results outside the configured page are discarded.
- Replace workspace-wide search with traversal and local filtering of blocks beneath
