Skip to content

fix: harden dashboard sessions and webhook ingress - #340

Merged
ecarreras merged 1 commit into
mainfrom
fix/issue-339-security-hardening
Nov 8, 2026
Merged

ecarreras merged 1 commit into
mainfrom
fix/issue-339-security-hardening

Conversation

@giscebot

@giscebot giscebot commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add signed iat/exp, an eight-hour default lifetime, a configurable session version, request-time allowlist/admin demotion checks, and an explicit logout flow
  • reject cookie-authenticated mutations unless Origin or Referer matches the configured dashboard origin; bearer MCP and signed webhook ingress remain outside that check
  • stream webhook bodies with an incremental hard cap and add a matching 1 MiB limit to the nginx example
  • make the current MCP trust decision explicit: token ownership controls lifecycle management, while repository knowledge remains deployment-global like the dashboard read model

Security and rollout notes

  • Legacy dashboard cookies have no expiry claim and are intentionally rejected after this update, so existing users must authenticate again.
  • Direct user/admin allowlist removals take effect on the next request. Organization/team membership is refreshed at the next OAuth login, bounded by the configured absolute session lifetime.
  • Incrementing GITHUB_AGENT_BRIDGE_DASHBOARD_SESSION_VERSION revokes all outstanding sessions without rotating the signing key.
  • The application-level webhook cap is effective with this code. The proxy-side cap requires deploying the updated nginx configuration; this PR does not change production configuration or claim rollout completion.
  • MCP knowledge is intentionally global within one bridge database. The UI and docs now call token users lifecycle owners rather than implying a repository ACL. Mutually untrusted tenants must not share the database/endpoint; a future repository ACL must cover both dashboard and MCP.

Tests

  • python3 -m pytest -q — 713 passed
  • cd dashboard && npm test — 79 passed
  • cd dashboard && npm run build

Fixes #339

Co-authored-by: ecarreras <ecarreras@users.noreply.github.com>

@pilipilisbot pilipilisbot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed f02e243 against #339 and the existing dashboard/webhook trust boundaries. Approve.

The signed session now has an absolute expiry and version, rejects legacy cookies, rechecks configured allowlists on each request, and demotes admins after direct allowlist removal. Cookie-authenticated mutations use a fail-closed same-origin check; the signed webhook and bearer MCP routes remain outside it. Webhook bodies are capped incrementally, and the MCP deployment-global knowledge model is stated explicitly rather than implying a per-user repository ACL.

Validation: PYTHONPATH=src /home/openclaw/.openclaw/workspace/github/github-agent-bridge/.venv/bin/python -m pytest -q tests/test_backend.py tests/test_webhook.py — 175 passed. GitHub Python 3.11/3.12 and dashboard checks are green. The proxy-side 1 MiB cap still needs the nginx configuration deployed, as the PR notes; this is an operational rollout step, not a code-review blocker.

@ecarreras
ecarreras merged commit fce118c into main Nov 8, 2026
4 checks passed
@ecarreras
ecarreras deleted the fix/issue-339-security-hardening branch November 8, 2026 13:31
@pilipilisbot

Copy link
Copy Markdown
Collaborator

Post-merge sync complete: #340 is merged as fce118c (head f02e243). The dedicated, clean github-agent-bridge-pr-340 worktree was removed and its absence verified; the canonical checkout was left untouched. Python 3.11/3.12 and dashboard CI jobs passed. The two agent status checks were still pending at this check, so this does not claim a completed rollout; the nginx body limit still requires deployment of the updated proxy configuration, as noted in the PR.

@giscebot

giscebot commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author

Post-merge follow-up: PR #340 is merged at fce118c7 and CI was green (pytest 3.11/3.12 and dashboard). The dedicated worktree github-agent-bridge-issue-339 was clean and has been removed; the canonical checkout was left untouched.

Operational follow-up remains separate from code completion: deploy the updated nginx configuration to enforce the proxy-side 1 MiB webhook cap, then observe it in production.

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.

Security audit: expire dashboard sessions, protect mutations, scope MCP, cap webhook bodies

3 participants