def ready(self):
        from .models import UserRating
        from .signals import calculate_ratings

        post_save.connect(calculate_ratings, sender=UserRating)
        post_delete.connect(calculate_ratings, sender=UserRating)

        # Add System checks
        from .checks import rerate_check  # NOQA
        from django.core.checks import Tags, register as register_check

        register_check(rerate_check, Tags.compatibility)
Exemple #2
0
def register():
    register_check(actions_have_consistent_hashes)
    # Temporarily disabled, see Issue #900.
    # register_check(recipe_signatures_are_correct)
    # register_check(action_signatures_are_correct)
    register_check(signatures_use_good_certificates)
    register_check(geoip_db_is_available)
Exemple #3
0
    def ready(self):
        # we need to initializer waston here because in models.py is to early if we want add extra fields to index
        # print('ready(): initializing watson')
        # commented out ^ as it prints in manage.py dumpdata, docker logs and many other places
        # logger doesn't work yet at this stage

        # Watson doesn't have a way to let it index extra fields, so we have to explicitly list all the fields
        # to make it easier, we get the charfields/textfields from the model and then add our extra fields.
        # charfields/textfields are the fields that watson indexes by default (but we have to repeat here if we add extra fields)
        # and watson likes to have tuples instead of lists

        watson.register(self.get_model('Product'),
                        fields=get_model_fields_with_extra(
                            self.get_model('Product'), (
                                'id',
                                'prod_type__name',
                            )),
                        store=('prod_type__name', ))

        watson.register(
            self.get_model('Test'),
            fields=get_model_fields_with_extra(self.get_model('Test'), (
                'id',
                'engagement__product__name',
            )),
            store=('engagement__product__name', ))  # test_type__name?

        watson.register(self.get_model('Finding'),
                        fields=get_model_fields_with_extra(
                            self.get_model('Finding'), (
                                'id',
                                'url',
                                'unique_id_from_tool',
                                'test__engagement__product__name',
                                'jira_issue__jira_key',
                            )),
                        store=('cve', 'status', 'jira_issue__jira_key',
                               'test__engagement__product__name', 'severity',
                               'severity_display', 'latest_note'))

        # some thoughts on Finding fields that are not indexed yet:
        # CWE can't be indexed as it is an integer

        # would endpoints be good to index? or would it clutter search results?
        # endpoints = models.ManyToManyField(Endpoint, blank=True)
        # endpoint_status = models.ManyToManyField(Endpoint_Status, blank=True, related_name='finding_endpoint_status')

        # index test name/title?
        # test = models.ForeignKey(Test, editable=False, on_delete=models.CASCADE)

        # index reporter name?
        # reporter = models.ForeignKey(User, editable=False, default=1, related_name='reporter', on_delete=models.CASCADE)
        # index notes?
        # notes = models.ManyToManyField(Notes, blank=True, editable=False)

        # index found_by?
        # found_by = models.ManyToManyField(Test_Type, editable=False)

        # exclude these to avoid cluttering?
        # sast_source_object = models.CharField(null=True, blank=True, max_length=500, help_text="Source object (variable, function...) of the attack vector")
        # sast_sink_object = models.CharField(null=True, blank=True, max_length=500, help_text="Sink object (variable, function...) of the attack vector")
        # sast_source_line = models.IntegerField(null=True, blank=True,
        #                            verbose_name="Line number",
        #                            help_text="Source line number of the attack vector")
        # sast_source_file_path = models.CharField(null=True, blank=True, max_length=4000, help_text="Source filepath of the attack vector")

        watson.register(self.get_model('Finding_Template'))
        watson.register(self.get_model('Endpoint'),
                        store=('product__name', ))  # add product name also?
        watson.register(self.get_model('Engagement'),
                        fields=get_model_fields_with_extra(
                            self.get_model('Engagement'), (
                                'id',
                                'product__name',
                            )),
                        store=('product__name', ))
        watson.register(self.get_model('App_Analysis'))

        # YourModel = self.get_model("YourModel")
        # watson.register(YourModel)

        register_check(check_configuration_deduplication, 'dojo')
Exemple #4
0
def register():
    register_check(actions_have_consistent_hashes)
    register_check(recipe_signatures_are_correct)
    register_check(action_signatures_are_correct)
    register_check(signatures_use_good_certificates)
    register_check(geoip_db_is_available)
Exemple #5
0
def register():
    register_check(setting_cdn_url)
    register_check(setting_app_server_url)
    register_check(setting_oidc_remote_auth_header)
    register_check(setting_oidc_logout_url)
Exemple #6
0
def register():
    register_check(database_connected)
    register_check(migrations_applied)
    register_check(redis_connected)
Exemple #7
0
def register():
    register_check(setting_cdn_url_has_trailing_slash)
Exemple #8
0
def register():
    register_check(actions_have_consistent_hashes)
    register_check(recipe_signatures_are_correct)
Exemple #9
0
def register():
    register_check(actions_have_consistent_hashes)
    register_check(recipe_signatures_are_correct)
    register_check(recipe_signatures_use_good_certificates)
Exemple #10
0
def register():
    register_check(actions_have_consistent_hashes)
Exemple #11
0
def register():
    register_check(actions_have_consistent_hashes)
    register_check(recipe_signatures_are_correct)
    register_check(action_signatures_are_correct)
    register_check(signatures_use_good_certificates)
    register_check(geoip_db_is_available)
Exemple #12
0
def register():
    register_check(actions_have_consistent_hashes)
    register_check(recipe_signatures_are_correct)
Exemple #13
0
def register():
    register_check(database_connected)
    register_check(migrations_applied)
Exemple #14
0
def register():
    register_check(setting_cdn_url_has_trailing_slash)
Exemple #15
0
def register():
    register_check(setting_cdn_url)
    register_check(setting_app_server_url)
    register_check(setting_oidc_remote_auth_header)
    register_check(setting_oidc_logout_url)
Exemple #16
0
def register():
    register_check(actions_have_consistent_hashes)