Skip to content

fix(security): add auth to /events/sync endpoint (#3452) - #3459

Merged
mrveiss merged 1 commit into
mainfrom
fix/issue-3452
Apr 4, 2026
Merged

mrveiss merged 1 commit into
mainfrom
fix/issue-3452

Conversation

@mrveiss

@mrveiss mrveiss commented Apr 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds get_current_user dependency at APIRouter level in events.py so every route under /events requires a valid bearer token
  • The /events/sync endpoint was previously unauthenticated, allowing any caller to inject arbitrary events into the database

Test plan

  • Unauthenticated POST to /events/sync now returns 401
  • Authenticated POST with valid token succeeds as before

Closes #3452

🤖 Generated with Claude Code

Apply get_current_user dependency at APIRouter level so every
route under /events requires a valid bearer token.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

AutoBot Phase Validation Results

System Maturity: 0.0%

Phase Status:

Recommendations:

@github-actions

github-actions Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

@mrveiss

mrveiss commented Apr 4, 2026

Copy link
Copy Markdown
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@mrveiss
mrveiss merged commit eef3f15 into main Apr 4, 2026
9 of 15 checks passed
@mrveiss
mrveiss deleted the fix/issue-3452 branch April 4, 2026 20:31
@mrveiss

mrveiss commented Apr 4, 2026

Copy link
Copy Markdown
Owner Author

Code review

Found 1 issue:

  1. Adding get_current_user at the router level will break all node agent event syncs. sync_buffered_events() in autobot-slm-backend/slm/agent/agent.py calls POST /api/events/sync via aiohttp.ClientSession().post(url, json=payload, ...) with no Authorization header. Every sync call will return 401, silently breaking the event pipeline. The _AUTH_EXEMPT_PREFIXES entry in security_headers.py only bypasses the middleware-level CSRF guard — it does not bypass the FastAPI dependency. The endpoint was intentionally unauthenticated (see the middleware comment: # agent event sync — node_id validated in endpoint (#3193)); agents identify themselves via node_id in the payload body instead.

router = APIRouter(
prefix="/events",
tags=["events"],
dependencies=[Depends(get_current_user)],
)

Agent call site (no auth headers sent):

for e in events
]
async with session.post(
url,
json=payload,
timeout=aiohttp.ClientTimeout(total=30),
ssl=False,
) as response:
if response.status == 200:
ids = [e[0] for e in events]
placeholders = ",".join("?" * len(ids))

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

mrveiss added a commit that referenced this pull request Apr 8, 2026
…updates (#3949)

* fix(workflow): prevent checkpoint expiry for paused workflows (#3231) (#3448)

* fix(security): add auth to /events/sync endpoint (#3452) (#3459)

Apply get_current_user dependency at APIRouter level so every
route under /events requires a valid bearer token.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(security): add auth to browser MCP endpoints (#3451) (#3460)

/browser/mcp/status requires get_current_user.
/browser/mcp/navigate and /browser/mcp/screenshot require require_admin
as they can trigger arbitrary page loads and screenshot capture.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(security): revert get_current_user on /events/sync — agents have no bearer token (#3452)

The router-level get_current_user dependency breaks all node agent
event syncs: agents post to /api/events/sync with no Authorization
header and are identified by node_id validated against the Node table.
The endpoint is intentionally exempt from bearer-token auth per
security_headers.py (#3193). Add explanatory comment documenting
the intended security model.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(security): harden ALLOWED_EXECUTABLES — dpkg/git-stash/find guards (#3450)

* fix(slm): remove write-capable executables from ALLOWED_EXECUTABLES (#3450)

- Remove apt, yum, dnf, rpm (package install/remove) from allowlist entirely
- Remove wget, curl (arbitrary file write/exfiltration), nmap (network scanner
  with --script exploit support) from allowlist entirely
- Add _GIT_ALLOWED_SUBCOMMANDS frozenset; _validate_command now rejects any
  git subcommand not in the read-only set (status, log, diff, show, branch,
  tag, remote, describe, shortlog, rev-parse, ls-files, ls-remote, stash)
- find: _validate_command rejects any command containing -exec or -execdir tokens
- Fix the inaccurate inline comment that claimed callers enforce git read-only;
  enforcement is now in _validate_command itself
- Add tests for all new guards (write-capable rejection, git subcommand guard,
  find -exec guard)

Closes #3450

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(security): add dpkg and git-stash argument guards (#3450)

Address review findings on PR #3457:
- dpkg: restrict to read-only query flags (-l/-s/-L/-S/--list etc);
  -i/--install/--purge/--unpack and all write flags now return HTTP 400
- git stash: tokens[2] is now validated; only stash list/show pass;
  stash pop/drop/clear/push/apply return HTTP 400
- Add tests for both guards in nodes_execution_test.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(deps): bump defu (#3624)

Bumps the npm_and_yarn group with 1 update in the /autobot-frontend directory: [defu](https://github.com/unjs/defu).


Updates `defu` from 6.1.4 to 6.1.6
- [Release notes](https://github.com/unjs/defu/releases)
- [Changelog](https://github.com/unjs/defu/blob/main/CHANGELOG.md)
- [Commits](unjs/defu@v6.1.4...v6.1.6)

---
updated-dependencies:
- dependency-name: defu
  dependency-version: 6.1.6
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump the npm_and_yarn group across 2 directories with 2 updates (#3623)

Bumps the npm_and_yarn group with 2 updates in the /autobot-frontend directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) and [defu](https://github.com/unjs/defu).
Bumps the npm_and_yarn group with 1 update in the /autobot-slm-frontend directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite).


Updates `vite` from 8.0.3 to 8.0.5
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.5/packages/vite)

Updates `defu` from 6.1.4 to 6.1.6
- [Release notes](https://github.com/unjs/defu/releases)
- [Changelog](https://github.com/unjs/defu/blob/main/CHANGELOG.md)
- [Commits](unjs/defu@v6.1.4...v6.1.6)

Updates `vite` from 7.3.1 to 7.3.2
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.5/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 8.0.5
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: defu
  dependency-version: 6.1.6
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: vite
  dependency-version: 7.3.2
  dependency-type: direct:development
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump the npm_and_yarn group across 4 directories with 2 updates

Bumps the npm_and_yarn group with 2 updates in the /.mcp directory: [@hono/node-server](https://github.com/honojs/node-server) and [hono](https://github.com/honojs/hono).
Bumps the npm_and_yarn group with 2 updates in the /autobot-infrastructure/shared/mcp/tools/mcp-autobot-tracker directory: [@hono/node-server](https://github.com/honojs/node-server) and [hono](https://github.com/honojs/hono).
Bumps the npm_and_yarn group with 2 updates in the /autobot-infrastructure/shared/mcp/tools/mcp-structured-thinking directory: [@hono/node-server](https://github.com/honojs/node-server) and [hono](https://github.com/honojs/hono).
Bumps the npm_and_yarn group with 2 updates in the /autobot-infrastructure/shared/mcp/tools/mcp-task-manager-server directory: [@hono/node-server](https://github.com/honojs/node-server) and [hono](https://github.com/honojs/hono).


Updates `@hono/node-server` from 1.19.11 to 1.19.13
- [Release notes](https://github.com/honojs/node-server/releases)
- [Commits](honojs/node-server@v1.19.11...v1.19.13)

Updates `hono` from 4.12.7 to 4.12.12
- [Release notes](https://github.com/honojs/hono/releases)
- [Commits](honojs/hono@v4.12.7...v4.12.12)

Updates `@hono/node-server` from 1.19.11 to 1.19.13
- [Release notes](https://github.com/honojs/node-server/releases)
- [Commits](honojs/node-server@v1.19.11...v1.19.13)

Updates `hono` from 4.12.7 to 4.12.12
- [Release notes](https://github.com/honojs/hono/releases)
- [Commits](honojs/hono@v4.12.7...v4.12.12)

Updates `@hono/node-server` from 1.19.11 to 1.19.13
- [Release notes](https://github.com/honojs/node-server/releases)
- [Commits](honojs/node-server@v1.19.11...v1.19.13)

Updates `hono` from 4.12.7 to 4.12.12
- [Release notes](https://github.com/honojs/hono/releases)
- [Commits](honojs/hono@v4.12.7...v4.12.12)

Updates `@hono/node-server` from 1.19.11 to 1.19.13
- [Release notes](https://github.com/honojs/node-server/releases)
- [Commits](honojs/node-server@v1.19.11...v1.19.13)

Updates `hono` from 4.12.7 to 4.12.12
- [Release notes](https://github.com/honojs/hono/releases)
- [Commits](honojs/hono@v4.12.7...v4.12.12)

---
updated-dependencies:
- dependency-name: "@hono/node-server"
  dependency-version: 1.19.13
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: hono
  dependency-version: 4.12.12
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: "@hono/node-server"
  dependency-version: 1.19.13
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: hono
  dependency-version: 4.12.12
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: "@hono/node-server"
  dependency-version: 1.19.13
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: hono
  dependency-version: 4.12.12
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: "@hono/node-server"
  dependency-version: 1.19.13
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: hono
  dependency-version: 4.12.12
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Martins Veiss <martins.veiss@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sec(slm): /events/sync endpoint missing authentication

1 participant