Skip to content
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

fixed dashboard backend unittest #187

Merged
merged 5 commits into from
Dec 10, 2024
Merged

fixed dashboard backend unittest #187

merged 5 commits into from
Dec 10, 2024

Conversation

gitworkflows
Copy link
Contributor

@gitworkflows gitworkflows commented Dec 10, 2024

User description

(Please add to the PR name the issue/s that this PR would close if merged by using a Github keyword. Example: <feature name>. Closes #999. If your PR is made by a single commit, please add that clause in the commit too. This is all required to automate the closure of related issues.)

Description

Please include a summary of the change and link to the related issue.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist

  • I have read and understood the rules about how to Contribute to this project
  • The pull request is for the branch develop
  • A new plugin (analyzer, connector, visualizer, playbook, pivot or ingestor) was added or changed, in which case:
    • I strictly followed the documentation "How to create a Plugin"
    • Usage file was updated.
    • Advanced-Usage was updated (in case the plugin provides additional optional configuration).
    • I have dumped the configuration from Django Admin using the dumpplugin command and added it in the project as a data migration. ("How to share a plugin with the community")
    • If a File analyzer was added and it supports a mimetype which is not already supported, you added a sample of that type inside the archive test_files.zip and you added the default tests for that mimetype in test_classes.py.
    • If you created a new analyzer and it is free (does not require any API key), please add it in the FREE_TO_USE_ANALYZERS playbook by following this guide.
    • Check if it could make sense to add that analyzer/connector to other freely available playbooks.
    • I have provided the resulting raw JSON of a finished analysis and a screenshot of the results.
    • If the plugin interacts with an external service, I have created an attribute called precisely url that contains this information. This is required for Health Checks.
    • If the plugin requires mocked testing, _monkeypatch() was used in its class to apply the necessary decorators.
    • I have added that raw JSON sample to the MockUpResponse of the _monkeypatch() method. This serves us to provide a valid sample for testing.
  • If external libraries/packages with restrictive licenses were used, they were added in the Legal Notice section.
  • Linters (Black, Flake, Isort) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • I have added tests for the feature/bug I solved (see tests folder). All the tests (new and old ones) gave 0 errors.
  • If changes were made to an existing model/serializer/view, the docs were updated and regenerated (check CONTRIBUTE.md).
  • If the GUI has been modified:
    • I have a provided a screenshot of the result in the PR.
    • I have created new frontend tests for the new component or updated existing ones.
  • After you had submitted the PR, if DeepSource, Django Doctors or other third-party linters have triggered any alerts during the CI checks, I have solved those alerts.

Important Rules

  • If you miss to compile the Checklist properly, your PR won't be reviewed by the maintainers.
  • Everytime you make changes to the PR and you think the work is done, you should explicitly ask for a review. After being reviewed and received a "change request", you should explicitly ask for a review again once you have made the requested changes.

PR Type

enhancement, tests, configuration changes, documentation


Description

  • Enhanced multiple analyzers and data models with new features and logic, including PhishingFormCompiler, UrlDNA, Crowdsec, GreyNoiseIntel, and VirusTotalv3SampleDownload.
  • Added and updated test cases for various components, including API views, serializers, and visualizers, ensuring consistency in job status handling.
  • Implemented migrations for new analyzer configurations and data model updates, such as PhishingExtractor, UrlDNA_New_Scan, and AnalyzerReport.
  • Updated documentation links and changelog, ensuring consistency and clarity in references.
  • Improved configuration management, including dependabot updates and environment constants.

Changes walkthrough 📝

Relevant files
Tests
27 files
test_views.py
Enhance and update test cases for API views                           

tests/api_app/test_views.py

  • Added imports for MagicMock, patch, and ZoneInfo.
  • Updated email domains in test user creation.
  • Introduced new test methods for aggregating playbooks, users, and
    TLPs.
  • Used patch to mock datetime and function calls in tests.
  • +342/-57
    test_tasks.py
    Update task tests with user and organization context         

    tests/threat_matrix/test_tasks.py

  • Added imports for Membership and Organization.
  • Updated test setup to include user and organization creation.
  • Modified test cases to include user and membership details in
    assertions.
  • +82/-18 
    __init__.py
    Updated test cases for user authentication and status handling.

    tests/init.py

  • Updated email domains in test data setup.
  • Modified test cases to use STATUSES for status checks.
  • Added new test cases for user authentication scenarios.
  • +26/-14 
    test_models.py
    Added test cases for `AnalyzerReport` data model methods.

    tests/api_app/analyzers_manager/test_models.py

  • Added test cases for AnalyzerReport data model methods.
  • Tested data model creation, validation, and value retrieval.
  • +125/-2 
    test_nvd_cve.py
    Enhanced NVD CVE tests with mock data and validation.       

    tests/api_app/analyzers_manager/observable_analyzers/test_nvd_cve.py

  • Added mock responses for NVD CVE tests.
  • Updated test cases to use mock data for CVE validation.
  • +92/-2   
    test_websocket.py
    Refactored websocket tests for job status handling.           

    tests/api_app/test_websocket.py

  • Updated websocket tests to use STATUSES for job status.
  • Modified test scenarios for job status transitions.
  • +11/-10 
    test_views.py
    Added test cases for data model view access and retrieval.

    tests/api_app/data_model_manager/test_views.py

  • Added test cases for DomainDataModel, IPDataModel, and FileDataModel
    views.
  • Tested view access and data retrieval for different user roles.
  • +114/-0 
    test_analyzer_extractor.py
    Refactored passive DNS tests for job status handling.       

    tests/api_app/visualizers_manager/passive_dns/test_analyzer_extractor.py

  • Updated test cases to use STATUSES for job status.
  • Modified test setup for job creation.
  • +7/-7     
    test_classes.py
    Added test cases for `VisualizableDownload` serialization.

    tests/api_app/visualizers_manager/test_classes.py

  • Added test cases for VisualizableDownload class.
  • Tested serialization and attribute handling for downloads.
  • +69/-0   
    test_classes.py
    Updated test data and cases for observable types.               

    tests/api_app/analyzers_manager/test_classes.py

  • Updated observable names in test data setup.
  • Modified test cases to handle different observable types.
  • +23/-5   
    test_views.py
    Updated pivot view tests for access control and restrictions.

    tests/api_app/pivots_manager/test_views.py

  • Updated test cases for pivot view access control.
  • Added tests for superuser access restrictions.
  • +11/-3   
    test_serializers.py
    Update serializer tests with new domain and status checks

    tests/api_app/test_serializers.py

  • Updated test URLs to use khulnasoft.com domain.
  • Added a new assertion for analyzers_data_model.
  • Modified job status references to use STATUSES.
  • +4/-3     
    test_serializers.py
    Add test for DomainDataModelSerializer representation       

    tests/api_app/data_model_manager/test_serializers.py

  • Added a new test case for DomainDataModelSerializer.
  • Created a job and analyzer report for testing.
  • +41/-0   
    test_crons.py
    Update cron tests with new job status references                 

    tests/test_crons.py

  • Updated job status references to use STATUSES.
  • Ensured consistency in job status handling.
  • +4/-4     
    test_classes.py
    Update test classes with new job status references             

    tests/api_app/test_classes.py

  • Updated job status references to use STATUSES.
  • Ensured consistency in status handling in tests.
  • +3/-3     
    test_classes.py
    Update connector test classes with new domain and status 

    tests/api_app/connectors_manager/test_classes.py

  • Updated test URLs to use khulnasoft.com domain.
  • Modified job and report status references to use STATUSES.
  • +3/-3     
    test_mixins.py
    Clean up test mixins and update setup                                       

    tests/api_app/test_mixins.py

  • Removed unused import for IngestorConfig.
  • Updated test setup for VirusTotalMixinTestCase.
  • +1/-4     
    test_models.py
    Update investigation model tests with new status references

    tests/api_app/investigations_manager/test_models.py

  • Updated job status references to use STATUSES.
  • Ensured consistency in status handling in investigation tests.
  • +2/-2     
    test_auth.py
    Update auth tests with new password references                     

    tests/auth/test_auth.py

  • Updated test passwords to use threatmatrix.
  • Ensured consistency in password handling in auth tests.
  • +2/-2     
    test_views.py
    Update connector view tests with new status references     

    tests/api_app/connectors_manager/test_views.py

  • Updated job status references to use STATUSES.
  • Ensured consistency in status handling in connector view tests.
  • +1/-1     
    test_views.py
    Update analyzer view tests with new status references       

    tests/api_app/analyzers_manager/test_views.py

  • Updated job status references to use STATUSES.
  • Ensured consistency in status handling in analyzer view tests.
  • +1/-1     
    test_models.py
    Update model tests with new status references                       

    tests/api_app/test_models.py

  • Updated job status references to use STATUSES.
  • Ensured consistency in status handling in model tests.
  • +1/-1     
    test_models.py
    Add test for IPDataModel serialization                                     

    tests/api_app/data_model_manager/test_models.py

  • Added test case for serializing IPDataModel.
  • Implemented basic serialization test logic.
  • +10/-0   
    test_views.py
    Add superuser access test for investigation views               

    tests/api_app/investigations_manager/test_views.py

  • Added test for superuser access to investigation views.
  • Implemented logic to check response status.
  • +6/-0     
    validators.test.js
    Add tests for visualizer data validation components           

    frontend/tests/components/jobs/result/visualizer/validators.test.js

  • Added test cases for visualizer data validation.
  • Implemented tests for various visualizer component types.
  • +164/-92
    files.test.js
    Add tests for file utility functions                                         

    frontend/tests/utils/files.test.js

  • Added tests for file utility functions.
  • Implemented test for humanReadbleSize function.
  • +13/-0   
    charts.test.jsx
    Add tests for dashboard chart components                                 

    frontend/tests/components/dashboard/charts.test.jsx

  • Added tests for dashboard chart components.
  • Implemented test cases for various job-related charts.
  • +516/-0 
    Migrations
    6 files
    0128_analyzer_config_phishing_form_compiler.py
    Add migration for Phishing Form Compiler analyzer               

    api_app/analyzers_manager/migrations/0128_analyzer_config_phishing_form_compiler.py

  • Added migration for Phishing_Form_Compiler analyzer configuration.
  • Defined plugin details and parameters for phishing form analysis.
  • Included migration logic for creating and reversing the plugin setup.
  • +396/-0 
    0132_analyzer_config_urldna_new_scan.py
    Add migration for UrlDNA New Scan analyzer                             

    api_app/analyzers_manager/migrations/0132_analyzer_config_urldna_new_scan.py

  • Added migration for UrlDNA_New_Scan analyzer configuration.
  • Defined plugin details and parameters for URL analysis.
  • Included migration logic for creating and reversing the plugin setup.
  • +401/-0 
    0001_initial.py
    Initial migration for data model manager models                   

    api_app/data_model_manager/migrations/0001_initial.py

  • Created initial migration for data model manager.
  • Defined models for IETFReport, Signature, IPDataModel, FileDataModel,
    and DomainDataModel.
  • Set up fields and relationships for data models.
  • +354/-0 
    0133_analyzer_config_urldna_search.py
    Add migration for UrlDNA Search analyzer                                 

    api_app/analyzers_manager/migrations/0133_analyzer_config_urldna_search.py

  • Added migration for UrlDNA_Search analyzer configuration.
  • Defined plugin details and parameters for URL search analysis.
  • Included migration logic for creating and reversing the plugin setup.
  • +247/-0 
    0129_analyzer_config_phishing_extractor.py
    Add migration for Phishing Extractor analyzer                       

    api_app/analyzers_manager/migrations/0129_analyzer_config_phishing_extractor.py

  • Added migration for Phishing_Extractor analyzer configuration.
  • Defined plugin details and parameters for phishing extraction.
  • Included migration logic for creating and reversing the plugin setup.
  • +224/-0 
    0136_alter_analyzerconfig_mapping_data_model_and_more.py
    Alter AnalyzerConfig for data model mapping and file types

    api_app/analyzers_manager/migrations/0136_alter_analyzerconfig_mapping_data_model_and_more.py

  • Altered AnalyzerConfig fields for mapping data model and file types.
  • Updated choices for supported and not supported file types.
  • Adjusted JSON field defaults and help texts.
  • +189/-0 
    Enhancement
    65 files
    phishing_form_compiler.py
    Implement Phishing Form Compiler analyzer                               

    api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py

  • Implemented PhishingFormCompiler class for phishing form analysis.
  • Added methods for configuring, running, and updating the analyzer.
  • Utilized Faker for generating fake data for form inputs.
  • +247/-0 
    models.py
    Add data models for IETF, Signature, and base data             

    api_app/data_model_manager/models.py

  • Added models for IETFReport, Signature, and base data models.
  • Defined fields and methods for handling data model operations.
  • Included serializer retrieval methods for data models.
  • +206/-0 
    views.py
    Update views for job status and aggregation enhancements 

    api_app/views.py

  • Updated job status checks to use STATUSES enum.
  • Replaced aggregation endpoints with new top playbook, user, and TLP
    aggregations.
  • Enhanced plugin_report_queries with Elasticsearch query filters.
  • +75/-41 
    tasks.py
    Update task status handling and logging                                   

    threat_matrix/tasks.py

  • Updated job and report status handling to use STATUSES enum.
  • Enhanced logging for stuck analysis detection.
  • Added user and membership details to Elasticsearch document
    conversion.
  • +19/-7   
    models.py
    Enhanced `AnalyzerReport` with data model integration and validation.

    api_app/analyzers_manager/models.py

  • Added imports for GenericForeignKey, ContentType, ArrayField, and
    ForeignKey.
  • Introduced data_model_content_type, data_model_object_id, and
    data_model fields to AnalyzerReport.
  • Implemented methods for data model validation, creation, and retrieval
    in AnalyzerReport.
  • Modified MimeTypes.calculate to handle buffer as Union[bytes, str].
  • Added mapping_data_model field to AnalyzerConfig.
  • +142/-6 
    models.py
    Refactored job status handling to use `STATUSES`.               

    api_app/models.py

  • Changed Status to STATUSES for consistency.
  • Updated methods to use STATUSES for job status management.
  • +36/-35 
    driver_wrapper.py
    Added `DriverWrapper` class for Selenium WebDriver management.

    integrations/phishing_analyzers/analyzers/driver_wrapper.py

  • Introduced DriverWrapper class for managing Selenium WebDriver.
  • Implemented exception handling for WebDriver operations.
  • Configured logging for driver operations.
  • +135/-0 
    job.py
    Enhanced job serializer with data model and status updates.

    api_app/serializers/job.py

  • Updated job status handling to use STATUSES.
  • Added analyzers_data_model field to JobSerializer.
  • Modified MimeTypes.calculate usage for file mimetype calculation.
  • +17/-10 
    urldna.py
    Added `UrlDNA` analyzer for URL analysis and scanning.     

    api_app/analyzers_manager/observable_analyzers/urldna.py

  • Introduced UrlDNA class for URL analysis.
  • Implemented methods for new scan and search operations.
  • Configured API request headers and session management.
  • +122/-0 
    seleniumwire_request_serializer.py
    Added serialization for Selenium Wire requests.                   

    integrations/phishing_analyzers/analyzers/seleniumwire_request_serializer.py

  • Implemented serialization and deserialization for Selenium Wire
    requests.
  • Configured logging for request serialization processes.
  • +104/-0 
    classes.py
    Enhanced `BaseAnalyzerMixin` with data model creation and evaluation.

    api_app/analyzers_manager/classes.py

  • Added methods for data model creation and evaluation in
    BaseAnalyzerMixin.
  • Implemented threat level to evaluation conversion.
  • Enhanced after_run_success to handle data model creation.
  • +62/-2   
    crowdsec.py
    Enhanced `Crowdsec` analyzer with data model creation logic.

    api_app/analyzers_manager/observable_analyzers/crowdsec.py

  • Added data model creation logic based on report classifications.
  • Implemented evaluation updates for Crowdsec analyzer.
  • +80/-0   
    extract_phishing_site.py
    Added script for extracting and analyzing phishing sites.

    integrations/phishing_analyzers/analyzers/extract_phishing_site.py

  • Implemented extract_phishing_site script for analyzing phishing sites.
  • Configured logging and argument parsing for the script.
  • +83/-0   
    sample_download.py
    Added `SampleDownload` visualizer for handling file downloads.

    api_app/visualizers_manager/visualizers/sample_download.py

  • Implemented SampleDownload visualizer for file downloads.
  • Added logic for handling VirusTotal and URI downloads.
  • +88/-0   
    queryset.py
    Refactored querysets to use `STATUSES` for status filtering.

    api_app/queryset.py

  • Updated querysets to use STATUSES for filtering job and report
    statuses.
  • Modified alias for test URL in _alias_for_test.
  • +11/-8   
    mixins.py
    Refactored VirusTotal mixins for analyzer integration.     

    api_app/mixins.py

  • Removed BaseAnalyzerMixin inheritance from VirusTotalv3BaseMixin.
  • Updated VirusTotalv3AnalyzerMixin to include BaseAnalyzerMixin.
  • +10/-10 
    classes.py
    Refactored report status handling and error logging.         

    api_app/classes.py

  • Updated report status handling to use STATUSES.
  • Modified error logging and handling in after_run_failed.
  • +4/-4     
    greynoiseintel.py
    Enhanced `GreyNoiseIntel` analyzer with data model logic.

    api_app/analyzers_manager/observable_analyzers/greynoiseintel.py

  • Added data model creation logic based on report attributes.
  • Implemented evaluation updates for GreyNoiseIntel analyzer.
  • +43/-0   
    admin.py
    Added admin views for data models with custom display.     

    api_app/data_model_manager/admin.py

  • Added admin views for DomainDataModel, FileDataModel, and IPDataModel.
  • Configured list display and custom admin methods.
  • +61/-0   
    phishing_extractor.py
    Added `PhishingExtractor` class for phishing analysis.     

    api_app/analyzers_manager/observable_analyzers/phishing/phishing_extractor.py

  • Implemented PhishingExtractor class for phishing analysis.
  • Configured URL and arguments for Docker-based execution.
  • +54/-0   
    classes.py
    Added `VisualizableDownload` class for file download visualization.

    api_app/visualizers_manager/classes.py

  • Added VisualizableDownload class for handling file downloads.
  • Implemented attributes and methods for download visualization.
  • +45/-0   
    elastic.py
    Refactored Elastic serializers for request and response handling.

    api_app/serializers/elastic.py

  • Refactored serializers for Elastic requests and responses.
  • Added ElasticJobSerializer and ElasticConfigSerializer.
  • +22/-17 
    serializers.py
    Added serializers for data models with related fields.     

    api_app/data_model_manager/serializers.py

  • Added serializers for DomainDataModel, IPDataModel, and FileDataModel.
  • Configured related fields and serializers for data models.
  • +49/-0   
    yara_scan.py
    Enhanced Yara scan with data model creation and signature handling.

    api_app/analyzers_manager/file_analyzers/yara_scan.py

  • Implemented data model creation logic for Yara scan results.
  • Added methods for signature handling in data models.
  • +30/-0   
    0056_download_sample_vt.py
    Add migration for VirusTotal sample download playbook       

    api_app/playbooks_manager/migrations/0056_download_sample_vt.py

  • Added a new migration script for PlaybookConfig and AnalyzerConfig.
  • Introduced a playbook for downloading samples from VirusTotal.
  • Defined forward and reverse migration functions.
  • +38/-0   
    app.py
    Set up Flask app for phishing analyzers with logging         

    integrations/phishing_analyzers/app.py

  • Created a Flask application for phishing analyzers.
  • Configured logging with file handlers for access and error logs.
  • Registered a shell command for phishing site extraction.
  • +39/-0   
    virus_total.py
    Improve VirusTotal ingestor configuration and logging       

    api_app/ingestors_manager/ingestors/virus_total.py

  • Added config method to set force_active_scan to False.
  • Enhanced logging for data retrieval in run method.
  • +10/-2   
    opencti.py
    Simplify observable type mapping in OpenCTI connector       

    api_app/connectors_manager/connectors/opencti.py

  • Simplified observable type mapping logic.
  • Removed unnecessary line breaks in code.
  • +3/-9     
    0131_analyzer_config_vt_sample_download.py
    Add migration for VirusTotal sample download analyzer       

    api_app/analyzers_manager/migrations/0131_analyzer_config_vt_sample_download.py

  • Added migration for AnalyzerConfig to support VirusTotal sample
    download.
  • Defined forward and reverse migration functions.
  • +34/-0   
    models.py
    Refactor Investigation model status handling                         

    api_app/investigations_manager/models.py

  • Renamed Status to STATUSES for consistency.
  • Updated status handling logic in set_correct_status.
  • +5/-5     
    maxmind.py
    Enhance MaxMind analyzer with data model updates                 

    api_app/analyzers_manager/observable_analyzers/maxmind.py

  • Added _update_data_model method to update evaluation based on
    organization.
  • Implemented logic for setting data model evaluation.
  • +26/-0   
    abuseipdb.py
    Add data model updates to AbuseIPDB analyzer                         

    api_app/analyzers_manager/observable_analyzers/abuseipdb.py

  • Added _update_data_model method to set evaluation based on report
    data.
  • Implemented logic for trusted and malicious evaluations.
  • +12/-0   
    0002_domaindatamodel_resolutions_and_more.py
    Update DomainDataModel with resolutions and IETF report   

    api_app/data_model_manager/migrations/0002_domaindatamodel_resolutions_and_more.py

  • Added resolutions field to DomainDataModel.
  • Modified ietf_report field to use ManyToManyField.
  • +38/-0   
    0137_analyzerreport_data_model_content_type_and_more.py
    Add data model fields to AnalyzerReport                                   

    api_app/analyzers_manager/migrations/0137_analyzerreport_data_model_content_type_and_more.py

  • Added fields for data_model_content_type and data_model_object_id.
  • Defined migration operations for AnalyzerReport.
  • +34/-0   
    vt3_sample_download.py
    Implement VirusTotal v3 sample download analyzer                 

    api_app/analyzers_manager/observable_analyzers/vt/vt3_sample_download.py

  • Implemented VirusTotalv3SampleDownload analyzer class.
  • Added method to download file data from VirusTotal.
  • +33/-0   
    dns.py
    Update DNS visualizer with new status references                 

    api_app/visualizers_manager/visualizers/dns.py

  • Updated status references to use STATUSES.
  • Ensured consistency in status handling in visualizer.
  • +3/-3     
    0138_alter_analyzerreport_data_model_content_type.py
    Alter data model content type field in AnalyzerReport       

    api_app/analyzers_manager/migrations/0138_alter_analyzerreport_data_model_content_type.py

  • Altered data_model_content_type field to limit choices to
    data_model_manager.
  • Defined migration operations for AnalyzerReport.
  • +29/-0   
    views.py
    Add viewsets for data models with pagination                         

    api_app/data_model_manager/views.py

  • Added viewsets for DomainDataModel, IPDataModel, and FileDataModel.
  • Implemented base view with pagination and permissions.
  • +30/-0   
    talos.py
    Enhance Talos analyzer with data model updates                     

    api_app/analyzers_manager/observable_analyzers/talos.py

  • Added _do_create_data_model and _update_data_model methods.
  • Implemented logic to update data model based on report findings.
  • +16/-0   
    urls.py
    Add URL routing for data model viewsets                                   

    api_app/data_model_manager/urls.py

  • Defined URL patterns for data model viewsets.
  • Registered routes for domain, IP, and file data models.
  • +22/-0   
    nvd_cve.py
    Simplify CVE format validation in NVD CVE analyzer             

    api_app/analyzers_manager/observable_analyzers/nvd_cve.py

  • Removed unused import for settings.
  • Simplified CVE format validation logic.
  • +1/-2     
    enums.py
    Define enums for data model attributes                                     

    api_app/data_model_manager/enums.py

  • Added enums for signature providers, data model tags, and evaluations.
  • Defined choices for various data model attributes.
  • +23/-0   
    queryset.py
    Add method to retrieve data models in queryset                     

    api_app/analyzers_manager/queryset.py

  • Added get_data_models method to AnalyzerReportQuerySet.
  • Implemented logic to filter data models by job.
  • +8/-0     
    0003_remove_ipdatamodel_ietf_report_and_more.py
    Update IPDataModel with IETF report relation                         

    api_app/data_model_manager/migrations/0003_remove_ipdatamodel_ietf_report_and_more.py

  • Removed ietf_report field from IPDataModel.
  • Added ietf_report as a ManyToManyField in IPDataModel.
  • +24/-0   
    intelx.py
    Simplify session header update in IntelX analyzer               

    api_app/analyzers_manager/observable_analyzers/intelx.py

  • Simplified session header update logic.
  • Ensured consistent header formatting.
  • +1/-3     
    0139_alter_analyzerconfig_mapping_data_model.py
    Alter mapping data model field in AnalyzerConfig                 

    api_app/analyzers_manager/migrations/0139_alter_analyzerconfig_mapping_data_model.py

  • Altered mapping_data_model field in AnalyzerConfig.
  • Updated field to use JSON with default and help text.
  • +18/-0   
    tor.py
    Enhance Tor analyzer with conditional data model creation

    api_app/analyzers_manager/observable_analyzers/tor.py

  • Added _do_create_data_model method with condition.
  • Implemented logic to check report findings before creating data model.

  • +3/-0     
    urls.py
    Update API URLs with data model routing                                   

    api_app/urls.py

  • Added name to plugin_report_queries path.
  • Included data_model URLs in main routing.
  • +2/-1     
    0134_analyzerconfig_mapping_data_model.py
    Add mapping data model field to AnalyzerConfig                     

    api_app/analyzers_manager/migrations/0134_analyzerconfig_mapping_data_model.py

  • Added mapping_data_model field to AnalyzerConfig.
  • Defined migration operations for adding JSON field.
  • +20/-0   
    urlscan.py
    Simplify header initialization in URLScan analyzer             

    api_app/analyzers_manager/observable_analyzers/urlscan.py

  • Simplified headers initialization in run method.
  • Ensured consistent header formatting.
  • +1/-4     
    load_file_same_playbook.py
    Implement LoadFileSamePlaybook pivot class                             

    api_app/pivots_manager/pivots/load_file_same_playbook.py

  • Implemented LoadFileSamePlaybook class extending LoadFile.
  • Added method to get playbook for file resubmission.
  • +15/-0   
    compare.py
    Enhance Compare pivot with error handling                               

    api_app/pivots_manager/pivots/compare.py

  • Improved error handling in should_run method.
  • Refactored logic to retrieve report value.
  • +4/-1     
    fields.py
    Add custom fields for data model management                           

    api_app/data_model_manager/fields.py

  • Added SetField and LowercaseCharField custom fields.
  • Implemented logic for unique list and lowercase conversion.
  • +19/-0   
    any_compare.py
    Improve AnyCompare pivot with enhanced value handling       

    api_app/pivots_manager/pivots/any_compare.py

  • Updated should_run method to improve value retrieval.
  • Enhanced logic for handling report values.
  • +4/-2     
    urlhaus.py
    Enhance URLHaus analyzer with conditional data model creation

    api_app/analyzers_manager/observable_analyzers/urlhaus.py

  • Added _do_create_data_model method with condition.
  • Implemented logic to check query status before creating data model.
  • +6/-0     
    pe_info.py
    Update PE Info analyzer with new status references             

    api_app/analyzers_manager/file_analyzers/pe_info.py

  • Updated status references to use STATUSES.
  • Ensured consistency in status handling in file analyzer.
  • +1/-1     
    elf_info.py
    Update ELF Info analyzer with new status references           

    api_app/analyzers_manager/file_analyzers/elf_info.py

  • Updated status references to use STATUSES.
  • Ensured consistency in status handling in file analyzer.
  • +1/-1     
    classes.py
    Update pivot classes with new status references                   

    api_app/pivots_manager/classes.py

  • Updated status references to use STATUSES.
  • Ensured consistency in status handling in pivot classes.
  • +1/-1     
    yara.py
    Update Yara visualizer with new status references               

    api_app/visualizers_manager/visualizers/yara.py

  • Updated status references to use STATUSES.
  • Ensured consistency in status handling in visualizer.
  • +1/-1     
    queryset.py
    Add BaseDataModelQuerySet with serialization method           

    api_app/data_model_manager/queryset.py

  • Added BaseDataModelQuerySet class with serialize method.
  • Implemented logic to serialize queryset data.
  • +8/-0     
    validators.js
    Enhance visualizer validators with mimetype parsing           

    frontend/src/components/jobs/result/visualizer/validators.js

  • Added parseMimetype function for mimetype validation.
  • Enhanced parseElementFields to handle download components.
  • +29/-13 
    apiURLs.js
    Refactor and add new aggregate API URLs                                   

    frontend/src/constants/apiURLs.js

  • Refactored aggregate paths into a constant.
  • Added new aggregate URIs for playbook, user, and TLP.
  • +9/-8     
    files.js
    Add file utility functions for download and size formatting

    frontend/src/utils/files.js

  • Implemented fileDownload and humanReadbleSize utility functions.
  • Added logic for file download and size formatting.
  • +20/-0   
    const.js
    Extend visualizer component types with download                   

    frontend/src/components/jobs/result/visualizer/elements/const.js

  • Added DOWNLOAD to VisualizerComponentType.
  • Extended component type enumeration for visualizers.
  • +1/-0     
    charts.jsx
    Implement dashboard chart components with recharts             

    frontend/src/components/dashboard/charts.jsx

  • Implemented dashboard chart components using recharts.
  • Added bar charts for job status, type, and classifications.
  • +217/-0 
    Configuration changes
    15 files
    0035_pivot_config_phishingextractortoanalysis.py
    Added migration for PhishingExtractorToAnalysis pivot configuration.

    api_app/pivots_manager/migrations/0035_pivot_config_phishingextractortoanalysis.py

  • Added migration for PhishingExtractorToAnalysis pivot configuration.
  • Included logic for creating related parameters and values.
  • +156/-0 
    0055_playbook_config_phishingextractor.py
    Added migration for `PhishingExtractor` playbook configuration.

    api_app/playbooks_manager/migrations/0055_playbook_config_phishingextractor.py

  • Added migration for PhishingExtractor playbook configuration.
  • Defined playbook parameters and values.
  • +126/-0 
    0054_playbook_config_phishinganalysis.py
    Added migration for `PhishingAnalysis` playbook configuration.

    api_app/playbooks_manager/migrations/0054_playbook_config_phishinganalysis.py

  • Added migration for PhishingAnalysis playbook configuration.
  • Defined playbook parameters and values.
  • +125/-0 
    0005_alter_domaindatamodel_external_references_and_more.py
    Altered data model fields for domain, file, and IP models.

    api_app/data_model_manager/migrations/0005_alter_domaindatamodel_external_references_and_more.py

  • Altered fields in DomainDataModel, FileDataModel, and IPDataModel.
  • Updated field types to use SetField with specific base fields.
  • +75/-0   
    0125_update_yara_repo.py
    Updated Yara repository URLs in migration.                             

    api_app/analyzers_manager/migrations/0125_update_yara_repo.py

  • Updated migration to handle multiple PluginConfig objects.
  • Modified repository URLs for Yara rules.
  • +8/-8     
    0135_data_mapping.py
    Added migration for data mapping in `AnalyzerConfig`.       

    api_app/analyzers_manager/migrations/0135_data_mapping.py

  • Added migration for data mapping in AnalyzerConfig.
  • Defined mappings for URLhaus, MaxMindGeoIP, and AbuseIPDB.
  • +58/-0   
    0036_alter_extractedonenotefiles_resubmitdownloadedfile_loadfilesameplaybook.py
    Updated pivot configurations for specific playbooks.         

    api_app/pivots_manager/migrations/0036_alter_extractedonenotefiles_resubmitdownloadedfile_loadfilesameplaybook.py

  • Added migration to update pivot configurations for
    ExtractedOneNoteFiles and ResubmitDownloadedFile.
  • Created new PythonModule and Parameter for pivots.
  • +52/-0   
    0004_alter_domaindatamodel_evaluation_and_more.py
    Altered evaluation fields in data models for consistency.

    api_app/data_model_manager/migrations/0004_alter_domaindatamodel_evaluation_and_more.py

  • Altered evaluation fields in data models to use LowercaseCharField.
  • Updated choices for evaluation field in domain, file, and IP models.
  • +63/-0   
    0064_vt_sample_download.py
    Added migration for VirusTotal sample download configuration.

    api_app/migrations/0064_vt_sample_download.py

  • Added migration for VirusTotal sample download configuration.
  • Created Python modules and parameters for VirusTotal integration.
  • +53/-0   
    0039_sample_download.py
    Added migration for `Download_File` visualizer configuration.

    api_app/visualizers_manager/migrations/0039_sample_download.py

  • Added migration for Download_File visualizer configuration.
  • Linked visualizer to relevant playbooks and analyzers.
  • +38/-0   
    __init__.py
    Add data model manager to installed apps                                 

    threat_matrix/settings/init.py

  • Added api_app.data_model_manager to installed apps.
  • Ensured data model manager is included in settings.
  • +1/-0     
    apps.py
    Add app configuration for data model manager                         

    api_app/data_model_manager/apps.py

  • Created DataModelConfig class for app configuration.
  • Defined app name for data model manager.
  • +5/-0     
    environment.js
    Update documentation URL in environment constants               

    frontend/src/constants/environment.js

  • Updated THREATMATRIX_DOCS_URL to new documentation path.
  • Ensured consistency in documentation URL references.
  • +1/-1     
    entrypoint.sh
    Add entrypoint script for phishing analyzers                         

    integrations/phishing_analyzers/entrypoint.sh

  • Created entrypoint script for phishing analyzers.
  • Configured logging and permissions for application startup.
  • +14/-0   
    dependabot.yml
    Update dependabot configuration for develop branch             

    .github/dependabot.yml

  • Changed target branch for dependabot updates to develop.
  • Added configuration for phishing analyzers dependencies.
  • +31/-7   
    Formatting
    2 files
    spyse.py
    Reorder imports in Spyse analyzer for consistency               

    api_app/analyzers_manager/observable_analyzers/spyse.py

  • Reordered imports for consistency.
  • Ensured proper import grouping and formatting.
  • +1/-1     
    email_sender.py
    Reorder imports in EmailSender connector for consistency 

    api_app/connectors_manager/connectors/email_sender.py

  • Reordered imports for consistency.
  • Ensured proper import grouping and formatting.
  • +1/-1     
    Documentation
    2 files
    ldap_config.py
    Update LDAP configuration documentation URL                           

    configuration/ldap_config.py

  • Updated LDAP documentation URL to new path.
  • Ensured consistency in documentation references.
  • +1/-1     
    CHANGELOG.md
    Update changelog with new documentation links and draft   

    .github/CHANGELOG.md

  • Updated documentation links to new path.
  • Added draft changelog for v6.2.0 with release schedule.
  • +62/-49 
    Additional files (token-limit)
    41 files
    README.md
    ...                                                                                                           

    README.md

    ...

    +38/-30 
    package-lock.json
    ...                                                                                                           

    frontend/package-lock.json

    ...

    +78/-0   
    pull_request_template.md
    ...                                                                                                           

    .github/pull_request_template.md

    ...

    +8/-8     
    download.test.jsx
    ...                                                                                                           

    frontend/tests/components/jobs/result/visualizer/elements/download.test.jsx

    ...

    +117/-0 
    Dashboard.jsx
    ...                                                                                                           

    frontend/src/components/dashboard/Dashboard.jsx

    ...

    +29/-27 
    download.jsx
    ...                                                                                                           

    frontend/src/components/jobs/result/visualizer/elements/download.jsx

    ...

    +87/-0   
    Home.jsx
    ...                                                                                                           

    frontend/src/components/home/Home.jsx

    ...

    +13/-14 
    Dockerfile
    ...                                                                                                           

    integrations/phishing_analyzers/Dockerfile

    ...

    +43/-0   
    release_template.md
    ...                                                                                                           

    .github/release_template.md

    ...

    +7/-5     
    compose.yml
    ...                                                                                                           

    integrations/phishing_analyzers/compose.yml

    ...

    +39/-0   
    visualizer.jsx
    ...                                                                                                           

    frontend/src/components/jobs/result/visualizer/visualizer.jsx

    ...

    +20/-1   
    AppHeader.test.jsx
    ...                                                                                                           

    frontend/tests/layouts/AppHeader.test.jsx

    ...

    +3/-3     
    Dashboard.test.jsx
    ...                                                                                                           

    frontend/tests/components/dashboard/Dashboard.test.jsx

    ...

    +27/-0   
    visualizer.test.jsx
    ...                                                                                                           

    frontend/tests/components/jobs/result/visualizer/visualizer.test.jsx

    ...

    +14/-0   
    start
    ...                                                                                                           

    start

    ...

    +5/-1     
    JobActionBar.jsx
    ...                                                                                                           

    frontend/src/components/jobs/result/bar/JobActionBar.jsx

    ...

    +1/-10   
    README.md
    ...                                                                                                           

    frontend/README.md

    ...

    +1/-1     
    pull_request_automation.yml
    ...                                                                                                           

    .github/workflows/pull_request_automation.yml

    ...

    +3/-5     
    notifications.jsx
    ...                                                                                                           

    frontend/src/components/jobs/notifications.jsx

    ...

    +4/-7     
    Dockerfile
    ...                                                                                                           

    integrations/malware_tools_analyzers/Dockerfile

    ...

    +2/-2     
    plugin_report.json
    ...                                                                                                           

    configuration/elastic_search_mappings/plugin_report.json

    ...

    +24/-0   
    TLPSelectInput.jsx
    ...                                                                                                           

    frontend/src/components/common/form/TLPSelectInput.jsx

    ...

    +3/-3     
    GuideWrapper.jsx
    ...                                                                                                           

    frontend/src/components/GuideWrapper.jsx

    ...

    +2/-2     
    test.override.yml
    ...                                                                                                           

    docker/test.override.yml

    ...

    +2/-2     
    TokenPage.jsx
    ...                                                                                                           

    frontend/src/components/user/token/TokenPage.jsx

    ...

    +2/-2     
    TokenAccess.jsx
    ...                                                                                                           

    frontend/src/components/user/token/TokenAccess.jsx

    ...

    +2/-3     
    create_elastic_certs
    ...                                                                                                           

    create_elastic_certs

    ...

    +4/-0     
    PluginWrapper.jsx
    ...                                                                                                           

    frontend/src/components/plugins/types/PluginWrapper.jsx

    ...

    +1/-1     
    package.json
    ...                                                                                                           

    frontend/package.json

    ...

    +1/-0     
    requirements.txt
    ...                                                                                                           

    integrations/phishing_analyzers/requirements.txt

    ...

    +5/-0     
    compose-tests.yml
    ...                                                                                                           

    integrations/phishing_analyzers/compose-tests.yml

    ...

    +8/-0     
    project-requirements.txt
    ...                                                                                                           

    requirements/project-requirements.txt

    ...

    +1/-1     
    compose.yml
    ...                                                                                                           

    integrations/malware_tools_analyzers/compose.yml

    ...

    +2/-0     
    FUNDING.yml
    ...                                                                                                           

    .github/FUNDING.yml

    ...

    +2/-1     
    compose.yml
    ...                                                                                                           

    integrations/pcap_analyzers/compose.yml

    ...

    +2/-0     
    compose.yml
    ...                                                                                                           

    integrations/tor_analyzers/compose.yml

    ...

    +2/-0     
    elasticsearch.override.yml
    ...                                                                                                           

    docker/elasticsearch.override.yml

    ...

    +2/-1     
    CONTRIBUTING.md
    ...                                                                                                           

    .github/CONTRIBUTING.md

    ...

    +1/-1     
    compose.yml
    ...                                                                                                           

    integrations/phoneinfoga/compose.yml

    ...

    +1/-1     
    compose-tests.yml
    ...                                                                                                           

    integrations/malware_tools_analyzers/compose-tests.yml

    ...

    +2/-0     
    compose-tests.yml
    ...                                                                                                           

    integrations/tor_analyzers/compose-tests.yml

    ...

    +2/-0     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    sourcery-ai bot commented Dec 10, 2024

    Reviewer's Guide by Sourcery

    This PR implements several major changes to improve the codebase, including:

    1. The addition of a new Data Model framework to standardize and structure analysis results
    2. Updates to the dashboard visualization with new charts and metrics
    3. Integration of phishing analysis capabilities
    4. Various bug fixes and improvements to the test suite

    Class diagram for AnalyzerReport and related classes

    classDiagram
        class AnalyzerReport {
            +ForeignKey config
            +ForeignKey data_model_content_type
            +IntegerField data_model_object_id
            +GenericForeignKey data_model
            +clean()
            +get_data_model_class(job)
            +data_model_class
            +_validation_before_data_model()
            +_create_data_model_dictionary()
            +create_data_model()
        }
        class BaseDataModel {
            <<interface>>
        }
        class FileDataModel {
            +get_fields()
        }
        class IPDataModel {
            +get_fields()
        }
        class DomainDataModel {
            +get_fields()
        }
        class ObservableTypes {
            +HASH
            +IP
            +DOMAIN
            +URL
        }
        AnalyzerReport --> BaseDataModel : uses
        AnalyzerReport --> ObservableTypes
        BaseDataModel <|-- FileDataModel
        BaseDataModel <|-- IPDataModel
        BaseDataModel <|-- DomainDataModel
    
    Loading

    Class diagram for Job and AbstractReport

    classDiagram
        class Job {
            +ForeignKey investigation
            +CharField status
            +retry()
            +set_final_status()
            +kill_if_ongoing()
            +execute()
            +user_month_submissions(user)
        }
        class AbstractReport {
            +CharField status
            +JSONField report
            +ArrayField errors
            +user
            +process_time()
            +get_value(search_from, fields)
        }
        class Investigation {
            +CharField status
            +set_correct_status(save)
        }
        Job --> AbstractReport : contains
        Job --> Investigation : references
        AbstractReport --> User : references
        Investigation --> Job : contains
    
    Loading

    Class diagram for VisualizableDownload and related classes

    classDiagram
        class VisualizableObject {
            +size
            +alignment
            +disable
        }
        class VisualizableDownload {
            +String value
            +String payload
            +String copy_text
            +String description
            +Boolean add_metadata_in_description
            +String link
            +String mimetype
            +type
            +attributes
        }
        VisualizableObject <|-- VisualizableDownload
    
    Loading

    File-Level Changes

    Change Details Files
    Added new Data Model framework to standardize analysis results
    • Created new data model classes for Domain, IP, and File data types
    • Added serializers and views for the data models
    • Implemented data model mapping in analyzers
    • Added database migrations for the new data model tables
    api_app/data_model_manager/models.py
    api_app/data_model_manager/serializers.py
    api_app/data_model_manager/views.py
    api_app/data_model_manager/migrations/*
    Enhanced dashboard visualization with new charts and metrics
    • Added new charts for top playbooks, users and TLP levels
    • Refactored chart components for better code organization
    • Updated dashboard layout and styling
    • Added new API endpoints for chart data
    frontend/src/components/dashboard/Dashboard.jsx
    frontend/src/components/dashboard/charts.jsx
    api_app/views.py
    Added phishing analysis capabilities
    • Created new phishing analyzer container and service
    • Implemented phishing form compiler analyzer
    • Added phishing extractor analyzer
    • Created phishing analysis playbook
    integrations/phishing_analyzers/*
    api_app/analyzers_manager/file_analyzers/phishing/*
    api_app/analyzers_manager/observable_analyzers/phishing/*
    Added new file download visualizer component
    • Created new download visualizer component
    • Added support for downloading files from analysis results
    • Implemented file size and mimetype handling
    • Added tests for download functionality
    frontend/src/components/jobs/result/visualizer/elements/download.jsx
    frontend/src/utils/files.js
    api_app/visualizers_manager/visualizers/sample_download.py
    Fixed and improved test suite
    • Updated test cases for new data model functionality
    • Fixed test assertions and mocks
    • Added new test cases for download functionality
    • Improved test coverage
    tests/api_app/data_model_manager/*
    tests/api_app/test_views.py
    tests/api_app/test_models.py

    Tips and commands

    Interacting with Sourcery

    • Trigger a new review: Comment @sourcery-ai review on the pull request.
    • Continue discussions: Reply directly to Sourcery's review comments.
    • Generate a GitHub issue from a review comment: Ask Sourcery to create an
      issue from a review comment by replying to it.
    • Generate a pull request title: Write @sourcery-ai anywhere in the pull
      request title to generate a title at any time.
    • Generate a pull request summary: Write @sourcery-ai summary anywhere in
      the pull request body to generate a PR summary at any time. You can also use
      this command to specify where the summary should be inserted.

    Customizing Your Experience

    Access your dashboard to:

    • Enable or disable review features such as the Sourcery-generated pull request
      summary, the reviewer's guide, and others.
    • Change the review language.
    • Add, remove or edit custom review instructions.
    • Adjust other review settings.

    Getting Help

    Copy link

    coderabbitai bot commented Dec 10, 2024

    Important

    Review skipped

    Auto reviews are disabled on base/target branches other than the default branch.

    Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

    You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


    Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

    ❤️ Share
    🪧 Tips

    Chat

    There are 3 ways to chat with CodeRabbit:

    • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
      • I pushed a fix in commit <commit_id>, please review it.
      • Generate unit testing code for this file.
      • Open a follow-up GitHub issue for this discussion.
    • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
      • @coderabbitai generate unit testing code for this file.
      • @coderabbitai modularize this function.
    • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
      • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
      • @coderabbitai read src/utils.ts and generate unit testing code.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
      • @coderabbitai help me debug CodeRabbit configuration file.

    Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

    CodeRabbit Commands (Invoked using PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai full review to do a full review from scratch and review all the files again.
    • @coderabbitai summary to regenerate the summary of the PR.
    • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
    • @coderabbitai help to get help.

    Other keywords and placeholders

    • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
    • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
    • Add @coderabbitai anywhere in the PR title to generate the title automatically.

    CodeRabbit Configuration File (.coderabbit.yaml)

    • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
    • Please see the configuration documentation for more information.
    • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

    Documentation and Community

    • Visit our Documentation for detailed information on how to use CodeRabbit.
    • Join our Discord Community to get help, request features, and share feedback.
    • Follow us on X/Twitter for updates and announcements.

    Copy link

    deepsource-io bot commented Dec 10, 2024

    Here's the code health analysis summary for commits 90eee48..983802d. View details on DeepSource ↗.

    Analysis Summary

    AnalyzerStatusSummaryLink
    DeepSource Python LogoPython❌ Failure
    ❗ 160 occurences introduced
    🎯 29 occurences resolved
    View Check ↗
    DeepSource Docker LogoDocker❌ Failure
    ❗ 2 occurences introduced
    View Check ↗

    💡 If you’re a repository administrator, you can configure the quality gates from the settings.

    Copy link
    Contributor

    codiumai-pr-agent-free bot commented Dec 10, 2024

    CI Failure Feedback 🧐

    (Checks updated until commit 40e1146)

    Action: backend-tests

    Failed stage: Run test [❌]

    Failed test name: test_min_password_lenght_400

    Failure summary:

    The action failed due to a test error:

  • The test test_min_password_lenght_400 in the file tests/auth/test_auth.py encountered a KeyError.
  • The error occurred because the key password was not found in the content["errors"] dictionary.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    55:  Found 4 runs total.
    56:  Found 1 runs to cancel.
    57:  Canceling run:  {
    58:  id: 12249938682,
    59:  head_sha: 'cb33c7c9d1601975a09d19203a334f06d85e15a9',
    60:  status: 'in_progress',
    61:  html_url: 'https://github.com/khulnasoft/ThreatMatrix/actions/runs/12249938682'
    62:  }
    63:  Error while canceling workflow_id 105140454: Resource not accessible by integration
    ...
    
    2367:  #15 10.77 Checking optional features...
    2368:  #15 10.77 inc_bundling_support....disabled
    2369:  #15 10.77   requires:
    2370:  #15 10.77     ! inc::latest is not installed
    2371:  #15 10.77 license_creation........disabled
    2372:  #15 10.77   requires:
    2373:  #15 10.77     ! Software::License is not installed
    2374:  #15 10.77 
    2375:  #15 10.77 ERRORS/WARNINGS FOUND IN PREREQUISITES.  You may wish to install the versions
    ...
    
    2455:  #15 11.69     !  Email::MIME is not installed
    2456:  #15 11.69     !  Email::MIME::ContentType is not installed
    2457:  #15 11.69     !  Email::Sender is not installed
    2458:  #15 11.69     !  Email::Simple is not installed
    2459:  #15 11.69     !  IO::All is not installed
    2460:  #15 11.69     !  IO::String is not installed
    2461:  #15 11.69     !  OLE::Storage_Lite is not installed
    2462:  #15 11.69 
    2463:  #15 11.69 ERRORS/WARNINGS FOUND IN PREREQUISITES.  You may wish to install the versions
    ...
    
    3728:  #15 23.58 Warning: prerequisite Capture::Tiny 0.08 not found.
    3729:  #15 23.58 Warning: prerequisite Email::Abstract 3.006 not found.
    3730:  #15 23.58 Warning: prerequisite Moo 2.000000 not found.
    3731:  #15 23.58 Warning: prerequisite Moo::Role 0 not found.
    3732:  #15 23.58 Warning: prerequisite MooX::Types::MooseLike 0.15 not found.
    3733:  #15 23.58 Warning: prerequisite MooX::Types::MooseLike::Base 0 not found.
    3734:  #15 23.58 Warning: prerequisite Sub::Exporter 0 not found.
    3735:  #15 23.58 Warning: prerequisite Sub::Exporter::Util 0 not found.
    3736:  #15 23.58 Warning: prerequisite Throwable::Error 0.200003 not found.
    ...
    
    3748:  #15 23.70     Capture::Tiny [build_requires]
    3749:  #15 23.70     Email::Abstract [requires]
    3750:  #15 23.70     Moo [requires]
    3751:  #15 23.70     Moo::Role [requires]
    3752:  #15 23.70     MooX::Types::MooseLike [requires]
    3753:  #15 23.70     MooX::Types::MooseLike::Base [requires]
    3754:  #15 23.70     Sub::Exporter [requires]
    3755:  #15 23.70     Sub::Exporter::Util [requires]
    3756:  #15 23.70     Throwable::Error [requires]
    ...
    
    4070:  #14 35.98 "@babel/plugin-proposal-private-property-in-object" package without
    4071:  #14 35.98 declaring it in its dependencies. This is currently working because
    4072:  #14 35.98 "@babel/plugin-proposal-private-property-in-object" is already in your
    4073:  #14 35.98 node_modules folder for unrelated reasons, but it �[1mmay break at any time�[0;33m.
    4074:  #14 35.98 
    4075:  #14 35.98 babel-preset-react-app is part of the create-react-app project, �[1mwhich
    4076:  #14 35.98 is not maintianed anymore�[0;33m. It is thus unlikely that this bug will
    4077:  #14 35.98 ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
    4078:  #14 35.98 your devDependencies to work around this error. This will make this message
    ...
    
    5529:  #15 51.44 Installing /usr/local/man/man3/Sub::Exporter::Cookbook.3pm
    5530:  #15 51.44 Installing /usr/local/man/man3/Sub::Exporter.3pm
    5531:  #15 51.44 Installing /usr/local/man/man3/Sub::Exporter::Util.3pm
    5532:  #15 51.44 Installing /usr/local/man/man3/Sub::Exporter::Tutorial.3pm
    5533:  #15 51.45 Appending installation info to /usr/local/lib/x86_64-linux-gnu/perl/5.36.0/perllocal.pod
    5534:  #15 51.47   RJBS/Sub-Exporter-0.991.tar.gz
    5535:  #15 51.47   /usr/bin/make install  -- OK
    5536:  #15 51.47 Sub::Exporter::Util is up to date (0.991).
    5537:  #15 51.48 Running install for module 'Throwable::Error'
    ...
    
    5645:  #15 53.21   DROLSKY/Devel-StackTrace-2.05.tar.gz
    5646:  #15 53.21   /usr/bin/make install  -- OK
    5647:  #15 53.21   RJBS/Throwable-1.001.tar.gz
    5648:  #15 53.21   Has already been unwrapped into directory /root/.cpan/build/Throwable-1.001-0
    5649:  #15 53.21   RJBS/Throwable-1.001.tar.gz
    5650:  #15 53.21   Has already been prepared
    5651:  #15 53.21 Running make for R/RJ/RJBS/Throwable-1.001.tar.gz
    5652:  #15 53.43 cp lib/Throwable.pm blib/lib/Throwable.pm
    5653:  #15 53.43 cp lib/Throwable/Error.pm blib/lib/Throwable/Error.pm
    ...
    
    5655:  #15 53.51 Manifying 3 pod documents
    5656:  #15 53.51   RJBS/Throwable-1.001.tar.gz
    5657:  #15 53.51   /usr/bin/make -- OK
    5658:  #15 53.51   RJBS/Throwable-1.001.tar.gz
    5659:  #15 53.51   Skipping test because of notest pragma
    5660:  #15 53.51 Running make install for RJBS/Throwable-1.001.tar.gz
    5661:  #15 53.59 Manifying 3 pod documents
    5662:  #15 53.64 Installing /usr/local/share/perl/5.36.0/Throwable.pm
    5663:  #15 53.64 Installing /usr/local/share/perl/5.36.0/Throwable/Error.pm
    5664:  #15 53.64 Installing /usr/local/share/perl/5.36.0/StackTrace/Auto.pm
    5665:  #15 53.64 Installing /usr/local/man/man3/Throwable::Error.3pm
    ...
    
    8043:  #19 111.4   Attempting uninstall: prometheus-client
    8044:  #19 111.4     Found existing installation: prometheus_client 0.21.1
    8045:  #19 111.4     Uninstalling prometheus_client-0.21.1:
    8046:  #19 111.4       Successfully uninstalled prometheus_client-0.21.1
    8047:  #19 111.6   Attempting uninstall: cachetools
    8048:  #19 111.6     Found existing installation: cachetools 5.5.0
    8049:  #19 111.6     Uninstalling cachetools-5.5.0:
    8050:  #19 111.6       Successfully uninstalled cachetools-5.5.0
    8051:  #19 111.9 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
    ...
    
    8138:  #19 114.2   Stored in directory: /tmp/pip-ephem-wheel-cache-wtl1qcks/wheels/0f/fe/56/6cba6eafbb252c805af7616631ef63d8e0790c958b1bd86c63
    8139:  #19 114.2 Successfully built drf-flex-fields
    8140:  #19 114.4 Installing collected packages: drf-flex-fields, ua-parser-builtins, slack-sdk, python-ipware, oauthlib, Markdown, django-cache-memoize, ua-parser, stripe, requests-oauthlib, django-ipware, user-agents, python-twitter, drf-recaptcha, django-rest-durin, django-user-agents, certego-saas
    8141:  #19 115.8 Successfully installed Markdown-3.3.7 certego-saas-0.7.11 django-cache-memoize-0.2.0 django-ipware-7.0.1 django-rest-durin-1.0.0 django-user-agents-0.4.0 drf-flex-fields-1.0.2 drf-recaptcha-4.0.2 oauthlib-3.2.2 python-ipware-3.0.0 python-twitter-3.5 requests-oauthlib-2.0.0 slack-sdk-3.33.5 stripe-11.3.0 ua-parser-1.0.0 ua-parser-builtins-0.18.0.post1 user-agents-2.2.0
    8142:  #19 115.8 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
    8143:  #19 DONE 117.9s
    8144:  #20 [uwsgi backend-build  9/10] COPY . /opt/deploy/threat_matrix
    8145:  #20 DONE 0.2s
    8146:  #21 [uwsgi backend-build 10/10] RUN touch /var/log/threat_matrix/django/api_app.log /var/log/threat_matrix/django/api_app_errors.log     && touch /var/log/threat_matrix/django/threat_matrix.log /var/log/threat_matrix/django/threat_matrix_errors.log     && touch /var/log/threat_matrix/django/celery.log /var/log/threat_matrix/django/celery_errors.log     && touch /var/log/threat_matrix/django/django_auth_ldap.log /var/log/threat_matrix/django/django_errors.log     && touch /var/log/threat_matrix/django/certego_saas.log /var/log/threat_matrix/django/certego_saas_errors.log     && touch /var/log/threat_matrix/django/authentication.log /var/log/threat_matrix/django/authentication_errors.log     && touch /var/log/threat_matrix/asgi/daphne.log     && chown -R www-data:www-data /var/log/threat_matrix /opt/deploy/     && /opt/deploy/threat_matrix/docker/scripts/watchman_install.sh     && /opt/deploy/threat_matrix/api_app/analyzers_manager/repo_downloader.sh
    ...
    
    8198:  #28 extracting sha256:b17a9d410da1886001947f5f826043292df395277cb23e17970f5b82a6b486ed done
    8199:  #28 extracting sha256:542e3e75411d1223efe21092951a0b87b85cb4377accf8f360d635d23dea72a9 done
    8200:  #28 extracting sha256:2b2faad386dfd2da1e19aa6e0d91d428b849181de439c0b289f383816c812304 done
    8201:  #28 extracting sha256:a5e22afba545a92d46609059fe9fe2b90028b9f3fb7c78be28cb6d4ed9e53fd3 done
    8202:  #28 sha256:fb923a41dc10df4d74119907e9112426c8e0e2ce3d6851c4e2dcfb7e0765861b 13.04MB / 13.04MB 0.6s done
    8203:  #28 extracting sha256:fb923a41dc10df4d74119907e9112426c8e0e2ce3d6851c4e2dcfb7e0765861b 0.1s
    8204:  #28 extracting sha256:fb923a41dc10df4d74119907e9112426c8e0e2ce3d6851c4e2dcfb7e0765861b 0.3s done
    8205:  #28 DONE 1.0s
    8206:  #29 [nginx 2/2] RUN rm /var/log/nginx/access.log /var/log/nginx/error.log && touch /var/log/nginx/access.log /var/log/nginx/error.log
    ...
    
    8300:  Applying contenttypes.0001_initial... OK
    8301:  Applying contenttypes.0002_remove_content_type_name... OK
    8302:  Applying auth.0001_initial... OK
    8303:  Applying auth.0002_alter_permission_name_max_length... OK
    8304:  Applying auth.0003_alter_user_email_max_length... OK
    8305:  Applying auth.0004_alter_user_username_opts... OK
    8306:  Applying auth.0005_alter_user_last_login_null... OK
    8307:  Applying auth.0006_require_contenttypes_0002... OK
    8308:  Applying auth.0007_alter_validators_add_error_messages... OK
    ...
    
    8751:  Elasticsearch not active, templates not updated
    8752:  [--debug | --no-debug] [--version]
    8753:  [-v {0,1,2,3}] [--settings SETTINGS]
    8754:  [--pythonpath PYTHONPATH]
    8755:  [--traceback] [--no-color]
    8756:  [--force-color] [--skip-checks]
    8757:  path
    8758:  {ACCOUNTS,DRAGONFLY,INTELOWL,QUOKKA_PUBLIC,QUOKKA}
    8759:  manage.py changelog_notification: error: argument appname: invalid choice: 'THREATMATRIX' (choose from 'ACCOUNTS', 'DRAGONFLY', 'INTELOWL', 'QUOKKA_PUBLIC', 'QUOKKA')
    ...
    
    8817:  Created job for kotlin.kt, with mimetype text/x-kotlin
    8818:  Created job for objectivec.m, with mimetype text/x-objective-c
    8819:  Created job for swift.swift, with mimetype text/x-swift
    8820:  Created job for android.xml, with mimetype text/xml
    8821:  No defined file for mimetype application/zip
    8822:  No defined file for mimetype application/x-dex
    8823:  Testing Analyzer APKiD
    8824:  Testing with config APKiD
    8825:  skipping APKiD cause health check failed
    8826:  skipping APKiD cause health check failed
    8827:  skipping APKiD cause health check failed
    8828:  skipping APKiD cause health check failed
    ...
    
    8835:  Testing Analyzer BlintAnalyzer
    8836:  Testing with config Blint
    8837:  Testing sample.apk with mimetype application/vnd.android.package-archive for 30 seconds
    8838:  Testing ping.elf with mimetype application/x-sharedlib for 30 seconds
    8839:  Testing file.dll with mimetype application/vnd.microsoft.portable-executable for 30 seconds
    8840:  Testing file.exe with mimetype application/vnd.microsoft.portable-executable for 30 seconds
    8841:  Testing Analyzer BoxJS
    8842:  Testing with config BoxJS
    8843:  skipping BoxJS cause health check failed
    8844:  skipping BoxJS cause health check failed
    8845:  skipping BoxJS cause health check failed
    ...
    
    8872:  Testing ping.elf with mimetype application/x-sharedlib for 30 seconds
    8873:  Testing file.dll with mimetype application/vnd.microsoft.portable-executable for 30 seconds
    8874:  Testing file.exe with mimetype application/vnd.microsoft.portable-executable for 30 seconds
    8875:  Testing with config Capa_Info_Shellcode
    8876:  Testing shellcode.bin with mimetype application/octet-stream for 30 seconds
    8877:  Testing AndroidManifest.xml with mimetype application/octet-stream for 30 seconds
    8878:  Testing Analyzer ClamAV
    8879:  Testing with config ClamAV
    8880:  skipping ClamAV cause health check failed
    8881:  skipping ClamAV cause health check failed
    8882:  skipping ClamAV cause health check failed
    8883:  skipping ClamAV cause health check failed
    8884:  skipping ClamAV cause health check failed
    8885:  skipping ClamAV cause health check failed
    8886:  skipping ClamAV cause health check failed
    8887:  skipping ClamAV cause health check failed
    8888:  skipping ClamAV cause health check failed
    8889:  skipping ClamAV cause health check failed
    8890:  skipping ClamAV cause health check failed
    8891:  skipping ClamAV cause health check failed
    8892:  skipping ClamAV cause health check failed
    8893:  skipping ClamAV cause health check failed
    8894:  skipping ClamAV cause health check failed
    8895:  skipping ClamAV cause health check failed
    8896:  skipping ClamAV cause health check failed
    8897:  skipping ClamAV cause health check failed
    8898:  skipping ClamAV cause health check failed
    8899:  skipping ClamAV cause health check failed
    8900:  skipping ClamAV cause health check failed
    8901:  skipping ClamAV cause health check failed
    8902:  skipping ClamAV cause health check failed
    8903:  skipping ClamAV cause health check failed
    8904:  skipping ClamAV cause health check failed
    8905:  skipping ClamAV cause health check failed
    8906:  skipping ClamAV cause health check failed
    8907:  skipping ClamAV cause health check failed
    8908:  skipping ClamAV cause health check failed
    8909:  skipping ClamAV cause health check failed
    8910:  skipping ClamAV cause health check failed
    8911:  skipping ClamAV cause health check failed
    8912:  skipping ClamAV cause health check failed
    8913:  skipping ClamAV cause health check failed
    8914:  skipping ClamAV cause health check failed
    8915:  skipping ClamAV cause health check failed
    8916:  skipping ClamAV cause health check failed
    8917:  skipping ClamAV cause health check failed
    8918:  skipping ClamAV cause health check failed
    8919:  skipping ClamAV cause health check failed
    8920:  skipping ClamAV cause health check failed
    8921:  skipping ClamAV cause health check failed
    8922:  skipping ClamAV cause health check failed
    8923:  skipping ClamAV cause health check failed
    8924:  skipping ClamAV cause health check failed
    8925:  skipping ClamAV cause health check failed
    8926:  skipping ClamAV cause health check failed
    8927:  skipping ClamAV cause health check failed
    8928:  skipping ClamAV cause health check failed
    8929:  skipping ClamAV cause health check failed
    8930:  skipping ClamAV cause health check failed
    8931:  skipping ClamAV cause health check failed
    8932:  skipping ClamAV cause health check failed
    8933:  skipping ClamAV cause health check failed
    8934:  skipping ClamAV cause health check failed
    8935:  skipping ClamAV cause health check failed
    ...
    
    8954:  Testing Sublime-Standard-Test-String.eml with mimetype message/rfc822 for 30 seconds
    8955:  Testing java_vuln.java with mimetype text/x-java for 30 seconds
    8956:  Testing kotlin.kt with mimetype text/x-kotlin for 30 seconds
    8957:  Testing swift.swift with mimetype text/x-swift for 30 seconds
    8958:  Testing objectivec.m with mimetype text/x-objective-c for 30 seconds
    8959:  Testing downloader.lnk with mimetype application/x-ms-shortcut for 30 seconds
    8960:  Testing Analyzer DetectItEasy
    8961:  Testing with config DetectItEasy
    8962:  skipping DetectItEasy cause health check failed
    8963:  skipping DetectItEasy cause health check failed
    8964:  skipping DetectItEasy cause health check failed
    8965:  skipping DetectItEasy cause health check failed
    8966:  skipping DetectItEasy cause health check failed
    8967:  skipping DetectItEasy cause health check failed
    8968:  skipping DetectItEasy cause health check failed
    8969:  skipping DetectItEasy cause health check failed
    8970:  skipping DetectItEasy cause health check failed
    8971:  skipping DetectItEasy cause health check failed
    8972:  skipping DetectItEasy cause health check failed
    8973:  skipping DetectItEasy cause health check failed
    8974:  skipping DetectItEasy cause health check failed
    8975:  skipping DetectItEasy cause health check failed
    8976:  skipping DetectItEasy cause health check failed
    8977:  skipping DetectItEasy cause health check failed
    8978:  skipping DetectItEasy cause health check failed
    8979:  skipping DetectItEasy cause health check failed
    8980:  skipping DetectItEasy cause health check failed
    8981:  skipping DetectItEasy cause health check failed
    8982:  skipping DetectItEasy cause health check failed
    8983:  skipping DetectItEasy cause health check failed
    8984:  skipping DetectItEasy cause health check failed
    8985:  skipping DetectItEasy cause health check failed
    8986:  skipping DetectItEasy cause health check failed
    8987:  skipping DetectItEasy cause health check failed
    8988:  skipping DetectItEasy cause health check failed
    8989:  skipping DetectItEasy cause health check failed
    8990:  skipping DetectItEasy cause health check failed
    8991:  skipping DetectItEasy cause health check failed
    8992:  skipping DetectItEasy cause health check failed
    8993:  skipping DetectItEasy cause health check failed
    8994:  skipping DetectItEasy cause health check failed
    8995:  skipping DetectItEasy cause health check failed
    8996:  skipping DetectItEasy cause health check failed
    8997:  skipping DetectItEasy cause health check failed
    8998:  skipping DetectItEasy cause health check failed
    8999:  skipping DetectItEasy cause health check failed
    9000:  skipping DetectItEasy cause health check failed
    9001:  skipping DetectItEasy cause health check failed
    9002:  skipping DetectItEasy cause health check failed
    9003:  skipping DetectItEasy cause health check failed
    9004:  skipping DetectItEasy cause health check failed
    9005:  skipping DetectItEasy cause health check failed
    9006:  skipping DetectItEasy cause health check failed
    9007:  skipping DetectItEasy cause health check failed
    9008:  skipping DetectItEasy cause health check failed
    9009:  skipping DetectItEasy cause health check failed
    9010:  skipping DetectItEasy cause health check failed
    9011:  skipping DetectItEasy cause health check failed
    9012:  skipping DetectItEasy cause health check failed
    9013:  skipping DetectItEasy cause health check failed
    9014:  skipping DetectItEasy cause health check failed
    9015:  skipping DetectItEasy cause health check failed
    9016:  skipping DetectItEasy cause health check failed
    9017:  skipping DetectItEasy cause health check failed
    9018:  skipping DetectItEasy cause health check failed
    ...
    
    9079:  Testing Sublime-Standard-Test-String.eml with mimetype message/rfc822 for 30 seconds
    9080:  Testing java_vuln.java with mimetype text/x-java for 30 seconds
    9081:  Testing kotlin.kt with mimetype text/x-kotlin for 30 seconds
    9082:  Testing swift.swift with mimetype text/x-swift for 30 seconds
    9083:  Testing objectivec.m with mimetype text/x-objective-c for 30 seconds
    9084:  Testing downloader.lnk with mimetype application/x-ms-shortcut for 30 seconds
    9085:  Testing Analyzer Floss
    9086:  Testing with config Floss
    9087:  skipping Floss cause health check failed
    9088:  skipping Floss cause health check failed
    ...
    
    9182:  Testing with config PDF_Info
    9183:  Testing document.pdf with mimetype application/pdf for 30 seconds
    9184:  Testing Analyzer PEInfo
    9185:  Testing with config PE_Info
    9186:  Testing file.dll with mimetype application/vnd.microsoft.portable-executable for 30 seconds
    9187:  Testing file.exe with mimetype application/vnd.microsoft.portable-executable for 30 seconds
    9188:  Testing Analyzer PEframe
    9189:  Testing with config PEframe_Scan
    9190:  skipping PEframe cause health check failed
    ...
    
    9221:  Testing Sublime-Standard-Test-String.eml with mimetype message/rfc822 for 30 seconds
    9222:  Testing java_vuln.java with mimetype text/x-java for 30 seconds
    9223:  Testing kotlin.kt with mimetype text/x-kotlin for 30 seconds
    9224:  Testing swift.swift with mimetype text/x-swift for 30 seconds
    9225:  Testing objectivec.m with mimetype text/x-objective-c for 30 seconds
    9226:  Testing downloader.lnk with mimetype application/x-ms-shortcut for 30 seconds
    9227:  Testing Analyzer Qiling
    9228:  Testing with config Qiling_Linux
    9229:  skipping Qiling cause health check failed
    9230:  skipping Qiling cause health check failed
    9231:  skipping Qiling cause health check failed
    9232:  skipping Qiling cause health check failed
    9233:  Testing with config Qiling_Linux_Shellcode
    9234:  skipping Qiling cause health check failed
    9235:  Testing with config Qiling_Windows
    9236:  skipping Qiling cause health check failed
    9237:  Testing with config Qiling_Windows_Shellcode
    9238:  skipping Qiling cause health check failed
    ...
    
    9250:  Testing with config SpeakEasy
    9251:  Testing file.dll with mimetype application/vnd.microsoft.portable-executable for 30 seconds
    9252:  Testing file.exe with mimetype application/vnd.microsoft.portable-executable for 30 seconds
    9253:  Testing with config SpeakEasy_Shellcode
    9254:  Testing shellcode.bin with mimetype application/octet-stream for 30 seconds
    9255:  Testing AndroidManifest.xml with mimetype application/octet-stream for 30 seconds
    9256:  Testing Analyzer StringsInfo
    9257:  Testing with config Strings_Info
    9258:  skipping StringsInfo cause health check failed
    9259:  skipping StringsInfo cause health check failed
    9260:  skipping StringsInfo cause health check failed
    9261:  skipping StringsInfo cause health check failed
    9262:  skipping StringsInfo cause health check failed
    9263:  skipping StringsInfo cause health check failed
    9264:  skipping StringsInfo cause health check failed
    9265:  skipping StringsInfo cause health check failed
    9266:  skipping StringsInfo cause health check failed
    9267:  skipping StringsInfo cause health check failed
    9268:  skipping StringsInfo cause health check failed
    9269:  skipping StringsInfo cause health check failed
    9270:  skipping StringsInfo cause health check failed
    9271:  skipping StringsInfo cause health check failed
    9272:  skipping StringsInfo cause health check failed
    9273:  skipping StringsInfo cause health check failed
    9274:  skipping StringsInfo cause health check failed
    9275:  skipping StringsInfo cause health check failed
    9276:  skipping StringsInfo cause health check failed
    9277:  skipping StringsInfo cause health check failed
    9278:  skipping StringsInfo cause health check failed
    9279:  skipping StringsInfo cause health check failed
    9280:  skipping StringsInfo cause health check failed
    9281:  skipping StringsInfo cause health check failed
    9282:  skipping StringsInfo cause health check failed
    9283:  skipping StringsInfo cause health check failed
    9284:  skipping StringsInfo cause health check failed
    9285:  skipping StringsInfo cause health check failed
    9286:  skipping StringsInfo cause health check failed
    9287:  skipping StringsInfo cause health check failed
    9288:  skipping StringsInfo cause health check failed
    9289:  skipping StringsInfo cause health check failed
    9290:  skipping StringsInfo cause health check failed
    9291:  skipping StringsInfo cause health check failed
    9292:  skipping StringsInfo cause health check failed
    9293:  skipping StringsInfo cause health check failed
    9294:  skipping StringsInfo cause health check failed
    9295:  skipping StringsInfo cause health check failed
    9296:  skipping StringsInfo cause health check failed
    9297:  skipping StringsInfo cause health check failed
    9298:  skipping StringsInfo cause health check failed
    9299:  skipping StringsInfo cause health check failed
    9300:  skipping StringsInfo cause health check failed
    9301:  skipping StringsInfo cause health check failed
    9302:  skipping StringsInfo cause health check failed
    9303:  skipping StringsInfo cause health check failed
    9304:  skipping StringsInfo cause health check failed
    9305:  skipping StringsInfo cause health check failed
    9306:  skipping StringsInfo cause health check failed
    9307:  skipping StringsInfo cause health check failed
    9308:  skipping StringsInfo cause health check failed
    9309:  skipping StringsInfo cause health check failed
    9310:  skipping StringsInfo cause health check failed
    9311:  skipping StringsInfo cause health check failed
    9312:  skipping StringsInfo cause health check failed
    9313:  skipping StringsInfo cause health check failed
    9314:  Testing Analyzer Sublime
    9315:  Testing with config SublimeSecurity
    9316:  Testing Sublime-Standard-Test-String.eml with mimetype message/rfc822 for 30 seconds
    9317:  Testing Analyzer Suricata
    9318:  Testing with config Suricata
    9319:  skipping Suricata cause health check failed
    9320:  Testing Analyzer ThugFile
    9321:  Testing with config Thug_HTML_Info
    9322:  skipping ThugFile cause health check failed
    ...
    
    9980:  test_get_non_existent (tests.api_app.analyzers_manager.test_views.AnalyzerConfigViewSetTestCase.test_get_non_existent) ... ok-dokey (0.015082s)
    9981:  test_get_superuser (tests.api_app.analyzers_manager.test_views.AnalyzerConfigViewSetTestCase.test_get_superuser) ... ok-dokey (0.027139s)
    9982:  test_get_user (tests.api_app.analyzers_manager.test_views.AnalyzerConfigViewSetTestCase.test_get_user) ... ok-dokey (0.027682s)
    9983:  test_health_check (tests.api_app.analyzers_manager.test_views.AnalyzerConfigViewSetTestCase.test_health_check) ... ok-dokey (0.139196s)
    9984:  test_list (tests.api_app.analyzers_manager.test_views.AnalyzerConfigViewSetTestCase.test_list) ... ok-dokey (0.615754s)
    9985:  test_organization_disable (tests.api_app.analyzers_manager.test_views.AnalyzerConfigViewSetTestCase.test_organization_disable) ... ok-dokey (0.183866s)
    9986:  test_organization_enable (tests.api_app.analyzers_manager.test_views.AnalyzerConfigViewSetTestCase.test_organization_enable) ... ok-dokey (0.243401s)
    9987:  test_pull (tests.api_app.analyzers_manager.test_views.AnalyzerConfigViewSetTestCase.test_pull) ... ok-dokey (13.279711s)
    9988:  {'errors': {'detail': 'This Plugin has no Update implemented'}}
    ...
    
    10161:  test_job_rescan__observable_playbook (tests.api_app.test_api.ApiViewTests.test_job_rescan__observable_playbook) ... ok-dokey (7.339663s)
    10162:  test_job_rescan__permission (tests.api_app.test_api.ApiViewTests.test_job_rescan__permission) ... ok-dokey (7.363788s)
    10163:  test_job_rescan__sample_analyzers (tests.api_app.test_api.ApiViewTests.test_job_rescan__sample_analyzers) ... ok-dokey (1.130858s)
    10164:  test_job_rescan__sample_playbook (tests.api_app.test_api.ApiViewTests.test_job_rescan__sample_playbook) ... ok-dokey (11.338124s)
    10165:  test_no_analyzers (tests.api_app.test_api.ApiViewTests.test_no_analyzers) ... ok-dokey (0.133451s)
    10166:  test_tlp_clear_and_white (tests.api_app.test_api.ApiViewTests.test_tlp_clear_and_white) ... ok-dokey (2.142045s)
    10167:  test_abstract (tests.api_app.test_classes.PluginTestCase.test_abstract) ... ok-dokey (0.280130s)
    10168:  test_python_path (tests.api_app.test_classes.PluginTestCase.test_python_path) ... ok-dokey (0.248709s)
    10169:  test_start_errors (tests.api_app.test_classes.PluginTestCase.test_start_errors) ... Traceback (most recent call last):
    10170:  File "/opt/deploy/threat_matrix/api_app/classes.py", line 297, in start
    10171:  _result = self.run()
    10172:  ^^^^^^^^^^
    10173:  File "/opt/deploy/threat_matrix/tests/api_app/test_classes.py", line 57, in raise_error
    10174:  raise TypeError("Test")
    10175:  TypeError: Test
    10176:  ok-dokey (0.361593s)
    10177:  test_start_no_errors (tests.api_app.test_classes.PluginTestCase.test_start_no_errors) ... ok-dokey (0.339063s)
    ...
    
    10281:  test_get (tests.api_app.test_views.PluginConfigViewSetTestCase.test_get) ... ok-dokey (36.344762s)
    10282:  test_list (tests.api_app.test_views.PluginConfigViewSetTestCase.test_list) ... ok-dokey (35.365542s)
    10283:  test_create_201 (tests.api_app.test_views.TagViewsetTests.test_create_201) ... ok-dokey (0.024126s)
    10284:  test_create_400 (tests.api_app.test_views.TagViewsetTests.test_create_400) ... ok-dokey (0.017848s)
    10285:  test_delete_204 (tests.api_app.test_views.TagViewsetTests.test_delete_204) ... ok-dokey (0.032603s)
    10286:  test_list_200 (tests.api_app.test_views.TagViewsetTests.test_list_200) ... ok-dokey (0.015198s)
    10287:  test_retrieve_200 (tests.api_app.test_views.TagViewsetTests.test_retrieve_200) ... ok-dokey (0.016839s)
    10288:  test_update_200 (tests.api_app.test_views.TagViewsetTests.test_update_200) ... ok-dokey (0.026386s)
    10289:  test_with_error (tests.api_app.visualizers_manager.test_classes.ErrorHandlerTestCase.test_with_error) ... ok-dokey (0.000289s)
    10290:  test_without_error (tests.api_app.visualizers_manager.test_classes.ErrorHandlerTestCase.test_without_error) ... ok-dokey (0.000185s)
    ...
    
    10379:  test_initial (tests.threat_matrix.test_tasks.SendElasticTestCase.test_initial) ... ok-dokey (0.233608s)
    10380:  test_update (tests.threat_matrix.test_tasks.SendElasticTestCase.test_update) ... ok-dokey (0.193479s)
    10381:  test_job_killed (tests.api_app.test_websocket.JobConsumerTestCase.test_job_killed) ... ok-dokey (4.515683s)
    10382:  test_job_not_exist (tests.api_app.test_websocket.JobConsumerTestCase.test_job_not_exist) ... ok-dokey (0.034195s)
    10383:  test_job_running (tests.api_app.test_websocket.JobConsumerTestCase.test_job_running) ... ok-dokey (6.685297s)
    10384:  test_job_terminated (tests.api_app.test_websocket.JobConsumerTestCase.test_job_terminated) ... ok-dokey (0.188280s)
    10385:  test_job_unauthorized (tests.api_app.test_websocket.JobConsumerTestCase.test_job_unauthorized) ... ok-dokey (0.026728s)
    10386:  ======================================================================
    10387:  ERROR: test_min_password_lenght_400 (tests.auth.test_auth.TestUserAuth.test_min_password_lenght_400)
    10388:  ----------------------------------------------------------------------
    10389:  Traceback (most recent call last):
    10390:  File "/opt/deploy/threat_matrix/tests/auth/test_auth.py", line 275, in test_min_password_lenght_400
    10391:  content["errors"]["password"],
    10392:  ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
    10393:  KeyError: 'password'
    10394:  ----------------------------------------------------------------------
    10395:  Ran 391 tests in 528.561s
    10396:  FAILED (errors=1, skipped=3)
    10397:  Preserving test database for alias 'default'...
    10398:  ##[error]Process completed with exit code 1.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    Copy link

    @sourcery-ai sourcery-ai bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Hey @gitworkflows - I've reviewed your changes and they look great!

    Here's what I looked at during the review
    • 🟡 General issues: 1 issue found
    • 🟡 Security: 1 issue found
    • 🟡 Testing: 1 issue found
    • 🟡 Complexity: 1 issue found
    • 🟢 Documentation: all looks good

    Sourcery is free for open source - if you like our reviews please consider sharing them ✨
    Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

    class IETFReportSerializer(FlexFieldsModelSerializer):
    class Meta:
    model = IETFReport
    fields = "__all__"
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    🚨 issue (security): Explicitly specify serializer fields instead of using all to prevent exposing sensitive data

    Using all could accidentally expose sensitive fields. List specific fields that should be exposed in the API.

    def perform_request_to_form(self, form) -> Response:
    params, dest_url = self.compile_form_field(form)
    logger.info(f"Job #{self.job_id}: Sending {params=} to submit url {dest_url}")
    return requests.post(
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    issue: Add error handling for form submission timeouts and connection errors

    The form submission should handle timeouts and connection errors gracefully with appropriate error messages.

    Comment on lines +37 to +38
    result = ser.data
    print(result)
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    issue (testing): Test case prints result without assertions

    The test prints the serialized result but doesn't make any assertions about its content. Add assertions to verify the expected structure and values in the serialized output.

    return f"{self.provider}: {json.dumps(self.signature)}"


    class BaseDataModel(models.Model):
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    issue (complexity): Consider extracting analyzer-specific data from BaseDataModel into a separate AnalyzerResult model

    The BaseDataModel class is handling too many responsibilities by storing analyzer-specific data directly. This makes the model harder to maintain and understand. Consider extracting analyzer-specific data into dedicated models:

    class AnalyzerResult(models.Model):
        data_model = models.ForeignKey(BaseDataModel, on_delete=models.CASCADE)
        analyzer_name = models.CharField(max_length=100)
        evaluation = models.CharField(max_length=100, null=True)
        external_references = SetField(models.URLField(), blank=True)
        specific_data = models.JSONField()
    
        class Meta:
            unique_together = ['data_model', 'analyzer_name']
    
    class BaseDataModel(models.Model):
        # Core fields that apply to all types
        tags = SetField(LowercaseCharField(max_length=100), blank=True)
        malware_family = LowercaseCharField(max_length=100, null=True)
        date = models.DateTimeField(default=now)
    
        # Move analyzer-specific data to AnalyzerResult
        @property 
        def get_analyzer_result(self, analyzer_name):
            return self.analyzerresult_set.get(analyzer_name=analyzer_name)

    This approach:

    1. Separates generic and analyzer-specific concerns
    2. Makes it easier to add new analyzers without modifying BaseDataModel
    3. Provides better type safety than generic JSON fields
    4. Maintains backwards compatibility through properties

    jobFileSubTypesPerDay?.aggregation,
    componentsFn: (respData) => {
    const { values: mimetypeList } = respData;
    if (!mimetypeList || !mimetypeList?.length) return null;
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

    Suggested change
    if (!mimetypeList || !mimetypeList?.length) return null;
    if (!mimetypeList || !mimetypeList?.length) {


    ExplanationIt is recommended to always use braces and create explicit statement blocks.

    Using the allowed syntax to just write a single statement can lead to very confusing
    situations, especially where subsequently a developer might add another statement
    while forgetting to add the braces (meaning that this wouldn't be included in the condition).


    def run(self) -> dict:
    result: {} = {}
    if not (
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    issue (code-quality): We've found these issues:

    Comment on lines +464 to +466
    signatures = data_model.signatures.count()

    if signatures:
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    suggestion (code-quality): Use named expression to simplify assignment and conditional (use-named-expression)

    Suggested change
    signatures = data_model.signatures.count()
    if signatures:
    if signatures := data_model.signatures.count():

    Comment on lines +69 to +72
    if (
    job.observable_classification == ObservableTypes.DOMAIN.value
    or job.observable_classification == ObservableTypes.URL.value
    ):
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    suggestion (code-quality): Replace multiple comparisons of same variable with in operator (merge-comparisons)

    Suggested change
    if (
    job.observable_classification == ObservableTypes.DOMAIN.value
    or job.observable_classification == ObservableTypes.URL.value
    ):
    if job.observable_classification in [
    ObservableTypes.DOMAIN.value,
    ObservableTypes.URL.value,
    ]:

    return self.get_data_model_class(self.job)

    def _validation_before_data_model(self) -> bool:
    if not self.status == self.STATUSES.SUCCESS.value:
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    suggestion (code-quality): Simplify logical expression using De Morgan identities (de-morgan)

    Suggested change
    if not self.status == self.STATUSES.SUCCESS.value:
    if self.status != self.STATUSES.SUCCESS.value:

    Comment on lines +236 to +237
    org = self.report.report.get("autonomous_system_organization", None)
    if org:
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    suggestion (code-quality): Use named expression to simplify assignment and conditional (use-named-expression)

    Suggested change
    org = self.report.report.get("autonomous_system_organization", None)
    if org:
    if org := self.report.report.get("autonomous_system_organization", None):

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 PR contains tests
    🔒 Security concerns

    Sensitive information exposure:
    The phishing form compiler (phishing_form_compiler.py) sends fake but potentially sensitive data like credit card numbers and passwords to untrusted URLs. While the data is fake, this could still pose risks if intercepted. Consider adding additional safeguards and warnings.

    ⚡ Recommended focus areas for review

    Security Concern
    The plugin_report_queries endpoint allows searching analyzer reports without proper access control validation. Need to verify that users can only access reports they have permission to view.

    Possible Bug
    The phishing form compiler sends fake form data to potentially malicious URLs without proper error handling or rate limiting. This could lead to unintended behavior or abuse.

    Test Coverage
    The test_elastic_request test mocks the search functionality but doesn't validate the actual query construction or results filtering. Additional test cases needed.

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Fix undefined variable reference in test method to prevent test failures

    The test_kill() method references an undefined job variable in the assertion. The
    job variable should be defined before being used in the test.

    tests/api_app/test_views.py [524-525]

    +job = Job.objects.create(
    +    status=Job.STATUSES.RUNNING,
    +    user=self.superuser,
    +    observable_classification="ip",
    +)
     uri = reverse("jobs-kill", args=[job.pk])
     response = self.client.patch(uri)
    • Apply this suggestion
    Suggestion importance[1-10]: 10

    Why: The suggestion fixes a critical bug where the test method uses an undefined 'job' variable, which would cause the test to fail with a NameError. The fix properly creates the job object before using it.

    10
    Add proper error handling for invalid keys, indices and empty values in dictionary/list traversal

    The get_value() method is missing error handling for key errors and empty values.
    Add validation to handle cases where keys don't exist in the dictionary or when
    empty values are encountered.

    api_app/models.py [1422-1439]

     def get_value(
         self, search_from: typing.Any, fields: typing.List[str]
     ) -> typing.Any:
         if not fields:
             return search_from
    +    if not search_from:
    +        raise ValueError("Empty value")
         search_keyword = fields.pop(0)
         if isinstance(search_from, list):
             try:
                 index = int(search_keyword)
             except ValueError:
                 result = []
                 for obj in search_from:
                     result.append(self.get_value(obj, [search_keyword] + fields))
                 return result
             else:
    -            # a.b.0
    +            if index >= len(search_from):
    +                raise IndexError(f"Index {index} out of range")
                 return self.get_value(search_from[index], fields)
    +    if not isinstance(search_from, dict):
    +        raise TypeError(f"Cannot get key {search_keyword} from {type(search_from)}")
    +    if search_keyword not in search_from:
    +        raise KeyError(f"Key {search_keyword} not found")
         return self.get_value(search_from[search_keyword], fields)
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The suggestion adds critical error handling for empty values, invalid keys, and out-of-range indices that could cause runtime errors. This improves robustness and provides clearer error messages.

    8
    Add error handling for Elasticsearch query execution to improve reliability

    Add error handling for Elasticsearch execution to catch potential connection or
    query execution errors.

    api_app/views.py [1673-1677]

    -hits = (
    -    Search(index="plugin-report-*")
    -    .query(QElastic("bool", filter=filter_list))
    -    .execute()
    -)
    +try:
    +    hits = (
    +        Search(index="plugin-report-*")
    +        .query(QElastic("bool", filter=filter_list))
    +        .execute()
    +    )
    +except Exception as e:
    +    logger.error(f"Elasticsearch query failed: {str(e)}")
    +    raise
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Adding error handling for Elasticsearch operations is important for production reliability, as network or cluster issues could cause query failures. The suggestion properly logs errors while preserving the original exception.

    7
    Handle empty filter list case in Elasticsearch query to prevent potential query errors

    The Elasticsearch query should handle empty filter_list case to avoid potential
    query errors. Add a check before executing the query.

    api_app/views.py [1673-1677]

     hits = (
         Search(index="plugin-report-*")
    -    .query(QElastic("bool", filter=filter_list))
    +    .query(QElastic("bool", filter=filter_list if filter_list else []))
         .execute()
     )
    • Apply this suggestion
    Suggestion importance[1-10]: 4

    Why: While the filter_list will never be empty due to the permission_filter being added by default, adding an explicit check for empty filter_list improves code robustness and readability.

    4

    💡 Need additional feedback ? start a PR chat

    @gitworkflows
    Copy link
    Contributor Author

    gitworkflows commented Dec 10, 2024

    🎉 Snyk checks have passed. No issues have been found so far.

    security/snyk check is complete. No issues have been found. (View Details)

    upper_case=True,
    lower_case=True,
    )
    logger.info(f"Generated fake password input {self.FAKE_PASSWORD_INPUT}")

    Check failure

    Code scanning / CodeQL

    Clear-text logging of sensitive information High

    This expression logs
    sensitive data (password)
    as clear text.

    Copilot Autofix AI 2 months ago

    To fix the problem, we should avoid logging sensitive information such as passwords, email addresses, and phone numbers. Instead, we can log a generic message indicating that the fake data has been generated without including the actual values. This way, we maintain the functionality of the code without exposing sensitive information.

    • Replace the logging statements that include sensitive information with generic messages.
    • Specifically, update lines 84-97 to remove the sensitive data from the log messages.
    Suggested changeset 1
    api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py

    Autofix patch

    Autofix patch
    Run the following command in your local git repository to apply this patch
    cat << 'EOF' | git apply
    diff --git a/api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py b/api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py
    --- a/api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py
    +++ b/api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py
    @@ -82,7 +82,5 @@
             }
    -        logger.info(
    -            f"Generated name text input mapping {self._name_text_input_mapping}"
    -        )
    +        logger.info("Generated name text input mapping.")
             self.FAKE_EMAIL_INPUT: str = fake.email()
    -        logger.info(f"Generated fake email input {self.FAKE_EMAIL_INPUT}")
    +        logger.info("Generated fake email input.")
             self.FAKE_PASSWORD_INPUT: str = fake.password(
    @@ -94,5 +92,5 @@
             )
    -        logger.info(f"Generated fake password input {self.FAKE_PASSWORD_INPUT}")
    +        logger.info("Generated fake password input.")
             self.FAKE_TEL_INPUT: str = fake.phone_number()
    -        logger.info(f"Generated fake tel input {self.FAKE_TEL_INPUT}")
    +        logger.info("Generated fake tel input.")
     
    EOF
    @@ -82,7 +82,5 @@
    }
    logger.info(
    f"Generated name text input mapping {self._name_text_input_mapping}"
    )
    logger.info("Generated name text input mapping.")
    self.FAKE_EMAIL_INPUT: str = fake.email()
    logger.info(f"Generated fake email input {self.FAKE_EMAIL_INPUT}")
    logger.info("Generated fake email input.")
    self.FAKE_PASSWORD_INPUT: str = fake.password(
    @@ -94,5 +92,5 @@
    )
    logger.info(f"Generated fake password input {self.FAKE_PASSWORD_INPUT}")
    logger.info("Generated fake password input.")
    self.FAKE_TEL_INPUT: str = fake.phone_number()
    logger.info(f"Generated fake tel input {self.FAKE_TEL_INPUT}")
    logger.info("Generated fake tel input.")

    Copilot is powered by AI and may make mistakes. Always verify output.
    Positive Feedback
    Negative Feedback

    Provide additional feedback

    Please help us improve GitHub Copilot by sharing more details about this comment.

    Please select one or more of the options
    )

    logger.info(
    f"Job #{self.job_id}: Sending value {value_to_set} for {input_name=}"

    Check failure

    Code scanning / CodeQL

    Clear-text logging of sensitive information High

    This expression logs
    sensitive data (password)
    as clear text.

    Copilot Autofix AI 2 months ago

    To fix the problem, we need to ensure that sensitive information is not logged. This can be achieved by either removing the logging statements that include sensitive data or by sanitizing the data before logging it. In this case, we will sanitize the data by replacing sensitive values with a placeholder text like "[REDACTED]".

    We will modify the logging statements on lines 150, 164, 168, and 176 to ensure that sensitive information is not logged. Specifically, we will replace the actual values of sensitive data with "[REDACTED]".

    Suggested changeset 1
    api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py

    Autofix patch

    Autofix patch
    Run the following command in your local git repository to apply this patch
    cat << 'EOF' | git apply
    diff --git a/api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py b/api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py
    --- a/api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py
    +++ b/api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py
    @@ -150,3 +150,3 @@
                         logger.info(
    -                        f"Job #{self.job_id}: Found hidden input tag with {input_name=} and {input_value=}"
    +                        f"Job #{self.job_id}: Found hidden input tag with {input_name=} and input_value=[REDACTED]"
                         )
    @@ -168,3 +168,3 @@
                 logger.info(
    -                f"Job #{self.job_id}: Sending value {value_to_set} for {input_name=}"
    +                f"Job #{self.job_id}: Sending value [REDACTED] for {input_name=}"
                 )
    @@ -175,3 +175,3 @@
             params, dest_url = self.compile_form_field(form)
    -        logger.info(f"Job #{self.job_id}: Sending {params=} to submit url {dest_url}")
    +        logger.info(f"Job #{self.job_id}: Sending params=[REDACTED] to submit url {dest_url}")
             return requests.post(
    EOF
    @@ -150,3 +150,3 @@
    logger.info(
    f"Job #{self.job_id}: Found hidden input tag with {input_name=} and {input_value=}"
    f"Job #{self.job_id}: Found hidden input tag with {input_name=} and input_value=[REDACTED]"
    )
    @@ -168,3 +168,3 @@
    logger.info(
    f"Job #{self.job_id}: Sending value {value_to_set} for {input_name=}"
    f"Job #{self.job_id}: Sending value [REDACTED] for {input_name=}"
    )
    @@ -175,3 +175,3 @@
    params, dest_url = self.compile_form_field(form)
    logger.info(f"Job #{self.job_id}: Sending {params=} to submit url {dest_url}")
    logger.info(f"Job #{self.job_id}: Sending params=[REDACTED] to submit url {dest_url}")
    return requests.post(
    Copilot is powered by AI and may make mistakes. Always verify output.
    Positive Feedback
    Negative Feedback

    Provide additional feedback

    Please help us improve GitHub Copilot by sharing more details about this comment.

    Please select one or more of the options
    Signed-off-by: gitworkflows <118260833+gitworkflows@users.noreply.github.com>
    Copy link

    gitguardian bot commented Dec 10, 2024

    ⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

    Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

    🔎 Detected hardcoded secret in your pull request
    GitGuardian id GitGuardian status Secret Commit Filename
    13180230 Triggered Username Password 983802d tests/auth/test_auth.py View secret
    🛠 Guidelines to remediate hardcoded secrets
    1. Understand the implications of revoking this secret by investigating where it is used in your code.
    2. Replace and store your secret safely. Learn here the best practices.
    3. Revoke and rotate this secret.
    4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

    To avoid such incidents in the future consider


    🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

    @gitworkflows gitworkflows merged commit 66983d2 into develop Dec 10, 2024
    8 of 13 checks passed
    @gitworkflows gitworkflows deleted the fixed/dashboard branch December 10, 2024 06:17
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant