T09 · Insecure Skill Coding Practices
Warning
- Location
- references/cookie-setup.md:19
- Finding
- Authentication Session Cookie Stored Without Enforced Access Controls< for instructions on obtaining SESSDATA 2. Guide the user to open Bilibili, log in, press `F12`, open Console, and run `console.log(document.cookie.match(/SESSDATA=([^;]+)/)?.[1])` 3. After the user pastes SESSDATA, save it as a Netscape-format cookie file at `~/.config/bilibili-cookies.txt` 4. If the user already has a cookie file, use it directly ``` ### Technical Analysis The Skill requires a Bilibili authentication cookie for authenticated subtitle retrieval, which is consistent with its declared functionality. Passing that cookie to `yt-dlp` for requests to Bilibili is therefore a necessary network use rather than evidence of unrelated exfiltration. However, the setup instructions require a reusable `SESSDATA` session credential to be pasted into an Agent conversation and stored as plaintext. They do not require the destination directory to have mode `0700`, the cookie file to have mode `0600`, a restrictive `umask`, or validation that an existing file is owned by the current user and is not a symbolic link. The privacy statement that the cookie does not provide control of the account understates the risk. A session cookie ...[truncated 1472 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Avoid asking users to paste session credentials into Agent conversations. Prefer a user-created cookie file, operating-system credential store, or a trusted browser-cookie integration with explicit consent. 2. Create the configuration directory and file with restrictive permissions: ```bash install -d -m 700 "$HOME/.config" umask 077 install -m 600 /dev/null "$HOME/.config/bilibili-cookies.txt" ``` 3. Before use, verify that the cookie file: - Is owned by the current user. - Is a regular file rather than a symbolic link. - Is not readable or writable by group or other users. 4. Write updates atomically through a private temporary file and then rename it into place. 5. Never print the cookie in command output, logs, error messages, or summaries. 6. Revise the privacy warning to identify `SESSDATA` as a sensitive account session credential and explain that theft may permit authenticated actions. 7. Document expiration, revocation, and deletion procedures, and remove the credential when it is no longer needed. ]]>
