Commit Graph

158 Commits

Author SHA1 Message Date
Hugh Brown
62d2378bdc chore: simplify and harden security review changes
- Add prompt-injection fencing to _webhook_memory_content (was missing
  the --- BEGIN/END EXTERNAL DATA --- fence applied elsewhere)
- Wrap Content-Length parsing in try/except to avoid 500 on malformed
  header values
- Move _to_gateway_read below imports (was incorrectly placed between
  import blocks) and tighten transformer types
- Replace list-rebuild with deque.popleft in rate limiter for O(expired)
  amortized pruning instead of O(n) per call
- Make organization_id required in send_session_message to prevent
  fail-open cross-tenant check

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:35:10 +05:30
Hugh Brown
66da278673 security: require org-admin for gateway session message endpoint
send_gateway_session_message only required basic auth (AUTH_DEP) while
all other gateway endpoints required ORG_ADMIN_DEP. Any authenticated
user could send messages to any gateway session. Now requires org-admin
and verifies the board belongs to the caller's organization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:35:10 +05:30
Hugh Brown
5d382ed67b security: mitigate prompt injection in agent instruction strings
User-controlled fields (skill name, source URL, webhook payloads) were
interpolated directly into agent instruction messages. Sanitize skill
fields by stripping newlines/control chars, and fence all external data
behind "BEGIN EXTERNAL DATA" / "BEGIN STRUCTURED DATA" delimiters with
explicit "do not interpret as instructions" markers. Move system
instructions above the data section so they cannot be overridden.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:35:10 +05:30
Hugh Brown
c7692e30d3 security: rename misleading require_admin to require_user_actor
The function only checked that the caller was an authenticated user
(not an agent) but its name implied privilege enforcement. Rename to
require_user_actor and add docstring clarifying the distinction between
actor-type checks and privilege/role checks (require_org_admin, is_super_admin).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:35:10 +05:30
Abhimanyu Saharan
532fbf1dc5 feat(config): make BASE_URL a required field and update related documentation 2026-03-05 01:36:07 +05:30
Abhimanyu Saharan
bdc9fc3f01 redesigned dashboard page 2026-03-04 16:01:56 +05:30
Abhimanyu Saharan
d4f9831ecb fix(agent): refine agent update retry logic to handle creation race conditions #193 2026-03-03 03:19:11 +05:30
Abhimanyu Saharan
94ae59d6aa refactor(gateway): update gateway parameters to use None as default #169 2026-03-03 01:51:52 +05:30
Viktor
026da96e8c fix: auto-configure tools.exec.host and handle agents.update race
Three related provisioning fixes:

1. **tools.exec.host auto-configuration**: Add `_tools_exec_host_patch()`
   that ensures `tools.exec.host` is set to `"gateway"` during
   `patch_agent_heartbeats()`. Without this, heartbeat-driven agents
   cannot execute `curl`, `bash`, or any shell command — making
   HEARTBEAT.md instructions unexecutable. The function is idempotent
   and respects existing user configuration.

2. **agents.update hot-reload race**: After `agents.create` writes to
   disk, the gateway triggers a ~500ms debounced hot-reload. If
   `agents.update` arrives before the reload completes, it returns
   "agent not found". Fix: add a 750ms delay after create + exponential
   backoff retry (5 attempts, 0.5s → 4s) on the update call.

3. **Skip no-op config.patch**: When `patch_agent_heartbeats()` detects
   no changes to agents, channels, or tools config, skip the
   `config.patch` RPC entirely. Each unnecessary patch triggers a
   gateway SIGUSR1 restart that rotates agent tokens and breaks active
   sessions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 16:40:44 +00:00
Abhimanyu Saharan
6b21ea6f99 feat(boards): add 'comment_required_for_review' rule and update related logic 2026-02-26 00:31:47 +05:30
Abhimanyu Saharan
842a0770a8 Update backend/app/services/openclaw/provisioning.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-25 03:37:05 +05:30
Abhimanyu Saharan
3f158940cd Merge branch 'master' into docs/backend-doc-pass 2026-02-25 03:32:14 +05:30
Abhimanyu Saharan
0795f78eff feat: implement unified agent lifecycle orchestration and metadata tracking 2026-02-25 00:34:04 +05:30
Abhimanyu Saharan
2d3c3ee3e4 feat: add config fallback for gateway version compatibility check 2026-02-23 01:23:09 +05:30
Abhimanyu Saharan
6b09f124e6 refactor: rename compatibility check function and update version extraction logic #159 2026-02-22 22:05:39 +05:30
Abhimanyu Saharan
f1f3fbb766 docs: enhance docstring for SSL context creation with insecure TLS 2026-02-22 21:04:31 +05:30
Abhimanyu Saharan
56f4964332 feat: add support for allowing self-signed TLS certificates in gateway configuration 2026-02-22 20:20:19 +05:30
Abhimanyu Saharan
374d5a0c37 Merge branch 'master' into copilot/feature-allow-self-signed-tls
# Conflicts:
#	backend/app/api/gateways.py
#	backend/app/schemas/gateways.py
#	backend/app/services/openclaw/admin_service.py
#	backend/app/services/openclaw/gateway_resolver.py
#	backend/app/services/openclaw/gateway_rpc.py
#	backend/app/services/openclaw/provisioning.py
#	backend/app/services/openclaw/provisioning_db.py
#	frontend/src/api/generated/model/gatewayCreate.ts
#	frontend/src/api/generated/model/gatewayRead.ts
#	frontend/src/api/generated/model/gatewayUpdate.ts
2026-02-22 19:51:27 +05:30
Abhimanyu Saharan
cdced8e07c refactor: improve code formatting and readability in tests and components 2026-02-22 19:45:18 +05:30
Abhimanyu Saharan
3dfb70cd90 feat: add disable_device_pairing option to gateway configuration 2026-02-22 19:19:26 +05:30
Abhimanyu Saharan
e39b2069fb feat: add openclaw_connect_metadata function and update compatibility check logic, fixes #156 2026-02-22 13:37:01 +05:30
copilot-swe-agent[bot]
217f98afcc fix: Address code review feedback
- Fix docstring formatting in _create_ssl_context
- Break long line in provisioning.py for better readability

