What is the difference between checking for dependency vulnerabilities by submission hash and by package version?
Check dependency vulnerabilities by commit hash and by package version, the difference between the two is not in speed, but in coverage. The version scope can only hit defects that have been officially released and written into the announcement interval; the hash scope can trace to specific commits, including self-maintained branches, private repositories, and rolled-back fixes that have not been officially released. The public vulnerability data service itself provides both types of query entry, indicating that they are designed to complement each other rather than as an either/or choice.
What does the version scope hit?
The input of the version diameter is 'import path plus version number', the query result depends on the announcement to write the affected range as a comparable version interval. Its advantage is strong determination: lock the version recorded in the file and judge according to the version, no additional information needs to be constructed.
It has three blind spots:
- Used an upstream submission that has not been published, the version number is still the previous formal release version, and the judgment will fall into the old interval.
- Fixed the defect by patching it yourself, but the version diameter still hits the target, forming a false positive.
- Private branches or internally replicated modules do not have a version lineage, and they can't be found at all.
Which segment is the hash diameter patching?
The input of hash diameter is a build identifier actually used, the judgment basis is the position of 'the submission introducing the defect' and 'the submission fixing it' in history. Therefore, it can answer questions that version diameter cannot: whether that code is actually in this binary.
The cost is that the build process must be traceable. Taking the GoLang ecosystem as an example, when building, the actual version of each dependent module and the corresponding submission identifier should be recorded together; once this information is not present in the product, the hash diameter cannot be traced, and can only fall back to version diameter.
| Dimension | Search by package version | Search by submission hash |
|---|---|---|
| Enter | Module path and version number | Build the actual commit identifier used |
| Can overwrite an unpublished commit | No | Is |
| After patching it yourself | Easy to false report | Can be determined to contain no defective code |
| Build information that needs to be retained | Lock the file | Lock the file with build metadata |
| Appropriate timing | Routine scanning | Incident investigation and pre-deployment confirmation |
How to coordinate the two in practice
First, conduct routine scanning according to the version criteria, which is cost-effective and can be done in batches; if a match is found, review it again according to the hash criteria, distinguishing between 'there is a problem with the version' and 'the code is really inside'. Only after completing these two steps can the scheduling basis stand firm.
The framework layer should also be included on the list. For projects like content management systems, in addition to the runtime language, there are also framework components responsible for data mapping, which are also indirect dependencies. They can only be found in the business module and may miss this layer when checking versions.
Records to be supplemented for containerized deployment
If the deployment method is a container image, the most likely to break during the query is 'which build does the running image on the line correspond to.' The image identifier, build time, and dependency list should be written into the same release record, so that during an accident, you don't have to rebuild the corresponding relationship by flipping through the logs. For sites deployed using panel or image methods, default running parameters such as listening ports should also be included in this record, to avoid having to repeatedly confirm the environment during troubleshooting.
Common questions
Can only one口径 be used?Yes, but you have to accept its blind spots. When only the version口径 is used, any scenario where patches are applied自行 or submissions are not published cannot prove their innocence.
Will the hash diameter miss announcements that only express versions?Yes. Some announcements only provide version ranges without corresponding submission information. Such entries still need to be judged by version diameter.
How long should metadata be retained during construction?It should at least cover the current online version and the range of historical versions that can be rolled back. Each rollback should allow for a search.