Skip to content

hotfix(middleware): P0 — add missing return after AbortWithStatusJSON in CanvasOrBearer - #2040

Merged
molecule-ai[bot] merged 7 commits into
stagingfrom
hotfix/canvasorbearer-return-main
Apr 24, 2026
Merged

molecule-ai[bot] merged 7 commits into
stagingfrom
hotfix/canvasorbearer-return-main

Conversation

@molecule-ai

@molecule-ai molecule-ai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

P0 Security Fix — CanvasOrBearer Auth Bypass

Severity: P0 | Confirmed by App-QA audit of origin/main @ 69408ab

Bug

CanvasOrBearer final else branch calls c.AbortWithStatusJSON(401, ...) without return. Execution falls through to c.Next(), allowing the downstream handler to overwrite the 401 response.

Confirmed on

Fix

+return after c.AbortWithStatusJSON — single line.

Regression tests added

  • TestCanvasOrBearer_TokensExist_NoCreds_Returns401: verifies handler NOT called, body NOT written after abort
  • TestCanvasOrBearer_TokensExist_WrongOrigin_Returns401: same, for wrong-origin path

Scope

Cosmetic route only (PUT /canvas/viewport) — CVSS Low per security audit. No sensitive data exposure. Fast-track approval requested.

Labels

security hotfix p0

🤖 Generated with Claude Code

Molecule AI Infra Lead and others added 3 commits April 24, 2026 14:12
Root cause of PR #1981 E2E failures (step 7 timeout):
- hermes-agent install from NousResearch (Node 22 tarball + Python
  deps from source) + gateway health wait takes 15-25 min on staging
- install.sh runs BEFORE molecule-runtime launches, blocking heartbeats
- bootstrap-watcher fires at 5 min (cp#245) → workspace=failed
- workspace never recovers because molecule-runtime never starts in time

Fix: increase WS_DEADLINE from 1200s (20 min) to 1800s (30 min) to
give hermes cold-boot enough runway. Also bump job timeout-minutes
from 30 → 45 to accommodate the longer wait.

Medium-term: fix cp#245 (bootstrap-watcher hermes deadline too short)
in molecule-controlplane to reduce false-failed noise.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause of PR #1981 E2E failures (step 7 timeout):
- hermes-agent install from NousResearch (Node 22 tarball + Python
  deps from source) + gateway health wait takes 15-25 min on staging
chore: sync staging to main — 2026-04-24 04h (71 commits)
@github-actions
github-actions Bot changed the base branch from main to staging April 24, 2026 17:35
@github-actions

Copy link
Copy Markdown
Contributor

[retarget-bot] This PR was opened against main and has been retargeted to staging automatically.

Why: per SHARED_RULES rule 8, all feature work targets staging first; the CEO promotes staging → main separately.

What changed: just the base branch — no code change. CI will re-run against staging. If you get merge conflicts, rebase on staging.

If this PR is the CEO's staging→main promotion: the Action skipped you (only bot-authored PRs are retargeted). If you see this comment on your CEO PR, that's a bug — please tag @HongmingWang-Rabbit.

@molecule-ai molecule-ai Bot mentioned this pull request Apr 24, 2026
molecule-ai Bot added a commit that referenced this pull request Apr 24, 2026
…ne 946 — resolves Platform(Go) CI compile error on PR #2040
…4-24-final

chore: promote sync-to-main-final → main (finish #1981)
@molecule-ai
molecule-ai Bot force-pushed the hotfix/canvasorbearer-return-main branch from 87a5bd7 to 1447f4d Compare April 24, 2026 18:03
Molecule AI CP-BE and others added 2 commits April 24, 2026 18:04
…asOrBearer

P0 security: CanvasOrBearer final else branch aborts with 401 but
continues execution to c.Next() — allowing the downstream handler to
overwrite the 401 response. Regression tests added to verify the handler
is not called after AbortWithStatusJSON in both no-cred and wrong-origin
paths.

Confirmed on origin/main @ 69408ab and origin/staging @ 6b62391.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ne 946 — resolves Platform(Go) CI compile error on PR #2040
@molecule-ai
molecule-ai Bot force-pushed the hotfix/canvasorbearer-return-main branch from 1447f4d to f715574 Compare April 24, 2026 18:04
@molecule-ai

molecule-ai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

Closing — fix is now in staging via sync PR #2036 (commit 4034f0d). CanvasOrBearer return will reach main through normal staging→main sync.

@molecule-ai
molecule-ai Bot enabled auto-merge April 24, 2026 18:11
@molecule-ai
molecule-ai Bot added this pull request to the merge queue Apr 24, 2026
Merged via the queue into staging with commit 90def3f Apr 24, 2026
15 checks passed
@molecule-ai
molecule-ai Bot deleted the hotfix/canvasorbearer-return-main branch May 20, 2026 06:22
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.

1 participant