Writing a TokenCap Plugin, and What the Sandbox Stops It From Doing

●1 ●8 ●29
calendar_today ago • schedule1 min read

TokenCap 3 plugins are local JS files listed under tokencapPlugins in your package.json.

Two hooks:

  • afterBuild gets the build's output path, file count and token estimate
  • beforeRedact can rewrite content before core redaction runs

Plus named tools: tokencap analyze plugins run <tool-name> --text "input".

The sandbox:

  • Own V8 realm; no require, no process, no network
  • File access only inside .tokencap/plugins/<name>/, with symlinks and junctions rejected
  • 1 s per call, 150 ms to load; overruns get disabled
  • A failing beforeRedact never blocks redaction

One honest caveat from the source: node:vm is not a security boundary. Plugins are trusted code.

Read more at tokencap.vansharora.app

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

Cisco's Amy Chang: A Model's "Passport" Doesn't Tell You Where It Actually Came From

Tom Smithverified - Aug 27

Make for Small Business: What It Is, What It Costs, and When to Use It

floxolab - Oct 23

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

Python for commerce students, from a former bio kid

rahuldk1105 - Oct 30

A Message From Our Founder: On the Winding Down of LaaSy™

Ken W. Algerverified - Oct 29
chevron_left
1.6k Points • 38 Badges
Jaipur, India • t.co/BRmkFprjYq
13Posts
5Comments
11Connections
tech freak

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!