Skip to content

fix(core,content): harden public-viewer resolver + agent/desktop/mail polish#526

Merged
steve8708 merged 3 commits intomainfrom
changes-116
May 6, 2026
Merged

fix(core,content): harden public-viewer resolver + agent/desktop/mail polish#526
steve8708 merged 3 commits intomainfrom
changes-116

Conversation

@steve8708
Copy link
Copy Markdown
Contributor

Summary

  • Security: harden public-viewer anonymous-owner resolver
    • Validate Referer origin matches app origin in `publicDocumentIdFromEvent`
    • Require exact `/_agent-native/builder/callback` path (not substring) in OAuth fallback
    • Discard expired status connect URLs (>9 min) before opening popup
  • Polish: agent sidebar toggle uses Tabler message-dots icon
  • Polish: desktop app suppresses stale route-chunk reloads
  • Polish: mail layout/inbox + calls/clips library sidebar tweaks

Changesets

  • `secure-public-viewer-resolver` — patch
  • `agent-toggle-message-dots` — patch
  • `quiet-desktop-webviews` — patch

🤖 Generated with Claude Code

…ent toggle icon + desktop webview chunk reload + mail layout polish
@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for agent-native-design ready!

Name Link
🔨 Latest commit 673a8e9
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-design/deploys/69fb719dd928460008812a08
😎 Deploy Preview https://deploy-preview-526--agent-native-design.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for agent-native-voice ready!

Name Link
🔨 Latest commit 673a8e9
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-voice/deploys/69fb719d3d147a00080ed051
😎 Deploy Preview https://deploy-preview-526--agent-native-voice.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for agent-native-meeting-notes ready!

Name Link
🔨 Latest commit 673a8e9
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-meeting-notes/deploys/69fb719d71078d0008569db3
😎 Deploy Preview https://deploy-preview-526--agent-native-meeting-notes.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

…lips share-dialog/regenerate-title + calendar root tweaks
@cloudflare-workers-and-pages

This comment has been minimized.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for agent-native-starter canceled.

Name Link
🔨 Latest commit 058f17a
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-starter/deploys/69fb6bcf2be4cf0008c94d08

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for agent-native-scheduling ready!

Name Link
🔨 Latest commit 673a8e9
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-scheduling/deploys/69fb719d2e244c000871f7ec
😎 Deploy Preview https://deploy-preview-526--agent-native-scheduling.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

builder-io-integration[bot]

This comment was marked as outdated.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for nutritrack-daily-calories canceled.

Name Link
🔨 Latest commit 058f17a
🔍 Latest deploy log https://app.netlify.com/projects/nutritrack-daily-calories/deploys/69fb6bce977b5400084a5568

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for agent-native-dispatch canceled.

Name Link
🔨 Latest commit 058f17a
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-dispatch/deploys/69fb6bce03a7240008387ae4

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for agent-native-issues canceled.

Name Link
🔨 Latest commit 058f17a
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-issues/deploys/69fb6bce37040800080cb1ef

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for agent-native-forms canceled.

Name Link
🔨 Latest commit 058f17a
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-forms/deploys/69fb6bce23349f0008305c88

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for agent-native-slides canceled.

Name Link
🔨 Latest commit 058f17a
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-slides/deploys/69fb6bcfa247970008cbbbe9

Copy link
Copy Markdown
Contributor

@builder-io-integration builder-io-integration Bot left a comment

Choose a reason for hiding this comment

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

Builder reviewed your changes — looks good ✅

Review Details

Code Review Summary — Blocking Security Issues Remain

Incremental Review Result: I've verified the latest commit and confirmed that all three critical security issues from the previous review remain unfixed. These are authentication/authorization vulnerabilities in the public-viewer resolver.

Risk Assessment: HIGH — Blocking merge until security issues are resolved.


🔴 THREE CRITICAL ISSUES (Still Unfixed)

All in templates/content/server/lib/public-documents.ts:

1. Origin validation fails open when host header is missing (Line 28)

  • Current: if (appOrigin && url.origin !== appOrigin) return null;
  • Problem: When host header is missing/stripped, appOrigin becomes null and validation is completely skipped
  • Attack: Attacker removes host header → origin check fails open → unauthorized document access
  • Fix: Change to if (!appOrigin || url.origin !== appOrigin) return null;

2. Path validation uses permissive endsWith() (Lines 75-76)

  • Current: Uses both === AND endsWith("/_agent-native/builder/callback")
  • Problem: endsWith() accepts paths like /evil/_agent-native/builder/callback
  • Attack: Attacker crafts path with arbitrary prefix → bypasses exact path check → reuses OAuth callback
  • Fix: Remove endsWith(), keep only exact equality: pathOnly === "/_agent-native/builder/callback"

3. UUID validation regex accepts malformed formats (Line 77)

  • Current: /^[0-9a-f-]{36}$/i matches any 36 chars of hex/dashes
  • Problem: Accepts invalid UUIDs like ----ffff----... instead of strict RFC 4122 format
  • Risk: Cookie validation is weakened; malformed IDs bypass identity checks
  • Fix: Use strict format: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i

✅ NEW WORK IN THIS COMMIT (Good)

  • Database scoping fix (scoping.ts, exec.ts): Correctly implements (org_id = X OR org_id IS NULL) to preserve legacy personal rows when org context is active. ✓ Secure.
  • Builder token TTL (useBuilderStatus.ts): Defensive improvement that discards tokens >9 minutes old. ✓ Sound.
  • Route chunk recovery tests: Comprehensive coverage of desktop suppression logic. ✓ Correct.

Summary

The core security hardening for public-viewer is incomplete. All three validation issues must be fixed in public-documents.ts before this PR can be approved. The new database scoping and TTL tracking work is good, but cannot unblock this PR while the authentication vulnerabilities remain.

🧪 Browser testing: Skipped — backend security changes only.

@steve8708 steve8708 merged commit 81d5b68 into main May 6, 2026
28 of 29 checks passed
@steve8708 steve8708 deleted the changes-116 branch May 6, 2026 17:06
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