Add fix for oembed API

This commit is contained in:
Alex Sanford
2023-11-30 16:58:26 -04:00
parent 804bdfc146
commit c7d49556f1
4 changed files with 21 additions and 9 deletions

View File

@@ -36,6 +36,8 @@ module WPScan
oembed_data = oembed_data.first if oembed_data.is_a?(Array)
oembed_data = {} unless oembed_data.is_a?(Hash)
if oembed_data['author_url'] =~ %r{/author/([^/]+)/?\z}
details = [Regexp.last_match[1], 'Author URL', 90]
elsif oembed_data['author_name'] && !oembed_data['author_name'].empty?

View File

@@ -44,7 +44,7 @@ module WPScan
json = JSON.parse(response.body)
if json.is_a? Enumerable
if json.is_a?(Enumerable)
json.each do |user|
found << Model::User.new(user['slug'],
id: user['id'],

View File

@@ -13,9 +13,17 @@ describe WPScan::Finders::Users::OembedApi do
end
context 'when not a JSON response' do
let(:body) { '' }
context 'when empty' do
let(:body) { '' }
its(:aggressive) { should eql([]) }
its(:aggressive) { should eql([]) }
end
context 'when a string' do
let(:body) { '404' }
its(:aggressive) { should eql([]) }
end
end
context 'when a JSON response' do

View File

@@ -20,15 +20,17 @@ describe WPScan::Finders::Users::WpJsonApi do
end
context 'when not a JSON response' do
let(:body) { '' }
context 'when empty' do
let(:body) { '' }
its(:aggressive) { should eql([]) }
end
its(:aggressive) { should eql([]) }
end
context 'when a string response' do
let(:body) { '404' }
context 'when a string' do
let(:body) { '404' }
its(:aggressive) { should eql([]) }
its(:aggressive) { should eql([]) }
end
end
context 'when a JSON response' do