mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-21 07:36:40 +00:00
fix: Distributed API auth hardening — Bearer tokens and URL normalization
- Extend WS upgrade handler to accept Authorization: Bearer tokens as a fallback to cookie auth. Remote Sencho instances receive proxied WS connections carrying Bearer (no cookie), so the previous cookie-only check caused immediate 401 rejections for all proxied log/terminal streams. - Log token validation failures in authMiddleware (was silently swallowed, violating no-empty-catch directive). - Normalize api_url by stripping trailing slashes in testRemoteConnection, the HTTP proxy target, and the WS proxy target to prevent double-slash URLs.
This commit is contained in:
@@ -154,7 +154,8 @@ export class NodeRegistry {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await axios.get(`${node.api_url}/api/auth/check`, {
|
||||
const baseUrl = node.api_url.replace(/\/$/, '');
|
||||
const response = await axios.get(`${baseUrl}/api/auth/check`, {
|
||||
headers: { Authorization: `Bearer ${node.api_token}` },
|
||||
timeout: 8000,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user