Skip to content

feat(frontend): enforce auth through httpOnly cookies #10201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 29 commits into
base: dev
Choose a base branch
from

Conversation

0ubbe
Copy link
Contributor

@0ubbe 0ubbe commented Jun 20, 2025

Changes πŸ—οΈ

Implemented httpOnly cookies πŸͺ for secure session management πŸ’†πŸ½

  • πŸ™πŸ½ Moved all API requests to server-side execution for maximum XSS protection

    • All authentication now happens server-side with httpOnly cookies (no JWT tokens exposed to client)
    • Created proxyApiRequest() and proxyFileUpload() server actions to handle all communication with API
    • Updated BackendAPI._request() to always use proxy approach for consistent security
  • 🚧 Exception: WebSocket authentication requires client-side token exposure

    • Added getWebSocketToken() server action to securely provide tokens only for WebSocket connections
    • Maintains secure architecture while we keep the real-time features
  • 🧹 Abstracted implementation details into reusable helper functions

    • Reduced proxy actions from 157 lines to 48 lines (70% reduction)
    • Added flexible content-type support ( JSON, form-urlencoded, custom )
    • Enhanced error handling for graceful logout scenarios
  • πŸ“™ Renamed /reset_password page to /reset-password

    • couldn't resist sorry... snake case URLs get me

Checklist πŸ“‹

For code changes:

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan:
    • Verify all API requests work through server-side proxy
    • Confirm httpOnly cookies prevent client-side JWT access
    • Test WebSocket connections work with server-provided tokens
    • Verify logout scenarios don't throw authentication errors
    • Check file uploads work securely through proxy
    • Validate zero breaking changes for existing BackendAPI calls

Copy link

netlify bot commented Jun 20, 2025

βœ… Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
πŸ”¨ Latest commit a57deb9
πŸ” Latest deploy log https://app.netlify.com/projects/auto-gpt-docs-dev/deploys/685555fd5a69940008071c11

Copy link

netlify bot commented Jun 20, 2025

βœ… Deploy Preview for auto-gpt-docs canceled.

Name Link
πŸ”¨ Latest commit a57deb9
πŸ” Latest deploy log https://app.netlify.com/projects/auto-gpt-docs/deploys/685555fd4ebd4500082a9ecd

@github-actions github-actions bot added the platform/frontend AutoGPT Platform - Front end label Jun 20, 2025
Copy link

deepsource-io bot commented Jun 20, 2025

Here's the code health analysis summary for commits 91ea322..a57deb9. View details on DeepSourceΒ β†—.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScriptβœ…Β Success
❗ 14 occurences introduced
🎯 13 occurences resolved
View CheckΒ β†—
DeepSource Python LogoPythonβœ…Β SuccessView CheckΒ β†—

πŸ’‘ If you’re a repository administrator, you can configure the quality gates from the settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/frontend AutoGPT Platform - Front end size/xl
Projects
Status: πŸ†• Needs initial review
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants