Back to skill

Security audit

Notion Workspace

Security checks for vulnerabilities and agentic risk

Overview

This Notion skill mostly does what it says, but it ships and uses an embedded Notion token that could expose or modify a workspace the user did not intend to use.

Install only after removing the embedded token, rotating/revoking the exposed Notion integration token, and requiring your own NOTION_TOKEN. Use a least-privilege Notion integration shared only with the pages or databases you intend to manage, and treat create/append commands as real workspace modifications.

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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/notion.py:17
Finding

Hard-Coded Notion Integration Token

Content
View full analysis

Vulnerability Details

File Location: scripts/notion.py:17
Vulnerability Type: Hard-coded credential / plaintext secret
Risk Level: High

Vulnerable Code

python
NOTION_TOKEN = os.environ.get("NOTION_TOKEN", "ntn_R368210231801s4MMnfbcy6pFjMrW0hk2DhcmK01vmJ9n8")

The exposed credential is subsequently included in every API request:

python
def _headers():
    return {
        "Authorization": f"Bearer {NOTION_TOKEN}",
        "Notion-Version": NOTION_VERSION,
        "Content-Type": "application/json",
    }

The insecure fallback behavior is also explicitly documented in SKILL.md:15-20:

markdown
Set your Notion integration token:
```bash
export NOTION_TOKEN=ntn_...

Or the default token embedded in the script will be used.

text

### Technical Analysis

The script embeds a live-format Notion integration token as the default value of `NOTION_TOKEN`. If the environment variable is absent, the program silently authenticates with this shared credential. Any person with access to the package, source repository, build artifacts, logs, or historical revisions can extract the token and use it independently of the CLI.

Notion integration tokens authorize access to resources shared with the corresponding integration. The script supports searching and reading accessible content as well as creating pages and appending blocks. Consequently, the exposed token could permit both disclosure and modification of workspace information, depending on the integration's configured capabilities and page/database access.

Embedding the credential also creates a cross-user boundary problem: users who do not configure their own token may unknowingly query or modify resources belonging to the token owner.

### Attack Path

1. An attacker obtains the skill package, source code, or a repository revision containing `scripts/notion.py`.
2. The attacker reads line 17 and extracts the embedded Notion integration token.
3. The attacker sends requests to 
...[truncated 1188 chars]
Remediation
View remediation

Remediation Suggestions

  1. Revoke the exposed Notion integration token immediately and issue a replacement. Treat it as compromised even if no misuse has been observed.
  2. Remove the hard-coded fallback and require an externally supplied credential:
    python
    NOTION_TOKEN = os.environ.get("NOTION_TOKEN")
    if not NOTION_TOKEN:
        raise RuntimeError("NOTION_TOKEN must be configured")
    
  3. Supply the token through an approved secret manager, protected environment injection mechanism, or operating-system credential store.
  4. Remove statements in SKILL.md that instruct users to rely on an embedded default token. Document secure configuration and token rotation instead.
  5. Purge the exposed value from repository history, release archives, package registries, cached build artifacts, logs, and documentation.
  6. Review the integration's Notion audit history for unauthorized activity and inspect accessible pages and databases for unexpected modifications.
  7. Apply least privilege to the replacement integration: grant only necessary capabilities and share only the pages or databases required for its intended operation.
  8. Add automated secret scanning to source-control and release pipelines, and block commits containing Notion token patterns or other credentials.
  9. Avoid printing credentials or request authorization headers in diagnostics and ensure environment variables are not exposed in logs.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The documentation indicates a default embedded Notion token may be used, which is an undisclosed credentialing behavior beyond the stated environment-based configuration. Embedded credentials are dangerous because they can grant unintended access, hide the true trust boundary, and enable unauthorized use of a third party's Notion workspace.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code embeds a hardcoded Notion API token directly in source, which is a real credential exposure issue. Anyone who obtains the script can use that token to access the linked Notion workspace through the integration, potentially reading databases/pages and performing writes allowed by the token's scopes.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

Using a hardcoded fallback credential means the script will silently authenticate to a real Notion workspace even when the user has not intentionally supplied credentials. In a workspace-management skill, this is especially dangerous because it enables undisclosed access to external data and may cause actions to occur against the author's or another shared workspace.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill declares no explicit tool scope despite requiring environment access and outbound network access to the Notion API. This weakens reviewability and containment because users and platforms cannot clearly see or restrict the capability boundary before execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The setup section mentions the Notion integration token but does not explain that it is a sensitive secret or that workspace data will be transmitted to the Notion API. In this context, missing privacy and credential-handling guidance increases the chance of token leakage, overbroad sharing, or uninformed data exposure.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Stating that an embedded default token will be used means the skill may authenticate with credentials unknown to the user. In a workspace-management skill, this is especially risky because the token could expose private pages or permit writes into a workspace the operator did not intend to access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill includes write operations such as creating pages and appending blocks without clearly warning that these commands modify user data. This can cause accidental integrity impact in Notion workspaces, especially when invoked by an agent or through automation where the user may assume actions are read-only.

Content

No source excerpt is available for this finding.

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 · references/notion-api.md (reported line 8)May include surrounding context.

md
NOTION_TOKEN = os.environ.get("NOTION_TOKEN", "ntn_R368210231801s4MMnfbcy6pFjMrW0hk2DhcmK01vmJ9n8")
NOTION_VERSION = "2022-06-28"
BASE_URL = "https://api.notion.com/v1"


def _headers():

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/notion.py (reported line 19)May include surrounding context.

python
NOTION_TOKEN = os.environ.get("NOTION_TOKEN", "ntn_R368210231801s4MMnfbcy6pFjMrW0hk2DhcmK01vmJ9n8")
NOTION_VERSION = "2022-06-28"
BASE_URL = "https://api.notion.com/v1"


def _headers():

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The create_page and append_blocks functions perform remote modifications to user data in Notion, but the code provides no confirmation prompt or prior disclosure before making those changes. Although success is printed afterward, there is no warning before the irreversible write occurs.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.