mcp-security-framework 1.2.1__py3-none-any.whl → 1.2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_security_framework/__init__.py +1 -1
- mcp_security_framework/schemas/config.py +14 -4
- {mcp_security_framework-1.2.1.dist-info → mcp_security_framework-1.2.2.dist-info}/METADATA +1 -1
- {mcp_security_framework-1.2.1.dist-info → mcp_security_framework-1.2.2.dist-info}/RECORD +8 -8
- tests/test_schemas/test_config.py +50 -0
- {mcp_security_framework-1.2.1.dist-info → mcp_security_framework-1.2.2.dist-info}/WHEEL +0 -0
- {mcp_security_framework-1.2.1.dist-info → mcp_security_framework-1.2.2.dist-info}/entry_points.txt +0 -0
- {mcp_security_framework-1.2.1.dist-info → mcp_security_framework-1.2.2.dist-info}/top_level.txt +0 -0
@@ -247,8 +247,12 @@ class CertificateConfig(BaseModel):
|
|
247
247
|
This model defines certificate management configuration settings
|
248
248
|
including CA settings, certificate storage, and validation options.
|
249
249
|
|
250
|
+
BUGFIX: Added ca_creation_mode to allow CA certificate creation
|
251
|
+
without requiring existing CA paths.
|
252
|
+
|
250
253
|
Attributes:
|
251
254
|
enabled: Whether certificate management is enabled
|
255
|
+
ca_creation_mode: Whether we are in CA creation mode (bypasses CA path validation)
|
252
256
|
ca_cert_path: Path to CA certificate
|
253
257
|
ca_key_path: Path to CA private key
|
254
258
|
cert_storage_path: Path for certificate storage
|
@@ -266,6 +270,9 @@ class CertificateConfig(BaseModel):
|
|
266
270
|
enabled: bool = Field(
|
267
271
|
default=False, description="Whether certificate management is enabled"
|
268
272
|
)
|
273
|
+
ca_creation_mode: bool = Field(
|
274
|
+
default=False, description="Whether we are in CA creation mode (bypasses CA path validation)"
|
275
|
+
)
|
269
276
|
ca_cert_path: Optional[str] = Field(
|
270
277
|
default=None, description="Path to CA certificate"
|
271
278
|
)
|
@@ -317,10 +324,13 @@ class CertificateConfig(BaseModel):
|
|
317
324
|
def validate_certificate_configuration(self):
|
318
325
|
"""Validate certificate configuration consistency."""
|
319
326
|
if self.enabled:
|
320
|
-
if not
|
321
|
-
|
322
|
-
|
323
|
-
|
327
|
+
# BUGFIX: Only require CA paths if not in CA creation mode
|
328
|
+
if not self.ca_creation_mode:
|
329
|
+
if not self.ca_cert_path or not self.ca_key_path:
|
330
|
+
raise ValueError(
|
331
|
+
"Certificate management enabled but CA certificate and key paths are required. "
|
332
|
+
"Set ca_creation_mode=True if you are creating a CA certificate."
|
333
|
+
)
|
324
334
|
|
325
335
|
if self.crl_enabled and not self.crl_path:
|
326
336
|
raise ValueError("CRL enabled but CRL path is required")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-security-framework
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.2
|
4
4
|
Summary: Universal security framework for microservices with SSL/TLS, authentication, authorization, and rate limiting. Requires cryptography>=42.0.0 for certificate operations.
|
5
5
|
Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
|
6
6
|
Maintainer-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
mcp_security_framework/__init__.py,sha256=
|
1
|
+
mcp_security_framework/__init__.py,sha256=C9V1poQA2xvUsTjT2DulR-ePlspAJ1ouYFLZ-GgfsuE,3172
|
2
2
|
mcp_security_framework/constants.py,sha256=k7NMSrgc83Cci8aoilybQxdC7jir7J-mVFE_EpqVrDk,5307
|
3
3
|
mcp_security_framework/cli/__init__.py,sha256=plpWdiWMp2dcLvUuGwXynRg5CDjz8YKnNTBn7lcta08,369
|
4
4
|
mcp_security_framework/cli/cert_cli.py,sha256=LdZ3SYKM3e3dP5LsVR5Y0OENtlG0ENu64aHefHjuiN8,23818
|
@@ -29,7 +29,7 @@ mcp_security_framework/middleware/mtls_middleware.py,sha256=WSyWIk1fCN96hkofODKj
|
|
29
29
|
mcp_security_framework/middleware/rate_limit_middleware.py,sha256=deCwwigI0Pt7pBUnk2jDurI9ZyjujWTsexEWWndXm3g,13177
|
30
30
|
mcp_security_framework/middleware/security_middleware.py,sha256=PQ251Fr2UrYVPgGfhXq6QJyqK2tRk0WCIg9_FBvfVkg,16844
|
31
31
|
mcp_security_framework/schemas/__init__.py,sha256=lefkbRlbj2ICfasSj51MQ04o3z1YycnbnknSJCFfXbU,2590
|
32
|
-
mcp_security_framework/schemas/config.py,sha256=
|
32
|
+
mcp_security_framework/schemas/config.py,sha256=I2bBypkNkE3d8Zv5IPeduggFUfIUA5Pyi56NmT1a_5g,27385
|
33
33
|
mcp_security_framework/schemas/models.py,sha256=Izjy3I55zjMVLsVZpXZ0M4aK3SCks9sC2U1cbxrXYeI,28439
|
34
34
|
mcp_security_framework/schemas/responses.py,sha256=nVXaqF5GTSprXTa_wiUEu38nvSw9WAXtKViAJNbO-Xg,23206
|
35
35
|
mcp_security_framework/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -68,7 +68,7 @@ tests/test_middleware/test_flask_auth_middleware.py,sha256=NA74wnBq7AR-YsUqlibMS
|
|
68
68
|
tests/test_middleware/test_flask_middleware.py,sha256=JqWr5MknE6AvnUUf2Cr0ME6l_wSbze0BqbEIQO8B5qs,22731
|
69
69
|
tests/test_middleware/test_security_middleware.py,sha256=J69rVgsnohQp2ucUnGRyWCWZxt6RF2tQ9vQNLFlDXEg,19199
|
70
70
|
tests/test_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
71
|
-
tests/test_schemas/test_config.py,sha256=
|
71
|
+
tests/test_schemas/test_config.py,sha256=m0TKYPXKC2QdkVmUc7UPEF3yOANL5Ee1v93DZswSMvk,31347
|
72
72
|
tests/test_schemas/test_models.py,sha256=bBeZOPqveuVJuEi_BTVWdVsdj08JXJTEFwvBM4eFRVU,34311
|
73
73
|
tests/test_schemas/test_responses.py,sha256=ZSbO7A3ThPBovTXO8PFF-2ONWAjJx2dMOoV2lQIfd8s,40774
|
74
74
|
tests/test_schemas/test_serialization.py,sha256=jCugAyrdD6Mw1U7Kxni9oTukarZmMMl6KUcl6cq_NTk,18599
|
@@ -78,8 +78,8 @@ tests/test_utils/test_crypto_utils.py,sha256=yEb4hzG6-irj2DPoXY0DUboJfbeR87ussgT
|
|
78
78
|
tests/test_utils/test_datetime_compat.py,sha256=n8S4X5HN-_ejSNpgymDXRyZkmxhnyxwwjxFPdX23I40,5656
|
79
79
|
tests/test_utils/test_unitid_compat.py,sha256=MWh03A4FwzQyZa20PKHEWz4W03YtARwBOd_1JbABznQ,25544
|
80
80
|
tests/test_utils/test_validation_utils.py,sha256=lus_wHJ2WyVnBGQ28S7dSv78uWcCIuLhn5uflJw-uGw,18569
|
81
|
-
mcp_security_framework-1.2.
|
82
|
-
mcp_security_framework-1.2.
|
83
|
-
mcp_security_framework-1.2.
|
84
|
-
mcp_security_framework-1.2.
|
85
|
-
mcp_security_framework-1.2.
|
81
|
+
mcp_security_framework-1.2.2.dist-info/METADATA,sha256=JSoJc0AxNbssfj8K6IyR-JCfySC8L9pmys2d7PnLj9o,11771
|
82
|
+
mcp_security_framework-1.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
83
|
+
mcp_security_framework-1.2.2.dist-info/entry_points.txt,sha256=qBh92fVDmd1m2f3xeW0hTu3Ksg8QfGJyV8UEkdA2itg,142
|
84
|
+
mcp_security_framework-1.2.2.dist-info/top_level.txt,sha256=ifUiGrTDcD574MXSOoAN2rp2wpUvWlb4jD9LTUgDWCA,29
|
85
|
+
mcp_security_framework-1.2.2.dist-info/RECORD,,
|
@@ -195,6 +195,7 @@ class TestCertificateConfig:
|
|
195
195
|
config = CertificateConfig()
|
196
196
|
|
197
197
|
assert config.enabled is False
|
198
|
+
assert config.ca_creation_mode is False
|
198
199
|
assert config.ca_cert_path is None
|
199
200
|
assert config.ca_key_path is None
|
200
201
|
assert config.cert_storage_path == "./certs"
|
@@ -217,6 +218,7 @@ class TestCertificateConfig:
|
|
217
218
|
"Certificate management enabled but CA certificate and key paths are required"
|
218
219
|
in str(exc_info.value)
|
219
220
|
)
|
221
|
+
assert "ca_creation_mode=True" in str(exc_info.value)
|
220
222
|
|
221
223
|
def test_certificate_config_crl_enabled_without_path(self):
|
222
224
|
"""Test CertificateConfig validation when CRL enabled without path."""
|
@@ -272,6 +274,54 @@ class TestCertificateConfig:
|
|
272
274
|
with pytest.raises(ValidationError):
|
273
275
|
CertificateConfig(default_validity_days=3651)
|
274
276
|
|
277
|
+
def test_certificate_config_ca_creation_mode(self):
|
278
|
+
"""Test CertificateConfig with CA creation mode enabled."""
|
279
|
+
config = CertificateConfig(
|
280
|
+
enabled=True,
|
281
|
+
ca_creation_mode=True,
|
282
|
+
cert_storage_path="./certs",
|
283
|
+
key_storage_path="./keys"
|
284
|
+
)
|
285
|
+
|
286
|
+
assert config.enabled is True
|
287
|
+
assert config.ca_creation_mode is True
|
288
|
+
assert config.ca_cert_path is None
|
289
|
+
assert config.ca_key_path is None
|
290
|
+
assert config.cert_storage_path == "./certs"
|
291
|
+
assert config.key_storage_path == "./keys"
|
292
|
+
|
293
|
+
def test_certificate_config_ca_creation_mode_with_ca_paths(self):
|
294
|
+
"""Test CertificateConfig with CA creation mode and CA paths (should work)."""
|
295
|
+
config = CertificateConfig(
|
296
|
+
enabled=True,
|
297
|
+
ca_creation_mode=True,
|
298
|
+
ca_cert_path="./certs/ca.crt",
|
299
|
+
ca_key_path="./keys/ca.key",
|
300
|
+
cert_storage_path="./certs",
|
301
|
+
key_storage_path="./keys"
|
302
|
+
)
|
303
|
+
|
304
|
+
assert config.enabled is True
|
305
|
+
assert config.ca_creation_mode is True
|
306
|
+
assert config.ca_cert_path == "./certs/ca.crt"
|
307
|
+
assert config.ca_key_path == "./keys/ca.key"
|
308
|
+
|
309
|
+
def test_certificate_config_normal_mode_with_ca_paths(self):
|
310
|
+
"""Test CertificateConfig in normal mode with CA paths."""
|
311
|
+
config = CertificateConfig(
|
312
|
+
enabled=True,
|
313
|
+
ca_creation_mode=False,
|
314
|
+
ca_cert_path="./certs/ca.crt",
|
315
|
+
ca_key_path="./keys/ca.key",
|
316
|
+
cert_storage_path="./certs",
|
317
|
+
key_storage_path="./keys"
|
318
|
+
)
|
319
|
+
|
320
|
+
assert config.enabled is True
|
321
|
+
assert config.ca_creation_mode is False
|
322
|
+
assert config.ca_cert_path == "./certs/ca.crt"
|
323
|
+
assert config.ca_key_path == "./keys/ca.key"
|
324
|
+
|
275
325
|
|
276
326
|
class TestPermissionConfig:
|
277
327
|
"""Test suite for PermissionConfig class."""
|
File without changes
|
{mcp_security_framework-1.2.1.dist-info → mcp_security_framework-1.2.2.dist-info}/entry_points.txt
RENAMED
File without changes
|
{mcp_security_framework-1.2.1.dist-info → mcp_security_framework-1.2.2.dist-info}/top_level.txt
RENAMED
File without changes
|