@@ -68,43 +68,65 @@ def test_ssl_verify_FALSE_all_caps(self, monkeypatch):
6868
6969 assert server_module .SSL_VERIFY is False
7070
71- def test_ssl_verify_invalid_value_defaults_to_disabled (self , monkeypatch ):
72- """Invalid values should result in SSL verification being disabled (not 'true' )."""
71+ def test_ssl_verify_invalid_value_stays_enabled (self , monkeypatch ):
72+ """Invalid/unknown values should keep SSL verification ENABLED (fail-secure )."""
7373 monkeypatch .setenv ("MCP_FETCH_SSL_VERIFY" , "invalid" )
74-
74+
7575 import mcp_server_fetch .server as server_module
7676 importlib .reload (server_module )
77-
78- # Since "invalid".lower() != "true", SSL_VERIFY will be False
79- assert server_module .SSL_VERIFY is False
8077
81- def test_ssl_verify_empty_string_defaults_to_disabled (self , monkeypatch ):
82- """Empty string should result in SSL verification being disabled."""
78+ # Fail-secure: only explicit "false" disables SSL verification
79+ assert server_module .SSL_VERIFY is True
80+
81+ def test_ssl_verify_empty_string_stays_enabled (self , monkeypatch ):
82+ """Empty string should keep SSL verification ENABLED (fail-secure)."""
8383 monkeypatch .setenv ("MCP_FETCH_SSL_VERIFY" , "" )
84-
84+
8585 import mcp_server_fetch .server as server_module
8686 importlib .reload (server_module )
87-
88- assert server_module .SSL_VERIFY is False
8987
90- def test_ssl_verify_0_is_disabled (self , monkeypatch ):
91- """'0' should result in SSL verification being disabled."""
88+ # Fail-secure: only explicit "false" disables SSL verification
89+ assert server_module .SSL_VERIFY is True
90+
91+ def test_ssl_verify_0_stays_enabled (self , monkeypatch ):
92+ """'0' should keep SSL verification ENABLED (fail-secure, only 'false' disables)."""
9293 monkeypatch .setenv ("MCP_FETCH_SSL_VERIFY" , "0" )
93-
94+
9495 import mcp_server_fetch .server as server_module
9596 importlib .reload (server_module )
96-
97- assert server_module .SSL_VERIFY is False
9897
99- def test_ssl_verify_1_is_disabled (self , monkeypatch ):
100- """'1' should result in SSL verification being disabled (only 'true' enables it)."""
98+ # Fail-secure: only explicit "false" disables SSL verification
99+ assert server_module .SSL_VERIFY is True
100+
101+ def test_ssl_verify_1_stays_enabled (self , monkeypatch ):
102+ """'1' should keep SSL verification ENABLED (fail-secure)."""
101103 monkeypatch .setenv ("MCP_FETCH_SSL_VERIFY" , "1" )
102-
104+
103105 import mcp_server_fetch .server as server_module
104106 importlib .reload (server_module )
105-
106- # Only "true" (case-insensitive) enables SSL verification
107- assert server_module .SSL_VERIFY is False
107+
108+ # Fail-secure: only explicit "false" disables SSL verification
109+ assert server_module .SSL_VERIFY is True
110+
111+ def test_ssl_verify_yes_stays_enabled (self , monkeypatch ):
112+ """'yes' should keep SSL verification ENABLED (fail-secure)."""
113+ monkeypatch .setenv ("MCP_FETCH_SSL_VERIFY" , "yes" )
114+
115+ import mcp_server_fetch .server as server_module
116+ importlib .reload (server_module )
117+
118+ # Fail-secure: only explicit "false" disables SSL verification
119+ assert server_module .SSL_VERIFY is True
120+
121+ def test_ssl_verify_no_stays_enabled (self , monkeypatch ):
122+ """'no' should keep SSL verification ENABLED (fail-secure, only 'false' disables)."""
123+ monkeypatch .setenv ("MCP_FETCH_SSL_VERIFY" , "no" )
124+
125+ import mcp_server_fetch .server as server_module
126+ importlib .reload (server_module )
127+
128+ # Fail-secure: only explicit "false" disables SSL verification
129+ assert server_module .SSL_VERIFY is True
108130
109131
110132class TestSSLErrorHandling :
0 commit comments