openclaw/extensions/2fa-github/moltbot.plugin.json
gerald Ruby 8262a03060 feat: add GitHub 2FA gate extension for sensitive tools
Add a new extension that gates sensitive tool calls (exec, Bash, Write,
Edit, NotebookEdit) behind GitHub Device Flow authentication. Users must
approve on GitHub Mobile or enter a code at github.com/login/device
before the bot can execute dangerous operations.

Key changes:
- Wire up before_tool_call hook in tool execution path (tool-hook-wrapper.ts)
- Create 2fa-github extension with:
  - GitHub Device Authorization Flow implementation
  - File-based session store with TTL (~/.clawdbot/2fa-sessions.json)
  - Non-blocking flow: returns immediately with code, user retries after approval
  - Configurable tool list and session TTL (default 30 min)

Configuration:
  plugins.entries.2fa-github.config.clientId: "Ov23..."
  # or GITHUB_2FA_CLIENT_ID env var

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:32:13 -08:00

47 lines
1.2 KiB
JSON

{
"id": "2fa-github",
"name": "GitHub Mobile 2FA Gate",
"description": "Gates sensitive tools behind GitHub Mobile push authentication",
"uiHints": {
"clientId": {
"label": "GitHub OAuth App Client ID",
"placeholder": "Ov23xxxxxxxxxxxxxxxxxx",
"help": "Create at GitHub Settings > Developer Settings > OAuth Apps (enable Device Flow)"
},
"tokenTtlMinutes": {
"label": "Session TTL (minutes)",
"placeholder": "30",
"help": "How long before re-authentication is required"
},
"sensitiveTools": {
"label": "Sensitive Tools",
"help": "Tool names requiring 2FA (default: Bash, Write, Edit, NotebookEdit)"
},
"gateAllTools": {
"label": "Gate All Tools",
"help": "Require 2FA for all tools, not just sensitive ones"
}
},
"configSchema": {
"type": "object",
"additionalProperties": false,
"properties": {
"clientId": {
"type": "string"
},
"tokenTtlMinutes": {
"type": "number"
},
"sensitiveTools": {
"type": "array",
"items": {
"type": "string"
}
},
"gateAllTools": {
"type": "boolean"
}
}
}
}