Add fix for oembed API
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -13,11 +13,19 @@ describe WPScan::Finders::Users::OembedApi do
|
||||
end
|
||||
|
||||
context 'when not a JSON response' do
|
||||
context 'when empty' do
|
||||
let(:body) { '' }
|
||||
|
||||
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
|
||||
let(:body) { File.read(fixture) }
|
||||
|
||||
|
||||
@@ -20,16 +20,18 @@ describe WPScan::Finders::Users::WpJsonApi do
|
||||
end
|
||||
|
||||
context 'when not a JSON response' do
|
||||
context 'when empty' do
|
||||
let(:body) { '' }
|
||||
|
||||
its(:aggressive) { should eql([]) }
|
||||
end
|
||||
|
||||
context 'when a string response' do
|
||||
context 'when a string' do
|
||||
let(:body) { '404' }
|
||||
|
||||
its(:aggressive) { should eql([]) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a JSON response' do
|
||||
context 'when unauthorised' do
|
||||
|
||||
Reference in New Issue
Block a user