T09 · Insecure Skill Coding Practices
- Location
SKILL.md:16- Finding
Notion API Key Stored Without Explicitly Restrictive File Permissions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 16–20
Vulnerability Type: Insecure plaintext credential storage
Risk Level: MediumVulnerable Code
bash mkdir -p ~/.config/notion echo "ntn_your_key_here" > ~/.config/notion/api_keyTechnical Analysis
The setup instructions store a Notion integration token in a plaintext file but do not explicitly restrict permissions on either the containing directory or the credential file. The resulting access permissions depend on the user's current
umaskand any pre-existing permissions on~/.config/notion.On a shared or otherwise compromised system, an overly permissive configuration could allow another local account or process to read the token. The command also encourages direct insertion of the credential into a shell command, which may expose it through shell history.
Attack Path
- A user follows the documented setup procedure and writes a valid Notion integration token to
~/.config/notion/api_key. - The user's
umask, directory permissions, or pre-existing file permissions allow access by another local account or process. - An attacker reads the plaintext token from the credential file.
- The attacker submits requests to
https://api.notion.comusingAuthorization: Bearer <stolen-token>. - The attacker accesses or modifies resources shared with the compromised Notion integration, subject to its configured capabilities.
Impact Assessment
Successful exploitation grants the attacker the same Notion API privileges as the compromised integration. The affected scope includes pages, databases, blocks, and files shared with that integration. Depending on the integration's capabilities, the attacker may read sensitive workspace content, create or modify records, append blocks, or upload files. This does not inherently grant access to Notion resources that were not shared with the integration.
- A user follows the documented setup procedure and writes a valid Notion integration token to
- Remediation
View remediation
Remediation Suggestions
Create the credential directory and file with explicit owner-only permissions:
bash install -d -m 700 "$HOME/.config/notion" umask 077 printf '%s\n' "$NOTION_KEY" > "$HOME/.config/notion/api_key" chmod 600 "$HOME/.config/notion/api_key"Do not place the actual token directly in an interactive shell command, because it may be retained in shell history. Prefer reading it silently or retrieving it from an operating-system credential manager:
bash install -d -m 700 "$HOME/.config/notion" IFS= read -r -s -p "Notion API key: " NOTION_KEY printf '\n' umask 077 printf '%s\n' "$NOTION_KEY" > "$HOME/.config/notion/api_key" unset NOTION_KEYWhere practical, use a dedicated secret manager or OS keychain instead of a plaintext file. Configure the Notion integration with the minimum required capabilities and share only necessary pages or databases. Rotate the token immediately if unauthorized file access is suspected.
