From 5aae2aa197ca3233abb1c9ad6d83c6575828f101 Mon Sep 17 00:00:00 2001 From: ronitchidara Date: Wed, 28 Jan 2026 13:48:29 +0530 Subject: [PATCH] security: comprehensive pre-PR security audit fixes (rebased) --- .agent/workflows/update_clawdbot.md | 8 +- .github/ISSUE_TEMPLATE/bug_report.md | 4 +- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 4 +- CONTRIBUTING.md | 2 +- apps/android/README.md | 2 +- .../bot/molt/android/NodeCommandHandlers.kt | 17 +++ .../java/bot/molt/android/NodeGatewaySync.kt | 43 ++++++ .../android/push/ClawdbotMessagingService.kt | 36 ++++- .../java/bot/molt/android/ui/SettingsSheet.kt | 2 +- .../bot/molt/android/ui/chat/ChatComposer.kt | 2 +- .../android/ui/chat/ChatMessageListCard.kt | 2 +- apps/ios/README.md | 2 +- .../Sources/Chat/OfflineMessageQueue.swift | 9 +- apps/ios/Sources/Settings/SettingsTab.swift | 2 +- .../Settings/TTSVoiceSettingsView.swift | 2 +- .../MoltbotIPCTests/AgentWorkspaceTests.swift | 2 +- apps/shared/MoltbotKit/Package.resolved | 42 ++++++ .../Sources/MoltbotChatUI/ChatComposer.swift | 2 +- .../MoltbotChatUI/ChatMessageViews.swift | 2 +- .../Sources/MoltbotKit/CanvasA2UIJSONL.swift | 13 +- assets/chrome-extension/README.md | 6 +- docs/compliance/access-control-policy.md | 8 +- docs/compliance/change-management.md | 10 +- docs/compliance/incident-response.md | 10 +- docs/compliance/index.md | 6 +- docs/compliance/readiness-checklist.md | 2 +- docs/compliance/security-metrics.md | 8 +- docs/compliance/vulnerability-disclosure.md | 18 +-- docs/concepts/self-healing.md | 4 +- docs/contributing/plugins.md | 12 +- docs/contributing/skills.md | 14 +- docs/enterprise/deployment.md | 6 +- docs/enterprise/observability.md | 4 +- docs/enterprise/security-hardening.md | 2 +- docs/experiments/research/memory.md | 6 +- docs/gateway/configuration-examples.md | 2 +- docs/reference/AGENTS.default.md | 4 +- docs/reference/feature-maturity.md | 6 +- docs/reference/templates/AGENTS.dev.md | 8 +- docs/reference/templates/IDENTITY.dev.md | 8 +- docs/reference/templates/SOUL.dev.md | 14 +- docs/security/data-handling.md | 10 +- docs/security/threat-model.md | 6 +- extensions/copilot-proxy/README.md | 2 +- extensions/google-antigravity-auth/README.md | 2 +- extensions/google-gemini-cli-auth/README.md | 2 +- extensions/llm-task/README.md | 6 +- extensions/lobster/README.md | 12 +- extensions/nostr/README.md | 4 +- extensions/qwen-portal-auth/README.md | 2 +- extensions/tlon/README.md | 4 +- extensions/twitch/README.md | 2 +- extensions/voice-call/README.md | 6 +- extensions/zalo/README.md | 2 +- extensions/zalouser/README.md | 4 +- load-tests/run.ts | 2 +- skills/sag/SKILL.md | 4 +- src/agents/bash-tools.exec.ts | 3 + src/agents/pi-tools.ts | 1 + src/auto-reply/inbound.test.ts | 4 +- src/canvas-host/a2ui/.bundle.hash | 1 + src/commands/agents.identity.test.ts | 6 +- src/config/config.identity-defaults.test.ts | 2 +- src/config/types.gateway.ts | 15 +++ src/discord/monitor.test.ts | 22 +-- src/gateway/http-metrics.ts | 7 +- src/gateway/server-methods/chat.ts | 45 +++++-- src/gateway/server.impl.ts | 32 +++++ .../server/ws-connection/message-handler.ts | 62 ++++++++- src/hooks/bundled/README.md | 2 +- src/hooks/bundled/soul-evil/README.md | 2 +- src/infra/exec-blocklist.test.ts | 40 +++--- src/infra/exec-blocklist.ts | 89 +++--------- src/infra/secrets-manager.ts | 46 ++++--- src/node-host/runner.ts | 9 +- src/pairing/pairing-store.ts | 127 +++++++++++++++++- src/security/audit-log.ts | 21 ++- src/security/rbac.ts | 58 ++++++++ src/web/auto-reply/mentions.test.ts | 2 +- ...captures-media-path-image-messages.test.ts | 4 +- ui/src/ui/controllers/marketplace.ts | 27 +++- ui/src/ui/voice-input.ts | 47 +++++++ 83 files changed, 798 insertions(+), 304 deletions(-) create mode 100644 apps/shared/MoltbotKit/Package.resolved create mode 100644 src/canvas-host/a2ui/.bundle.hash diff --git a/.agent/workflows/update_clawdbot.md b/.agent/workflows/update_clawdbot.md index 692ee84e4..e45120089 100644 --- a/.agent/workflows/update_clawdbot.md +++ b/.agent/workflows/update_clawdbot.md @@ -1,8 +1,8 @@ --- -description: Update Clawdbot from upstream when branch has diverged (ahead/behind) +description: Update Moltbot from upstream when branch has diverged (ahead/behind) --- -# Clawdbot Upstream Sync Workflow +# Moltbot Upstream Sync Workflow Use this workflow when your fork has diverged from upstream (e.g., "18 commits ahead, 29 commits behind"). @@ -129,10 +129,10 @@ pnpm mac:package ```bash # Kill running app -pkill -x "Clawdbot" || true +pkill -x "Moltbot" || true # Move old version -mv /Applications/Clawdbot.app /tmp/Clawdbot-backup.app +mv /Applications/Clawdbot.app /tmp/Moltbot-backup.app # Install new build cp -R dist/Clawdbot.app /Applications/ diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 46ee3da04..8258aec66 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Report a problem or unexpected behavior in Clawdbot. +about: Report a problem or unexpected behavior in Moltbot. title: "[Bug]: " labels: bug --- @@ -20,7 +20,7 @@ What did you expect to happen? What actually happened? ## Environment -- Clawdbot version: +- Moltbot version: - OS: - Install method (pnpm/npx/docker/etc): diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 26c896f06..5bd0c94bc 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,7 +2,7 @@ blank_issues_enabled: true contact_links: - name: Onboarding url: https://discord.gg/clawd - about: New to Clawdbot? Join Discord for setup guidance from Krill in #help. + about: New to Moltbot? Join Discord for setup guidance from Krill in #help. - name: Support url: https://discord.gg/clawd about: Get help from Krill and the community on Discord in #help. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 742bf184e..2c73c3e9f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,6 +1,6 @@ --- name: Feature request -about: Suggest an idea or improvement for Clawdbot. +about: Suggest an idea or improvement for Moltbot. title: "[Feature]: " labels: enhancement --- @@ -9,7 +9,7 @@ labels: enhancement Describe the problem you are trying to solve or the opportunity you see. ## Proposed solution -What would you like Clawdbot to do? +What would you like Moltbot to do? ## Alternatives considered Any other approaches you have considered? diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2b4cc27f9..0e7a7a3d3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ AI PRs are first-class citizens here. We just want transparency so reviewers kno ## Contribution Guides -Detailed guides for extending Clawdbot: +Detailed guides for extending Moltbot: - **[Skills Guide](https://docs.clawd.bot/contributing/skills)** - Create and publish skills to ClawdHub - **[Plugins Guide](https://docs.clawd.bot/contributing/plugins)** - Build plugins for channels, tools, and more diff --git a/apps/android/README.md b/apps/android/README.md index ca0967643..57a6eb4b3 100644 --- a/apps/android/README.md +++ b/apps/android/README.md @@ -1,4 +1,4 @@ -## Clawdbot Node (Android) (internal) +## Moltbot Node (Android) (internal) Modern Android node app: connects to the **Gateway WebSocket** (`_clawdbot-gw._tcp`) and exposes **Canvas + Chat + Camera**. diff --git a/apps/android/app/src/main/java/bot/molt/android/NodeCommandHandlers.kt b/apps/android/app/src/main/java/bot/molt/android/NodeCommandHandlers.kt index d2c42f272..ecba13246 100644 --- a/apps/android/app/src/main/java/bot/molt/android/NodeCommandHandlers.kt +++ b/apps/android/app/src/main/java/bot/molt/android/NodeCommandHandlers.kt @@ -316,11 +316,28 @@ internal fun NodeRuntime.hasBackgroundLocationPermission(): Boolean { // MARK: - Helper Extension +/** + * Escape a string for safe embedding in JSON and JavaScript. + * + * SECURITY: Handles all necessary escaping including: + * - Standard JSON escapes (backslash, quotes, control chars) + * - HTML script-breaking sequences (defense-in-depth) + * - Unicode control characters + */ private fun String.toJsonStringEscaped(): String { val escaped = this .replace("\\", "\\\\") .replace("\"", "\\\"") .replace("\n", "\\n") .replace("\r", "\\r") + .replace("\t", "\\t") + .replace("\b", "\\b") + .replace("\u000C", "\\f") + // Defense-in-depth: escape sequences that could break HTML script context + .replace("", "<\\/script>", ignoreCase = true) + .replace("