Yelp / detect-secrets

An enterprise friendly way of detecting and preventing secrets in code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is_verified remains false even with result return with --only-verified flag

eyalatox opened this issue · comments

Hello,

I've written the below simple plugin as a PoC, deliberately ensuring it is always verified to be true.
Yet, it never gets the is_verified field to be true.
Interestingly it does return when using the --only-verified flag.
Is that a bug, or am I missing something here?

import re

from detect_secrets.constants import VerifiedResult
from detect_secrets.util.code_snippet import CodeSnippet
from detect_secrets.plugins.base import RegexBasedDetector


class ADetector(RegexBasedDetector):
    secret_type = '5A token'

    denylist = [
        re.compile(r'A{5,}'),
    ]

    def verify(self, secret: str, context: CodeSnippet) -> VerifiedResult:
        return VerifiedResult.VERIFIED_TRUE 

It seems like a major regression, is_verified is not set in any place in the code anymore. (wasn't the case in 1.10). What happened??

Hi @eran-medan, sorry for the late update. We should have fixed this in #578, would you mind updating to v1.3.0 and re-testing this?

Hello. I have re-tested this with your custom plugin above. This is fixed. I will consider this resolved. If you have any other questions or you do not consider this resolved - please re-open an issue and the team will be happy to assist. Thanks!