-
Notifications
You must be signed in to change notification settings - Fork 1
[PRMP-1384] File integrity check in document upload process #1075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…dencies - Implement check for locked or corrupt files during document upload process. - Introduce new INVALID status for documents that are password protected or corrupted. - Create requirements for files_lambda_layer to include msoffcrypto-tool.
Code security issues foundView full details here. |
|
|
|
||
| def get_object_stream(self, bucket: str, key: str): | ||
| response = self.client.get_object(Bucket=bucket, Key=key) | ||
| def get_object_stream(self, bucket: str, key: str, byte_range: str = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
byte_range: str | None = None
| if doc_ref.doc_status == "cancelled": | ||
| if doc_ref.virus_scanner_result == VirusScanResult.INFECTED: | ||
| return DocumentStatus.INFECTED.display, DocumentStatus.INFECTED.code | ||
| elif doc_ref.virus_scanner_result == VirusScanResult.INVALID: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can probably just be
if doc_ref.virus....... instead of elif
| assert result["doc-id-4"]["error_code"] == DocumentStatus.INFECTED.code | ||
|
|
||
|
|
||
| def test_get_document_references_by_id_invalid_document( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be a good idea to include some e2e tests for this scenario
| ) | ||
| mock_stream.read.assert_called_once_with() | ||
| mock_bytesio.assert_called_once_with(file_content) | ||
| mock_check.assert_called_once_with(mock_file_stream, file_extension) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe some more tests here that include failure scenarios.
file_name missing/None.



Overview
Jira ticket: PRMP-1384
Description
Context
Checklist
Tasks for all changes:
I have run git pre-commits.(WIP)Deploy - Sandbox- workflow run - TBCSANDBOX Full- Deploy feature branch to sandbox- workflow run - TBC