Extend the plugins' isolation surface area#22
Conversation
Add pemToDer, base64urlEncode, and base64urlDecode helpers for use by plugins that need to strip PEM armor or encode/decode base64url. Supports PKCS#8, PKCS#1, SEC1, SPKI, and certificate PEM headers.
…olContext New types: - WebCryptoFormat — normalized key format for Web Crypto import - FsStat — stat result (size, type, timestamps) - FsDirent — directory entry (name, type) - FsApi — sandbox-aware filesystem interface PluginToolContext gains crypto.loadNormalizedKey and fs (readTextFile, writeTextFile, stat, listDir). These bridge the sandbox boundary through RPC for plugin workers or directly for the engine context.
Engine ctx: - crypto.loadNormalizedKey: normalize PEM/DER key to PKCS#8/SPKI using node:crypto, reading via sandbox path or inline data - fs.readTextFile / writeTextFile / stat / listDir: sandbox-aware filesystem access with mount mapping and conditional access checks Plugin worker RPC: - Forward crypto.loadNormalizedKey, fs.*, paths.* calls from worker to runtime via RpcChannel handlers - worker-main.ts buildCtx creates stubs that proxy through RPC
…edKey Replace manual PEM resolution and Node crypto.createPrivateKey/sign with ctx.crypto.loadNormalizedKey (auto-detects PKCS#1/PKCS#8/SEC1) and SDK base64urlEncode. JWT signing now uses Web Crypto via the runtime's normalized key, removing the direct dependency on fs and crypto module internals from plugin code.
SDK 0.5.0 adds: - WebCryptoFormat, FsStat, FsDirent, FsApi types - crypto.loadNormalizedKey and fs on PluginToolContext - pemToDer, base64urlEncode, base64urlDecode utilities All plugins with peerDependency on @cireilclaw/sdk updated to ^0.5.0
Add crypto.loadNormalizedKey to the PluginToolContext interface and its note. List new SDK exports (pemToDer, base64urlEncode, base64urlDecode) in the SDK exports section.
|
PR changed again? Review this PR in Change Stack to compare snapshots and stay oriented. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (13)
📝 WalkthroughWalkthroughThis PR extends the plugin runtime with WebCrypto-based key normalization and sandboxed filesystem operations. The SDK defines types and encoding utilities; the runtime implements RPC handlers for crypto and filesystem access with access control; workers expose these as plugin APIs; the GitHub plugin refactors JWT signing to use the new async crypto; and all dependencies are updated. ChangesPlugin crypto and filesystem capabilities
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Expands the surface area of what we (currently pretend to) isolate (so in the future we can actually do it) to a few new fields.
Filesystem, and critically due to the GitHub plugin, cryptography.
SDK + Plugins require a version bump due to this too. Publishing once PR is merged.