T09 · Insecure Skill Coding Practices
- Location
references/setup.md:23- Finding
Notion API Token Stored Without Explicitly Restrictive File Permissions
- Content
View full analysis
Vulnerability Details
File Location:
references/setup.md, lines 23–26
Vulnerability Type: Plaintext credential storage with umask-dependent permissions
Risk Level: MediumVulnerable Code
bash mkdir -p ~/.config/notion echo "ntn_your_key_here" > ~/.config/notion/api_keyThe credential is subsequently loaded at
references/setup.md, lines 32–36:bash export NOTION_VERSION=2025-09-03 if [ -z "${NOTION_KEY:-}" ] && [ -f ~/.config/notion/api_key ]; then export NOTION_KEY="$(cat ~/.config/notion/api_key)" fiTechnical Analysis
The optional setup procedure writes the Notion integration token to a plaintext file but does not explicitly restrict the permissions of either the
~/.config/notiondirectory or theapi_keyfile. Their effective permissions therefore depend on the user's current umask and any preexisting directory permissions.Under a permissive umask or unsuitable preexisting permissions, other local users or processes may be able to read the credential. Loading the file into
NOTION_KEYthen permits its use as a bearer token for authenticated Notion API requests.Attack Path
- A user follows the documented optional fallback setup and writes the Notion token to
~/.config/notion/api_key. - The shell's umask or preexisting filesystem permissions leave the directory or file readable by another local account or compromised process.
- The attacker reads the plaintext token from the file.
- The attacker submits requests to
https://api.notion.comusingAuthorization: Bearer <stolen-token>. - The attacker reads or modifies Notion resources accessible to the integration, subject to the integration's configured capabilities and sharing scope.
This attack requires local filesystem access through another account, a compromised local process, or an equivalent foothold capable of reading the token file.
Impact Assessment
A stolen token grants the attacker the same effective Notion API privi ...[truncated 468 chars]
- A user follows the documented optional fallback setup and writes the Notion token to
- Remediation
View remediation
Remediation Suggestions
Prefer runtime secret injection or an operating-system credential manager instead of a plaintext fallback file. If local file storage is required, create the directory and credential with explicit restrictive permissions:
bash install -d -m 700 ~/.config/notion umask 077 printf '%s\n' "ntn_your_key_here" > ~/.config/notion/api_key chmod 600 ~/.config/notion/api_keyAdditional hardening measures:
- Verify ownership before reading the file.
- Reject credential files with group or world permissions.
- Avoid placing real tokens directly in reusable shell history.
- Configure the Notion integration with only the capabilities required for its tasks.
- Share the integration only with the minimum necessary pages and data sources.
- Rotate the token immediately if unauthorized filesystem access is suspected.
