security: harden server routes, PTY, webfetch, and auth#231
Merged
Conversation
Contributor
xiami762
commented
May 8, 2026
- Add URL guard and tighten webfetch/tool loading
- Restrict PTY to approved shells; authenticate PTY WebSocket before probe
- Resolve find paths via workspace guard; safer rg/grep/fd/find invocation
- Require admin for YAML plugin tool CRUD
- Gate tokenless loopback API auth behind FLOCKS_ALLOW_INSECURE_LOCAL
- Optional localhost CORS regex via FLOCKS_ALLOW_ANY_LOCALHOST_CORS
- Avoid leaking traceback in generic 500 responses
- Add regression tests
- Add URL guard and tighten webfetch/tool loading - Restrict PTY to approved shells; authenticate PTY WebSocket before probe - Resolve find paths via workspace guard; safer rg/grep/fd/find invocation - Require admin for YAML plugin tool CRUD - Gate tokenless loopback API auth behind FLOCKS_ALLOW_INSECURE_LOCAL - Optional localhost CORS regex via FLOCKS_ALLOW_ANY_LOCALHOST_CORS - Avoid leaking traceback in generic 500 responses - Add regression tests Co-authored-by: Cursor <cursoragent@cursor.com>
- When runtime host is loopback, allow 127.0.0.1, ::1, and localhost origins for the frontend port in CORS config - Export _FLOCKS_WEBUI_HOST/PORT in dev.sh for uvicorn so CORS matches the configured frontend host - Update CORS unit test expectations Co-authored-by: Cursor <cursoragent@cursor.com>
…guard - Initialize server_api_token in secrets before TUI spawns hidden serve - Add getFlocksAuthHeaders and sdk.fetch for skill install/status requests - Remove url_guard from YAML HTTP tools and webfetch; scheme-only URL check - Fallback to urllib in webfetch when aiohttp is unavailable - Remove url_guard module and obsolete security tests; adjust CLI TUI test Co-authored-by: Cursor <cursoragent@cursor.com>
…routes - Drop loopback local-service trust and insecure/PYTEST auth bypasses; use HTTPConnection helpers; update README auth docs - Remove FLOCKS_ALLOW_ANY_LOCALHOST_CORS CORS regex fallback - PTY: expand allowed shells, filter blocked startup/linker env, add -l only for shells that support login mode - Require admin for tool update/reset/refresh/reload; disable inline YAML execution unconditionally (use script handlers) Co-authored-by: Cursor <cursoragent@cursor.com>
duguwanglong
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.