Пример #1
0
    def signature(self) -> str:
        """Generate a stable hash-based signature uniquely identifying this issue.

        :rtype: str
        """
        return util.generate_signature(self.matched_string,
                                       self.chunk.file_path)
Пример #2
0
    def signature_is_excluded(self, blob: str, file_path: str) -> bool:
        """Find whether the signature of some data has been excluded in configuration.

        :param blob: The piece of data which is being scanned
        :param file_path: The path and file name for the data being scanned
        """
        return (util.generate_signature(blob, file_path)
                in self.global_options.exclude_signatures)
Пример #3
0
    def signature_is_excluded(self, blob: str, file_path: str) -> bool:
        """Find whether the signature of some data has been excluded in configuration.

        :param blob: The piece of data which is being scanned
        :param file_path: The path and file name for the data being scanned
        """
        return (
            blob in self.
            excluded_signatures  # Signatures themselves pop up as entropy matches
            or util.generate_signature(blob,
                                       file_path) in self.excluded_signatures)
Пример #4
0
 def test_signature_is_generated_with_snippet_and_filename(self, mock_hash):
     util.generate_signature("foo", "bar")
     mock_hash.assert_called_once_with(b"foo$$bar")