Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit 4629570

Browse files
committed
Add method for checking version from changelogs
1 parent 2ff80d0 commit 4629570

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/wpxf/wordpress/fingerprint.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ def check_plugin_version_from_readme(name, fixed = nil, introduced = nil)
5454
check_version_from_readme(:plugin, name, fixed, introduced)
5555
end
5656

57+
# Checks a plugin's changelog for a vulnerable version.
58+
# @param plugin_name [String] the name of the plugin.
59+
# @param file_name [String] the name of the file that contains the changelog.
60+
# @param fixed [String] the version the vulnerability was fixed in.
61+
# @param introduced [String] the version the vulnerability was introduced in.
62+
# @return [Symbol] :unknown, :vulnerable or :safe.
63+
def check_plugin_version_from_changelog(plugin_name, file_name, fixed = nil, introduced = nil)
64+
changelog = normalize_uri(wordpress_url_plugins, plugin_name, file_name)
65+
check_version_from_custom_file(changelog, /=\s(\d\.\d(\.\d)?)\s=/, fixed, introduced)
66+
end
67+
5768
# Checks a custom file for a vulnerable version.
5869
# @param url [String] the relative path of the file.
5970
# @param regex [Regexp] the regular expression to extract the version.

0 commit comments

Comments
 (0)