Introduction¶
When DeepSeek Harness (DSH) agents need to read pages that require an authenticated session, they can typically only access them anonymously. Browser cookies are stored in an encrypted format, making them inaccessible to external programs. Even if the encryption were bypassed, using cookies to make requests directly within the Host process poses security risks. This plugin, through a browser extension, a local receiver, an in-memory Vault, and a read-only CDP browser, restricts cookie usage to domains that users approve on a per-domain basis.
What It Is¶
dsh-plugin-cookie-whitelist is a DSH plugin maintained by wth373737, categorized under admin-security. It allows the agent to read web pages using your authenticated session only on domains you approve individually; all other sites are accessed anonymously. Cookie values are stored in memory only—never written to disk, never appearing in logs, settings pages, or tool results.
Core Capabilities¶
- Browser extension reads cookies: Uses the
chrome.cookiesorbrowser.cookiesAPI within Chrome / Edge / Firefox to read cookies. - Domain whitelist filtering: The extension filters cookies against the whitelist domains specified in the task before they leave the browser.
- Local receiver: Filtered cookies are sent to
http://127.0.0.1:<port>with a pairing token. - In-memory Vault: The Host process stores cookies in a pure in-memory Vault, with no disk persistence.
- Read-only CDP browser: The agent uses a one-shot incognito instance of local Chrome / Edge to read web pages. Before each navigation, browser cookies are cleared, and only cookies matching the current URL’s whitelisted domain are injected.
- Read-only interaction: The agent can navigate, read body content, click pagination/expand links, scroll, and take screenshots; it cannot fill forms or submit them. The plugin blocks
fillat the tool layer, interceptssubmit/requestSubmit/window.openat the page script layer, and rejects all non-GET/HEAD/OPTIONSrequests at the CDP network layer. - Authorization is a user action: When the agent calls
cookie_authorize, it can only request; actual addition to the whitelist requires in-chat native approval or the “Allow and add to whitelist” action on the settings page. Requests have a timeout and expire automatically. - Receiver listens on 127.0.0.1 only: All
/v1/*requests require a pairing token;http(s)Origins from regular web pages are rejected with 403; the extension only allowschrome-extension:///moz-extension://.
Installation & Activation¶
1. Install the DSH Plugin¶
Install from GitHub:
dsh plugin --profile desktop add github:wth373737/dsh-plugin-cookie-whitelist
After installation, open the settings page under Settings → Cookie Whitelist. The receiver listens on 127.0.0.1:47821 by default; if the port is occupied, it will automatically try subsequent ports, and the settings page will display the actual port in use.
2. Load the Browser Extension¶
Chrome / Edge
- Open
chrome://extensionsoredge://extensions. - Enable “Developer mode” in the top-right corner.
- Click “Load unpacked extension” → select
extension/chromiumfrom the plugin directory. - Open the extension’s “Options,” enter the receiver address and pairing token displayed on the settings page, and save.
- Click “Test Connection”; return to the DSH settings page—the extension status should change to “Connected.”
Firefox
- Open
about:debugging#/runtime/this-firefox. - Click “Load Temporary Add-on” → select
extension/firefox/manifest.json. - Open the extension options, enter the receiver address and token, save, and test.
3. Add to Whitelist¶
- Enter a domain on the settings page → “Add to Whitelist,” or
- Let the agent request it: it calls
cookie_authorize, and you approve in chat; you can also approve/reject individually under “Authorization Requests” on the settings page later. - Once added, the extension will read that domain’s cookies on the next polling cycle; click “Let extension sync now” on the settings page to trigger an immediate sync.
4. Temporary Login (When No Extension Is Available or Using a Different Browser)¶
- First, add the domain to the whitelist.
- On the settings page, under “Temporary Browser Login,” enter the domain → “Open Login Window.”
- Manually log in (including captcha/2FA) in the popped-up Chrome/Edge incognito window.
- Return to the settings page and click “Finish and Extract”; cookies enter the in-memory Vault, and the window and temporary profile are immediately destroyed.
Typical Usage¶
The plugin provides four agent tools:
cookie_whitelist_status: View the whitelist, pending authorization requests, extension heartbeat, Vault entry count, and read-only browser status. Never returns cookie values.cookie_authorize: Request to add a domain to the whitelist. Creates a pending item first, then goes through in-chat native approval; without a UI, it remains as a pending item on the settings page.cookie_sync: Instruct the extension to re-read cookies for specified (or all) whitelisted domains; returns only a count.cookie_browse: Read-only browser:open/read/snapshot/click/scroll/screenshot/files/read_file/status/close.
Typical workflow:
cookie_whitelist_status
cookie_authorize { domain: "example.com", reason: "Read course list" }
cookie_sync { domains: ["example.com"] }
cookie_browse { action: "open", url: "https://example.com/" }
cookie_browse { action: "read" }
cookie_browse { action: "click", ref: "..." } // Only for pagination/expand
Files & Course Planner¶
When a course page places Test dates, Schedule, Rubric, or Guidelines in PDF/Office files, list candidates first, then read:
cookie_browse { action: "files" }
cookie_browse { action: "read_file", url: "<Course Planner mod/resource link>" }
read_file downloads using the current whitelisted cookies. PDFs have text extracted via pdfjs-dist (with pagination/character limits supported). If mod/resource/view.php is itself an HTML wrapper page, it will preferentially follow PDF links whose names contain Course Planner / Planner / Schedule / Syllabus / Teaching Plan; otherwise, it returns fileCandidates for you to choose from. If a file exceeds the default 8 MB, it will request permission via in-chat approval. By default, files are discarded after reading and not retained. To keep a file, explicitly state so or use keep: true.
Use Cases & Notes¶
This plugin is suited for scenarios where you need the agent to read pages requiring an authenticated session, while wanting to limit cookie usage scope, avoid persistent storage, and prevent accidental form submissions.
The plugin runs with the current dsh process’s permissions. Review the source code and license before installation. MIT License.
In Summary¶
This plugin uses a browser extension, a local receiver, and an in-memory Vault to restrict cookie usage to user-approved domains, combined with a read-only CDP browser to fulfill the agent’s need to access authenticated pages while minimizing potential security risks.
Directory: https://www.skillhub.cn/plugins/wth373737/dsh-plugin-cookie-whitelist
GitHub: https://github.com/wth373737/dsh-plugin-cookie-whitelist