Scalable Code Matching via Snippet Signatures and Bloom Filters

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The rapid growth of software repositories on public cloud sites like GitHub poses challenges in ensuring license and copyright compliance, detecting security vulnerabilities, and identifying cut-and-pasted code due to the massive scale of files and source code, which existing technologies struggle to address effectively.

Innovation Solution

A method using scalable knowledge bases to match files and file snippets by generating whole file signatures and signature vectors, searching across multiple data stores, and providing reports on matches, including bug fix code, to ensure compliance and detect vulnerabilities.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If traditional content matching methods are used on massive software repositories, then complete search coverage can be achieved, but the search time and computational resources required become prohibitively large

Engineering Contradiction:
Improvecontent matching accuracyVSAvoidsearch time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent divides large files into smaller snippets (e.g., 50-line segments) and creates signatures for each snippet. This segmentation allows the system to search through manageable units rather than entire files, dramatically reducing search time while maintaining matching accuracy through comprehensive snippet coverage.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system pre-computes signatures (hash values) for all file snippets during an indexing phase before actual search operations. This preliminary action stores signatures in data structures like Bloom filters, enabling rapid lookup during search without recomputing hashes, thus reducing search time while preserving matching precision.

Inventive Principle:
Principle #10Preliminary action

2Reliability

If the entire knowledge base is searched to ensure complete match detection, then all potential matches are found, but the computational complexity and resource consumption increase significantly

Engineering Contradiction:
Improvematch detection completenessVSAvoidsystem complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent introduces intermediate data structures (Bloom filters, signature indexes) that mediate between the full knowledge base and the search query. These intermediaries pre-organize signature data to enable efficient filtering and matching, reducing system complexity during search operations while maintaining complete match detection through thorough index coverage.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Productivity

If signature-based matching is used to speed up search, then search efficiency improves, but false positives may occur reducing matching precision

Engineering Contradiction:
Improvesearch efficiencyVSAvoidmatch accuracy
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The system employs multi-stage verification where initial signature matches trigger secondary validation checks. Bloom filter positives are followed by actual content comparison, and snippet matches are verified against full file context. This feedback mechanism filters false positives while maintaining high search efficiency through the initial fast signature filtering.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS20240370573A1Content matching and vulnerability remediation
Publication Date: 2024.11.07 FENG HAIHUA
  • US20240370573A1 patent drawing
  • US20240370573A1 patent drawing
  • US20240370573A1 patent drawing

AI summary

An example method matches content, such as files and file snippets, using one or more scalable knowledge bases. The example method includes the following operations: receiving input content through a user interface; generating a whole file signature representing an entirety of the input content, where the whole file signature is based on a hash of the input content; searching a first knowledge base for a file having a whole file signature that matches the generated whole file signature; processing the input content to identify a snippet of content in a second knowledge base based on signature vector corresponding to the input content; generating a report based on at least one of the file or the snippet of content; and displaying the report on a user interface