Skip to content

Commit 15bd15e

Browse files
CodeCasterXclaude
andauthored
fix: 修复socket绑定到所有网络接口的安全问题 (CodeQL #3) (#351)
将 get_free_tcp_port() 函数中的socket绑定地址从空字符串 '' (等同于 0.0.0.0) 改为 _LOCAL_HOST (127.0.0.1),避免将socket暴露到所有网络接口。 这修复了 CodeQL 扫描警报 #3 (CWE-200: 信息泄露),消除了中等严重程度的安全风险。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 48e5a1e commit 15bd15e

File tree

1 file changed

+1
-1
lines changed
  • framework/fit/python/fitframework/utils

1 file changed

+1
-1
lines changed

framework/fit/python/fitframework/utils/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def to_bool(value: Union[str, int, bool]):
5353

5454
def get_free_tcp_port() -> int:
5555
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
56-
s.bind(('', 0))
56+
s.bind((_LOCAL_HOST, 0))
5757
return s.getsockname()[1]
5858

5959

0 commit comments

Comments
 (0)