Skip to content

Commit d79eb67

Browse files
authored
add bypass gatekeeper option to file submission and set to true for all resubmissions (#135)
- update strelka_pb2 and strelka_pb2_grpc to latest versions which include the gatekeeper flag
1 parent 26fcc52 commit d79eb67

File tree

5 files changed

+291
-323
lines changed

5 files changed

+291
-323
lines changed

app/strelka_ui/blueprints/strelka.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def submit_file(
256256

257257

258258
def submit_to_strelka(
259-
file, user, submitted_hash, submitted_description, submitted_type
259+
file, user, submitted_hash, submitted_description, submitted_type, bypass_gatekeeper=False
260260
):
261261
"""
262262
Submit file to Strelka for analysis and save results to the database.
@@ -266,7 +266,8 @@ def submit_to_strelka(
266266
user: User object representing the authenticated user.
267267
submitted_hash: Hash of the submitted file.
268268
submitted_description: Description of the submitted file.
269-
submitted_type: Type of submission (e.g., 'api', 'virustotal').
269+
submitted_type: Type of submission (e.g., 'api', 'virustotal', 'resubmission').
270+
bypass_gatekeeper: If True, bypasses gatekeeper caching for this request.
270271
271272
Returns:
272273
Analysis results and a 200 status code if successful.
@@ -286,6 +287,7 @@ def submit_to_strelka(
286287
"client_user_name": user.user_cn,
287288
},
288289
submitted_hash,
290+
bypass_gatekeeper=bypass_gatekeeper,
289291
)
290292

291293
# If the Strelka submission was not successful, return an error message.
@@ -805,7 +807,8 @@ def read(self, *args, **kwargs):
805807
user,
806808
"", # No submitted_hash for resubmission
807809
new_description,
808-
"resubmission" # Mark as resubmission type
810+
"resubmission", # Mark as resubmission type
811+
bypass_gatekeeper=True # Bypass gatekeeper for resubmissions
809812
)
810813

811814
# Add original submission ID to the response

app/strelka_ui/services/strelka.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def get_db_status() -> bool:
7878

7979

8080
def submit_data(
81-
file: Any, meta: Dict[str, Any], file_hash: str
81+
file: Any, meta: Dict[str, Any], file_hash: str, bypass_gatekeeper: bool = False
8282
) -> Tuple[bool, str, int]:
8383
"""
8484
Submit a file to Strelka for analysis and return the result.
@@ -87,6 +87,7 @@ def submit_data(
8787
file (Any): The file to be submitted.
8888
meta (dict): A dictionary of metadata to be included with the submission.
8989
file_hash (str): Used as a filename if uploading via VirusTotal
90+
bypass_gatekeeper (bool): If True, bypasses gatekeeper caching for this request.
9091
9192
Returns:
9293
tuple: A tuple containing a boolean indicating whether the submission was successful,
@@ -114,6 +115,7 @@ def submit_data(
114115
sample_data,
115116
f"{strelka_host}:{strelka_port}",
116117
meta,
118+
bypass_gatekeeper=bypass_gatekeeper,
117119
)
118120

119121
# Return a tuple indicating success, the response from Strelka, and the file size

0 commit comments

Comments
 (0)