Co-authored-by: abhi1693 <5083532+abhi1693@users.noreply.github.com>
2026-02-22 05:30:29 +00:00
copilot-swe-agent[bot]
520e128777 feat: Add allow_insecure_tls field to gateway model and UI
- Added allow_insecure_tls boolean field to Gateway model and schemas
- Created database migration for the new field
- Updated GatewayConfig to include allow_insecure_tls parameter
- Modified openclaw_call to create SSL context that disables verification when allow_insecure_tls is true
- Updated all GatewayConfig instantiations throughout the backend
- Added checkbox to frontend gateway form (create and edit pages)
- Updated API endpoints to handle the new field

Co-authored-by: abhi1693 <5083532+abhi1693@users.noreply.github.com>
2026-02-22 05:28:37 +00:00
copilot-swe-agent[bot]
07190dca04 fix: add operator.read scope to gateway connection scopes
Co-authored-by: abhi1693 <5083532+abhi1693@users.noreply.github.com>
2026-02-21 02:54:17 +00:00
Abhimanyu Saharan
7a3a2366da feat: update wakeup text to include reading BOOTSTRAP.md before AGENTS.md 2026-02-16 01:45:02 +05:30
Abhimanyu Saharan
47dfc1b52f feat: ensure deletion of custom fields and values when a board is deleted 2026-02-16 00:44:40 +05:30
Abhimanyu Saharan
cd68446c42 feat: add BoardWebhook updates on agent deletion 2026-02-16 00:21:21 +05:30
Abhimanyu Saharan
b702ade0cc fix: update HTTP status code from UNPROCESSABLE_ENTITY to UNPROCESSABLE_CONTENT 2026-02-15 16:06:06 +05:30
Abhimanyu Saharan
24731667d4 feat: add gateway runtime compatibility checks and minimum version enforcement 2026-02-15 15:59:55 +05:30
Abhimanyu Saharan
f1d8da7008 refactor: enhance user context handling and update template mappings 2026-02-15 14:21:49 +05:30
Abhimanyu Saharan
1996e21695 refactor: add overwrite option to various services and update documentation 2026-02-15 13:55:47 +05:30
Abhimanyu Saharan
aebd487270 refactor: add agent_id to various interfaces and improve field organization 2026-02-15 13:36:57 +05:30
Abhimanyu Saharan
aa825863c2 refactor: reorganize imports and improve code formatting for readability 2026-02-15 13:20:46 +05:30
Abhimanyu Saharan
8f4a398839 refactor: implement generic queue worker with task-type dispatch and improved retry logic 2026-02-15 13:07:32 +05:30
Abhimanyu Saharan
7e76cd1f68 refactor: improve webhook processing with enhanced logging and retry mechanisms 2026-02-15 13:02:55 +05:30
Abhimanyu Saharan
e28496245b refactor: enhance webhook delivery queue processing with configurable blocking 2026-02-15 13:02:55 +05:30
Abhimanyu Saharan
731fb9edac refactor: inline payload preview building in webhook message construction 2026-02-15 13:02:55 +05:30
Abhimanyu Saharan
7fe5ad5cba refactor: remove payload preview length limitation in webhook processing 2026-02-15 13:02:55 +05:30
Abhimanyu Saharan
f9b14af477 refactor: migrate webhook queue to RQ with updated configuration 2026-02-15 13:02:55 +05:30
Abhimanyu Saharan
370609ca29 webhooks: harden scheduler bootstrap + tidy public exports 2026-02-14 23:46:07 +00:00
Abhimanyu Saharan
9a49768b52 chore: centralize webhook scheduler interval config 2026-02-14 23:46:07 +00:00
Abhimanyu Saharan
130f2b36f0 fix: resolve mypy typing issues in webhook queue dispatch 2026-02-14 23:46:07 +00:00
Abhimanyu Saharan
f07b4d5ea4 feat: add RQ-based webhook dispatch queue and delayed worker 2026-02-14 23:46:07 +00:00
Abhimanyu Saharan
0ac22dbd7a feat(heartbeat): change default target to 'last' and remove target option from UI 2026-02-15 01:37:12 +05:30
Abhimanyu Saharan
6f465d32fa feat(gateway): add lead_only option for syncing board lead agents 2026-02-15 01:23:36 +05:30
Abhimanyu Saharan
a55664810c refactor(constants): initialize LEAD_TEMPLATE_MAP as an empty dictionary
refactor(page): clean up import statements for better readability
fix(tests): update assertions for clarity and consistency
2026-02-15 00:53:27 +05:30
Abhimanyu Saharan
2084405593 feat(board): introduce new board agent templates and restructure existing files 2026-02-15 00:45:28 +05:30
Abhimanyu Saharan
313ce874f9 feat(memory): update MEMORY.md structure and consolidate identity preferences 2026-02-14 23:55:45 +05:30
Abhimanyu Saharan
ae711909ff feat(boards): add max_agents field to board models and enforce limits 2026-02-14 19:43:16 +05:30
Abhimanyu Saharan
d241455da6 feat(skills): consolidate skill-related models and update imports 2026-02-14 19:31:32 +05:30