miso-client 5.2.2__tar.gz → 5.2.3__tar.gz
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.
- {miso_client-5.2.2 → miso_client-5.2.3}/CHANGELOG.md +17 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/MANIFEST.in +1 -0
- {miso_client-5.2.2/miso_client.egg-info → miso_client-5.2.3}/PKG-INFO +8 -1
- {miso_client-5.2.2 → miso_client-5.2.3}/README.md +7 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/__init__.py +1 -1
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/encryption.py +15 -10
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/data_masker.py +12 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/http_client_logging.py +19 -5
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/http_log_masker.py +11 -0
- miso_client-5.2.3/miso_client/utils/sensitive_fields_config.json +47 -0
- {miso_client-5.2.2 → miso_client-5.2.3/miso_client.egg-info}/PKG-INFO +8 -1
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client.egg-info/SOURCES.txt +1 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/pyproject.toml +2 -2
- {miso_client-5.2.2 → miso_client-5.2.3}/setup.py +1 -1
- {miso_client-5.2.2 → miso_client-5.2.3}/LICENSE +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/__init__.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/applications_api.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/auth_api.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/logs_api.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/logs_stats_api.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/logs_stats_delegation_mixin.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/permissions_api.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/response_utils.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/roles_api.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/types/__init__.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/types/applications_types.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/types/auth_types.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/types/logs_types.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/types/permissions_types.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/api/types/roles_types.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/client.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/errors.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/models/__init__.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/models/bootstrap.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/models/config.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/models/encryption.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/models/error_response.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/models/filter.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/models/filter_schema.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/models/pagination.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/models/session_cookie.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/models/sort.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/py.typed +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/__init__.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/application_context.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/auth.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/auth_flow_helpers.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/auth_token_cache.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/auth_user_cache.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/authorization_mixin.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/browser_session_refresh.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/cache.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/logger.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/logger_chain.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/permission.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/redis.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/role.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/services/unified_logger.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/__init__.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/application_url_resolver.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/audit_log_queue.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/auth_cache_helpers.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/auth_strategy.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/auth_utils.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/bootstrap.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/bootstrap_auth.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/bootstrap_credentials.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/bootstrap_request_policy.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/bootstrap_runtime.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/bootstrap_snapshot.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/bootstrap_transport.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/circuit_breaker.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/client_token_manager.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/config_loader.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/controller_url_resolver.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/environment_token.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/error_utils.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/fastapi_endpoints.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/fastapi_logger_middleware.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/filter.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/filter_applier.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/filter_coercion.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/filter_parser.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/filter_schema.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/flask_endpoints.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/flask_logger_middleware.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/http_client.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/http_client_auth_helpers.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/http_client_logging_helpers.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/http_client_query_helpers.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/http_client_runtime_helpers.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/http_error_handler.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/http_error_sanitizer.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/http_log_formatter.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/internal_http_auth_strategy.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/internal_http_client.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/jwt_tools.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/log_request_transformer.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/logger_context_storage.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/logger_helpers.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/logger_request_helpers.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/logging_helpers.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/origin_validator.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/pagination.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/request_context.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/request_target.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/sensitive_fields_loader.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/shared_task.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/sort.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/token_utils.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/unified_logger_factory.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/url_validator.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client/utils/user_token_refresh.py +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client.egg-info/dependency_links.txt +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client.egg-info/not-zip-safe +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client.egg-info/requires.txt +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/miso_client.egg-info/top_level.txt +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/requirements-test.txt +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/requirements.txt +0 -0
- {miso_client-5.2.2 → miso_client-5.2.3}/setup.cfg +0 -0
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [5.2.3] - 2026-11-12
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Prevented HTTP debug and failure diagnostics for `/api/security/` endpoints from
|
|
15
|
+
emitting request bodies, decrypt responses, raw exception text, or parameter names.
|
|
16
|
+
Default and fallback masking now also cover `plaintext`, exact normalized
|
|
17
|
+
`value`, and `encryptionKey` fields while safe audit metadata remains
|
|
18
|
+
available. Composite names such as `totalValue` remain visible unless
|
|
19
|
+
independently sensitive or explicitly configured.
|
|
20
|
+
|
|
21
|
+
### Technical
|
|
22
|
+
|
|
23
|
+
- Included the sensitive-field configuration in wheel and source distributions,
|
|
24
|
+
and expanded regression and live-harness coverage for security-log omission,
|
|
25
|
+
safe encryption diagnostics, and exact normalized `value` matching.
|
|
26
|
+
|
|
10
27
|
## [5.2.2] - 2026-11-10
|
|
11
28
|
|
|
12
29
|
### Changed
|
|
@@ -6,6 +6,7 @@ include requirements-test.txt
|
|
|
6
6
|
# recursive-include docs *.md # docs directory is empty
|
|
7
7
|
recursive-include miso_client *.py
|
|
8
8
|
include miso_client/py.typed
|
|
9
|
+
include miso_client/utils/sensitive_fields_config.json
|
|
9
10
|
recursive-exclude * __pycache__
|
|
10
11
|
recursive-exclude * *.py[co]
|
|
11
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: miso-client
|
|
3
|
-
Version: 5.2.
|
|
3
|
+
Version: 5.2.3
|
|
4
4
|
Summary: Python client SDK for AI Fabrix authentication, authorization, and logging
|
|
5
5
|
Home-page: https://github.com/aifabrix/miso-client-python
|
|
6
6
|
Author: AI Fabrix Team
|
|
@@ -682,6 +682,13 @@ The default configuration includes ISO 27001 compliant sensitive fields:
|
|
|
682
682
|
- PII: ssn, creditcard, cc, cvv, pin, otp
|
|
683
683
|
- Security: apikey, accesstoken, refreshtoken, privatekey, secretkey, cookie, session
|
|
684
684
|
|
|
685
|
+
Field-name matching is case-insensitive and ignores `_` and `-`. The sensitive
|
|
686
|
+
token `value` matches only a complete normalized field name, so `VALUE` and
|
|
687
|
+
`v_a_l_u_e` are masked while ordinary composite names such as `totalValue` and
|
|
688
|
+
`defaultValue` remain visible unless they match another sensitive token. Add a
|
|
689
|
+
genuinely sensitive composite name explicitly under `fields` in custom
|
|
690
|
+
configuration. Python `DataMasker` does not currently consume `fieldPatterns`.
|
|
691
|
+
|
|
685
692
|
**Masking JSON documents (for other projects):** Use `DataMasker` to mask sensitive fields in any JSON structure before logging or sending to external systems:
|
|
686
693
|
|
|
687
694
|
```python
|
|
@@ -628,6 +628,13 @@ The default configuration includes ISO 27001 compliant sensitive fields:
|
|
|
628
628
|
- PII: ssn, creditcard, cc, cvv, pin, otp
|
|
629
629
|
- Security: apikey, accesstoken, refreshtoken, privatekey, secretkey, cookie, session
|
|
630
630
|
|
|
631
|
+
Field-name matching is case-insensitive and ignores `_` and `-`. The sensitive
|
|
632
|
+
token `value` matches only a complete normalized field name, so `VALUE` and
|
|
633
|
+
`v_a_l_u_e` are masked while ordinary composite names such as `totalValue` and
|
|
634
|
+
`defaultValue` remain visible unless they match another sensitive token. Add a
|
|
635
|
+
genuinely sensitive composite name explicitly under `fields` in custom
|
|
636
|
+
configuration. Python `DataMasker` does not currently consume `fieldPatterns`.
|
|
637
|
+
|
|
631
638
|
**Masking JSON documents (for other projects):** Use `DataMasker` to mask sensitive fields in any JSON structure before logging or sending to external systems:
|
|
632
639
|
|
|
633
640
|
```python
|
|
@@ -49,6 +49,17 @@ def _cache_key_decrypt(value: str, parameter_name: str) -> str:
|
|
|
49
49
|
return f"{DECRYPT_CACHE_PREFIX}{h}"
|
|
50
50
|
|
|
51
51
|
|
|
52
|
+
def _safe_error_log_context(error: MisoClientError) -> dict[str, object]:
|
|
53
|
+
"""Return non-secret metadata for encryption failure diagnostics."""
|
|
54
|
+
context: dict[str, object] = {}
|
|
55
|
+
correlation_id = extract_correlation_id_from_error(error)
|
|
56
|
+
if correlation_id:
|
|
57
|
+
context["correlationId"] = correlation_id
|
|
58
|
+
if error.status_code is not None:
|
|
59
|
+
context["statusCode"] = error.status_code
|
|
60
|
+
return context
|
|
61
|
+
|
|
62
|
+
|
|
52
63
|
class EncryptionService:
|
|
53
64
|
"""Encryption service calling miso-controller for server-side encryption.
|
|
54
65
|
|
|
@@ -198,12 +209,9 @@ class EncryptionService:
|
|
|
198
209
|
|
|
199
210
|
def _raise_encrypt_error(self, error: MisoClientError, parameter_name: str) -> NoReturn:
|
|
200
211
|
"""Raise normalized EncryptionError for encrypt failures."""
|
|
201
|
-
correlation_id = extract_correlation_id_from_error(error)
|
|
202
|
-
extra = {"correlationId": correlation_id} if correlation_id else None
|
|
203
212
|
logger.error(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
extra=extra,
|
|
213
|
+
"Encryption request failed",
|
|
214
|
+
extra=_safe_error_log_context(error),
|
|
207
215
|
)
|
|
208
216
|
raise EncryptionError(
|
|
209
217
|
str(error),
|
|
@@ -224,12 +232,9 @@ class EncryptionService:
|
|
|
224
232
|
code = "PARAMETER_NOT_FOUND"
|
|
225
233
|
elif error.status_code in (401, 403):
|
|
226
234
|
code = "ACCESS_DENIED"
|
|
227
|
-
correlation_id = extract_correlation_id_from_error(error)
|
|
228
|
-
extra = {"correlationId": correlation_id} if correlation_id else None
|
|
229
235
|
logger.error(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
extra=extra,
|
|
236
|
+
"Decryption request failed",
|
|
237
|
+
extra=_safe_error_log_context(error),
|
|
233
238
|
)
|
|
234
239
|
raise EncryptionError(
|
|
235
240
|
str(error),
|
|
@@ -39,6 +39,16 @@ class DataMasker:
|
|
|
39
39
|
"refreshtoken",
|
|
40
40
|
"privatekey",
|
|
41
41
|
"secretkey",
|
|
42
|
+
"encryptionkey",
|
|
43
|
+
"plaintext",
|
|
44
|
+
"value",
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Subset of the main hardcoded list for full normalized-name matching only;
|
|
48
|
+
# entries must also remain in the main list. This preserves roleValue,
|
|
49
|
+
# valueCount, dimensionValueId, and dimensionValuesProcessed.
|
|
50
|
+
_exact_match_only_fields_subset: Set[str] = {
|
|
51
|
+
"value",
|
|
42
52
|
}
|
|
43
53
|
|
|
44
54
|
_sensitive_fields: Optional[Set[str]] = None
|
|
@@ -83,6 +93,8 @@ class DataMasker:
|
|
|
83
93
|
if nk in sensitive_fields:
|
|
84
94
|
return True
|
|
85
95
|
for sf in sensitive_fields:
|
|
96
|
+
if sf in cls._exact_match_only_fields_subset:
|
|
97
|
+
continue
|
|
86
98
|
if len(sf) >= substr_min and sf in nk:
|
|
87
99
|
return True
|
|
88
100
|
return False
|
|
@@ -11,11 +11,14 @@ from typing import Any, Dict, Optional, cast
|
|
|
11
11
|
from .http_log_formatter import build_audit_context, build_debug_context
|
|
12
12
|
from .http_log_masker import (
|
|
13
13
|
extract_and_mask_query_params,
|
|
14
|
+
is_security_endpoint,
|
|
14
15
|
mask_error_message,
|
|
15
16
|
mask_request_data,
|
|
16
17
|
mask_response_data,
|
|
17
18
|
)
|
|
18
19
|
|
|
20
|
+
_SECURITY_ERROR_MESSAGE = "Security request failed"
|
|
21
|
+
|
|
19
22
|
|
|
20
23
|
def should_skip_logging(url: str, config: Optional[Any] = None) -> bool:
|
|
21
24
|
"""Check whether request logging should be skipped."""
|
|
@@ -114,7 +117,11 @@ def _prepare_audit_context(
|
|
|
114
117
|
request_size, response_size = _resolve_request_response_sizes(
|
|
115
118
|
audit_level, request_data, response
|
|
116
119
|
)
|
|
117
|
-
error_message =
|
|
120
|
+
error_message = None
|
|
121
|
+
if error is not None:
|
|
122
|
+
error_message = (
|
|
123
|
+
_SECURITY_ERROR_MESSAGE if is_security_endpoint(url) else mask_error_message(error)
|
|
124
|
+
)
|
|
118
125
|
return build_audit_context(
|
|
119
126
|
method=method,
|
|
120
127
|
url=url,
|
|
@@ -189,7 +196,7 @@ def _build_minimal_audit_context(
|
|
|
189
196
|
if user_id:
|
|
190
197
|
context["userId"] = user_id
|
|
191
198
|
if error:
|
|
192
|
-
context["error"] = str(error)
|
|
199
|
+
context["error"] = _SECURITY_ERROR_MESSAGE if is_security_endpoint(url) else str(error)
|
|
193
200
|
if correlation_id:
|
|
194
201
|
context["correlationId"] = correlation_id
|
|
195
202
|
return context
|
|
@@ -352,6 +359,13 @@ def _prepare_debug_context(
|
|
|
352
359
|
correlation_id: Optional[str] = None,
|
|
353
360
|
) -> Dict[str, Any]:
|
|
354
361
|
"""Prepare debug context for logging."""
|
|
362
|
+
if is_security_endpoint(url):
|
|
363
|
+
masked_headers, _ = mask_request_data(request_headers, None)
|
|
364
|
+
masked_body = None
|
|
365
|
+
masked_response = None
|
|
366
|
+
else:
|
|
367
|
+
masked_headers, masked_body = mask_request_data(request_headers, request_data)
|
|
368
|
+
masked_response = mask_response_data(response, max_size=max_response_size)
|
|
355
369
|
return build_debug_context(
|
|
356
370
|
method=method,
|
|
357
371
|
url=url,
|
|
@@ -359,9 +373,9 @@ def _prepare_debug_context(
|
|
|
359
373
|
duration_ms=duration_ms,
|
|
360
374
|
base_url=base_url,
|
|
361
375
|
user_id=user_id,
|
|
362
|
-
masked_headers=
|
|
363
|
-
masked_body=
|
|
364
|
-
masked_response=
|
|
376
|
+
masked_headers=masked_headers,
|
|
377
|
+
masked_body=masked_body,
|
|
378
|
+
masked_response=masked_response,
|
|
365
379
|
query_params=extract_and_mask_query_params(url),
|
|
366
380
|
correlation_id=correlation_id,
|
|
367
381
|
)
|
|
@@ -10,6 +10,17 @@ from urllib.parse import parse_qs, urlparse
|
|
|
10
10
|
from .data_masker import DataMasker
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
def is_security_endpoint(url: str) -> bool:
|
|
14
|
+
"""Return whether the URL path contains the bounded ``/api/security`` route."""
|
|
15
|
+
try:
|
|
16
|
+
segments = [segment.lower() for segment in urlparse(url).path.split("/") if segment]
|
|
17
|
+
except Exception:
|
|
18
|
+
return False
|
|
19
|
+
return any(
|
|
20
|
+
segments[index : index + 2] == ["api", "security"] for index in range(len(segments) - 1)
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
13
24
|
def mask_error_message(error: Optional[Exception]) -> Optional[str]:
|
|
14
25
|
"""Mask sensitive data in error message.
|
|
15
26
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mergeWithHardcodedDefaults": true,
|
|
3
|
+
"substringMinLength": 4,
|
|
4
|
+
"neverMaskFields": [
|
|
5
|
+
"success",
|
|
6
|
+
"key",
|
|
7
|
+
"message",
|
|
8
|
+
"status",
|
|
9
|
+
"error",
|
|
10
|
+
"hint",
|
|
11
|
+
"code",
|
|
12
|
+
"name",
|
|
13
|
+
"id"
|
|
14
|
+
],
|
|
15
|
+
"fields": {
|
|
16
|
+
"authentication": [
|
|
17
|
+
"password",
|
|
18
|
+
"passwd",
|
|
19
|
+
"pwd",
|
|
20
|
+
"token",
|
|
21
|
+
"secret",
|
|
22
|
+
"auth",
|
|
23
|
+
"authorization"
|
|
24
|
+
],
|
|
25
|
+
"pii": [
|
|
26
|
+
"ssn",
|
|
27
|
+
"creditcard",
|
|
28
|
+
"cvv",
|
|
29
|
+
"pin",
|
|
30
|
+
"otp"
|
|
31
|
+
],
|
|
32
|
+
"security": [
|
|
33
|
+
"apikey",
|
|
34
|
+
"accesstoken",
|
|
35
|
+
"refreshtoken",
|
|
36
|
+
"privatekey",
|
|
37
|
+
"secretkey",
|
|
38
|
+
"cookie",
|
|
39
|
+
"session",
|
|
40
|
+
"encryptionkey",
|
|
41
|
+
"encryptionKey",
|
|
42
|
+
"plaintext",
|
|
43
|
+
"value"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"fieldPatterns": []
|
|
47
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: miso-client
|
|
3
|
-
Version: 5.2.
|
|
3
|
+
Version: 5.2.3
|
|
4
4
|
Summary: Python client SDK for AI Fabrix authentication, authorization, and logging
|
|
5
5
|
Home-page: https://github.com/aifabrix/miso-client-python
|
|
6
6
|
Author: AI Fabrix Team
|
|
@@ -682,6 +682,13 @@ The default configuration includes ISO 27001 compliant sensitive fields:
|
|
|
682
682
|
- PII: ssn, creditcard, cc, cvv, pin, otp
|
|
683
683
|
- Security: apikey, accesstoken, refreshtoken, privatekey, secretkey, cookie, session
|
|
684
684
|
|
|
685
|
+
Field-name matching is case-insensitive and ignores `_` and `-`. The sensitive
|
|
686
|
+
token `value` matches only a complete normalized field name, so `VALUE` and
|
|
687
|
+
`v_a_l_u_e` are masked while ordinary composite names such as `totalValue` and
|
|
688
|
+
`defaultValue` remain visible unless they match another sensitive token. Add a
|
|
689
|
+
genuinely sensitive composite name explicitly under `fields` in custom
|
|
690
|
+
configuration. Python `DataMasker` does not currently consume `fieldPatterns`.
|
|
691
|
+
|
|
685
692
|
**Masking JSON documents (for other projects):** Use `DataMasker` to mask sensitive fields in any JSON structure before logging or sending to external systems:
|
|
686
693
|
|
|
687
694
|
```python
|
|
@@ -108,6 +108,7 @@ miso_client/utils/origin_validator.py
|
|
|
108
108
|
miso_client/utils/pagination.py
|
|
109
109
|
miso_client/utils/request_context.py
|
|
110
110
|
miso_client/utils/request_target.py
|
|
111
|
+
miso_client/utils/sensitive_fields_config.json
|
|
111
112
|
miso_client/utils/sensitive_fields_loader.py
|
|
112
113
|
miso_client/utils/shared_task.py
|
|
113
114
|
miso_client/utils/sort.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "miso-client"
|
|
7
|
-
version = "5.2.
|
|
7
|
+
version = "5.2.3"
|
|
8
8
|
description = "Python client SDK for AI Fabrix authentication, authorization, and logging"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -76,7 +76,7 @@ packages = [
|
|
|
76
76
|
]
|
|
77
77
|
|
|
78
78
|
[tool.setuptools.package-data]
|
|
79
|
-
miso_client = ["py.typed"]
|
|
79
|
+
miso_client = ["py.typed", "utils/sensitive_fields_config.json"]
|
|
80
80
|
|
|
81
81
|
[tool.pytest.ini_options]
|
|
82
82
|
testpaths = ["tests/unit"]
|
|
@@ -8,7 +8,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="miso-client",
|
|
11
|
-
version="5.2.
|
|
11
|
+
version="5.2.3",
|
|
12
12
|
author="AI Fabrix Team",
|
|
13
13
|
author_email="team@aifabrix.ai",
|
|
14
14
|
description="Python client SDK for AI Fabrix authentication, authorization, and logging",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|