Back to skill

Security audit

obsidian to notion

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says, syncing Markdown notes to Notion, but it can automatically trash existing Notion pages and exposes the Notion token in curl command arguments.

Review carefully before installing or running. Use a least-privilege Notion integration shared only with a test database first, back up the target database, and avoid syncing sensitive notes until the script has a dry-run or confirmation mode. Prefer replacing curl subprocess calls with an in-process HTTP client so the Notion token is not exposed in process listings.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/sync.py:69
Finding

Notion API Token Exposed Through Process Command-Line Arguments

Content
View full analysis
dict: headers = [ "-H", f"Authorization: Bearer {CONFIG['NOTION_KEY']}", "-H", "Notion-Version: 2026-03-11", "-H", "Content-Type: application/json" ] cmd = ["curl", "-s", "-X", "POST", url, "-d", json.dumps(payload)] + headers return json.loads(subprocess.run(cmd, capture_output=True, text=True).stdout) def notion_patch(url: str, payload: dict) -> dict: headers = [ "-H", f"Authorization: Bearer {CONFIG['NOTION_KEY']}", "-H", "Notion-Version: 2026-03-11", "-H", "Content-Type: application/json" ] cmd = ["curl", "-s", "-X", "PATCH", url, "-d", json.dumps(payload)] + headers return json.loads(subprocess.run(cmd, capture_output=True, text=True).stdout) ``` ### Technical Analysis Both HTTP helper functions place the Notion bearer token directly in the argument vector of a spawned `curl` process. Although `subprocess.run` uses an argument list and therefore does not introduce shell-command injection, the full authorization header can be visible through operating-system process inspection facilities while `curl` is running. Depending on the host configuration, local users, monitoring agents, debugging tools, audit systems, process collectors, or privileged container peers may be able to record the command line. Environment-based loading of `NOTION_API_KEY` does not prevent this exposure because the secret is subsequently copied into the child process arguments. ### Attack Path 1. A legitimate user configures `NOTION_API_KEY` and runs the synchronization script. 2. The script starts `curl` with `Authorization: Bearer ` in its command-line arguments. 3. An attacker with sufficient local process-observation access monitors proces ...[truncated 1263 chars]
Remediation
View remediation
dict: body = json.dumps(payload).encode("utf-8") request = urllib.request.Request( url, data=body, method=method, headers={ "Authorization": f"Bearer {CONFIG['NOTION_KEY']}", "Notion-Version": "2026-03-11", "Content-Type": "application/json", }, ) with urllib.request.urlopen(request, timeout=30) as response: return json.loads(response.read().decode("utf-8")) ``` The application must also handle non-success HTTP responses without including the authorization header in diagnostic output. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/sync.py:122
Finding

Non-Atomic Upsert Can Trash Existing Pages Before Replacement Succeeds

