Skip to content

Commit 01611e2

Browse files
committed
[ADD] Added user safeguard against protected fields
1 parent db60762 commit 01611e2

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

source/app/datamgmt/alerts/alerts_db.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@
5959
'iocs': Ioc
6060
}
6161

62+
RESTRICTED_USER_FIELDS = {
63+
'password',
64+
'mfa_secrets',
65+
'webauthn_credentials',
66+
'api_key',
67+
'external_id',
68+
'ctx_case',
69+
'ctx_human_case',
70+
'is_service_account'
71+
}
72+
6273

6374
def db_list_all_alerts():
6475
"""
@@ -68,8 +79,6 @@ def db_list_all_alerts():
6879

6980

7081
def build_condition(column, operator, value):
71-
# If 'column' is actually a relationship (e.g., Alert.owner),
72-
# we need to find the corresponding foreign key column or raise an error.
7382
if hasattr(column, 'property') and hasattr(column.property, 'local_columns'):
7483
# It's a relationship attribute
7584
fk_cols = list(column.property.local_columns)
@@ -265,6 +274,11 @@ def get_filtered_alerts(
265274
if relationship_name not in relationship_model_map:
266275
raise ValueError(f"Unknown relationship: {relationship_name}")
267276

277+
if related_field_name in RESTRICTED_USER_FIELDS:
278+
app.logger.error(f"Access to the field '{related_field_name}' is restricted.")
279+
app.logger.error(f"Suspicious behavior detected for user {current_user.id} - {current_user.user}.")
280+
continue
281+
268282
related_model = relationship_model_map[relationship_name]
269283

270284
# Join the relationship if not already joined

source/app/static/assets/js/iris/alerts.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,8 @@ $(document).ready(function () {
21832183
{ caption: '"field": "alert_resolution_id"', value: '"field": "alert_resolution_id"', meta: "field" },
21842184
{ caption: '"operator": "in"', value: '"operator": "in"', meta: "operator" },
21852185
{ caption: '"operator": "not_in"', value: '"operator": "not_in"', meta: "operator" },
2186+
{ caption: '"operator": "eq"', value: '"operator": "eq"', meta: "operator" },
2187+
{ caption: '"operator": "like"', value: '"operator": "like"', meta: "operator" },
21862188
{ caption: '"value": [1]', value: '"value": [1]', meta: "value" }
21872189
];
21882190

0 commit comments

Comments
 (0)