Uptime Monitor
Overview
The Uptime Monitor ensures the health and reliability of your application’s file upload and virus scanning processes. It continuously verifies that files can be uploaded correctly, scanned for viruses effectively, and that file integrity is maintained.
Key Functionalities
1. Virus Scanner Health Check
Purpose
The runScannerTest function verifies that the virus scanner works as expected by scanning two predefined test files. It confirms that the virus scanner detects a known virus test file and correctly identifies a clean file. Implementation Details
Test Files:
EICAR Test File: A standard test file designed to trigger virus detection (used globally to test antivirus systems).
Clean Test File: A safe file expected to pass virus scanning without errors.
Process:
runScannerTest calls the scanFile function for each test file.
It checks the scan results to verify:
The EICAR file is detected as a virus (error status).
The clean file is reported as safe (clean status).
The test results are logged with a timestamp and stored in Firestore under the document settings/candidateSettings.
The system enables or disables the virus scanner based on test success.
Failed tests are logged as errors, though no automatic alerting is currently implemented.
2. File Upload Component
Purpose
The file upload component allows users to upload documents securely and efficiently while enforcing validation rules to prevent improper or harmful files.
Key Features
File Upload: Facilitates selection and uploading of files to Firebase Storage.
File Validation: Validates file type and size before upload.
Error Handling: Provides user feedback on invalid files or upload failures.
File Replacement: Optionally allows replacing an existing file if enabled.
Implementation Details
File Constraints:
Maximum Size: 2 MB per file.
Accepted Types: .pdf, .docx, .doc, .odt, .txt, .fodt.
Process:
The user selects a file through a file input interface.
The file is validated against size and type requirements.
Valid files are uploaded to Firebase Storage.
If enableDelete is set to true, users can replace existing files.