Content
View full analysis
Optional[str]: """Delete existing page with same title, then create new one""" if fname in existing_cache: old_id = existing_cache[fname] notion_patch(f"https://api.notion.com/v1/pages/{old_id}", {"in_trash": True}) del existing_cache[fname] if not blocks: return None payload = { "parent": {"database_id": db_id}, "properties": { _title_prop(): {"title": [{"text": {"content": fname}}]}, _date_prop(): {"date": {"start": date}}, _cat_prop(): {"select": {"name": cat}}, _tags_prop(): {"multi_select": [{"name": t} for t in tags]}, _status_prop(): {"select": {"name": CONFIG["DEFAULT_STATUS"]}} }, "children": blocks[:100] } resp = notion_api('https://api.notion.com/v1/pages', payload) ``` The subsequent error handling returns an error without restoring the original page: ```python if resp.get('object') == 'error': return f"Error: {resp.get('message', '')[:80]}" page_id = resp.get('id') if not page_id: return 'no_page_id' ``` ### Technical Analysis The upsert sequence trashes the existing page before checking whether there is valid replacement content and before successfully creating the replacement page. It also removes the old page from the in-memory cache immediately, without validating the response from the trash operation. This creates several failure modes: - If `blocks` is empty, the function returns after the old page has already been trashed. - If page creation fails due to an API error, sch ...[truncated 2334 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (17)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The README describes an upsert strategy of deleting same-named Notion pages before re-inserting them, but does not present this as a destructive operation or warn about possible data loss, broken references, loss of comments/history, or accidental deletion from name collisions. In this skill’s context, the operation targets a live Notion database, making the omission materially dangerous because users may run it expecting a safe in-place update.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

When a page title already exists, the script automatically trashes the existing Notion page before creating a replacement, with no confirmation, backup, or rollback logic. This can lead to unintended data loss or destructive modification of a remote knowledge base, especially because title collisions are easy and the operation happens in bulk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README instructs users to configure a Notion API token and sync Obsidian notes into Notion, but it does not clearly warn that note contents and associated metadata will be transmitted to a third-party service via the Notion API. In a note-syncing skill, users may reasonably include sensitive personal or work information in their vault, so omission of this disclosure can lead to unintended data exposure rather than a purely cosmetic documentation issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The natural-language instructions throughout the file are presented only in Chinese, which effectively forces a specific language for users. Under the stated policy, language-specific behavior should include user choice, opt-in, or a clearly documented and justified locale constraint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly documents an upsert strategy that trashes existing Notion pages with matching titles, but it does not present this as a destructive operation with a prominent warning, confirmation step, or recovery guidance. In a sync tool, title collisions are common, so users may unintentionally overwrite or trash legitimate content across their database.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The user-facing title and setup instructions are written entirely in Chinese, with no indication that other languages are supported or that the locale restriction is intentional and justified. Under the policy, language constraints should not be imposed without user opt-in or clear documentation of a region-specific reason.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/sync.py (reported line 77)May include surrounding context.

python
"-H", "Content-Type: application/json"
    ]
    cmd = ["curl", "-s", "-X", "POST", url, "-d", json.dumps(payload)] + headers
    return json.loads(subprocess.run(cmd, capture_output=True, text=True).stdout)


def notion_patch(url: str, payload: dict) -> dict:

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/sync.py (reported line 87)May include surrounding context.

python
"-H", "Content-Type: application/json"
    ]
    cmd = ["curl", "-s", "-X", "POST", url, "-d", json.dumps(payload)] + headers
    return json.loads(subprocess.run(cmd, capture_output=True, text=True).stdout)


def notion_patch(url: str, payload: dict) -> dict:

Tainted flow: 'cmd' from os.environ.get (line 86, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/sync.py (reported line 77)May include surrounding context.

python
"-H", "Content-Type: application/json"
    ]
    cmd = ["curl", "-s", "-X", "POST", url, "-d", json.dumps(payload)] + headers
    return json.loads(subprocess.run(cmd, capture_output=True, text=True).stdout)


def notion_patch(url: str, payload: dict) -> dict:

Tainted flow: 'cmd' from os.environ.get (line 86, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/sync.py (reported line 87)May include surrounding context.

python
"-H", "Content-Type: application/json"
    ]
    cmd = ["curl", "-s", "-X", "POST", url, "-d", json.dumps(payload)] + headers
    return json.loads(subprocess.run(cmd, capture_output=True, text=True).stdout)


def notion_patch(url: str, payload: dict) -> dict:

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/sync.py (reported line 109)May include surrounding context.

python
def get_existing_pages(db_id: str) -> Dict[str, str]:
    """Query all pages in DB, return {title: page_id} dict"""
    url = f"https://api.notion.com/v1/databases/{db_id}/query"
    payload = {"page_size": 100}
    all_pages = []
    while True:

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/sync.py (reported line 134)May include surrounding context.

python
def get_existing_pages(db_id: str) -> Dict[str, str]:
    """Query all pages in DB, return {title: page_id} dict"""
    url = f"https://api.notion.com/v1/databases/{db_id}/query"
    payload = {"page_size": 100}
    all_pages = []
    while True:

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/sync.py (reported line 149)May include surrounding context.

python
def get_existing_pages(db_id: str) -> Dict[str, str]:
    """Query all pages in DB, return {title: page_id} dict"""
    url = f"https://api.notion.com/v1/databases/{db_id}/query"
    payload = {"page_size": 100}
    all_pages = []
    while True:

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/sync.py (reported line 157)May include surrounding context.

python
def get_existing_pages(db_id: str) -> Dict[str, str]:
    """Query all pages in DB, return {title: page_id} dict"""
    url = f"https://api.notion.com/v1/databases/{db_id}/query"
    payload = {"page_size": 100}
    all_pages = []
    while True:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script uploads local note contents, tags, dates, and category metadata to Notion, but it does not provide a runtime warning, dry-run mode, or explicit confirmation before exfiltrating potentially sensitive local data to a third-party service. In a note-sync context this transmission is expected, but the lack of clear user-facing consent and scope preview can cause accidental disclosure of private information.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation instructs users to place a Notion API token directly into a script configuration block, but gives no warning about secret handling, accidental commits, or least-privilege configuration. This increases the likelihood of credential exposure through source control, screenshots, shared files, or reused scripts.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The docstring at L131 states the function will 'Delete existing page with same title, then create new one'. In implementation, L134 sends a PATCH setting in_trash: True, which archives/trashes the page rather than deleting it outright. This is an active mismatch between stated intent and behavior.

Content

No source excerpt is available for this finding.