Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Security Checks #12

Merged
merged 3 commits into from
Mar 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion security/author_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
before :each do
@conf = read_config
@aem_author = init_author_client(@conf['aem']['author'])
init_web_client(@conf['aem']['author'])
end

it 'should not be able to login using default admin password' do
it 'should not be able to make api calls using default credentials' do
# use aem api calls
aem = @aem_author.aem
begin
Expand All @@ -18,4 +19,13 @@
# no result due to error raised
expect(result).to eq(nil)
end

it 'should not be able to login using default admin password' do
visit '/libs/granite/core/content/login.html'
fill_in('username', with: 'admin')
fill_in('password', with: 'admin')
click_button('submit-button')
error = find('#error').text
expect(error).to eq('User name and password do not match')
end
end
2 changes: 1 addition & 1 deletion security/publish_dispatcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'Publish-Dispatcher', type: :feature do
before :each do
@conf = read_config
init_dispatcher_client(@conf['aem']['dispatcher'])
init_web_client(@conf['aem']['dispatcher'])
end

it 'should set up DoS prevention by making /.json inaccessible' do
Expand Down
10 changes: 10 additions & 0 deletions security/publish_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
before :each do
@conf = read_config
@aem_publish = init_publish_client(@conf['aem']['publish'])
init_web_client(@conf['aem']['publish'])
end

it 'should not be able to start bundle with default credentials' do
Expand All @@ -19,4 +20,13 @@
# no result due to error raised
expect(result).to eq(nil)
end

it 'should not be able to login with default credentials' do
visit '/libs/granite/core/content/login.html'
fill_in('username', with: 'admin')
fill_in('password', with: 'admin')
click_button('submit-button')
error = find('#error').text
expect(error).to eq('User name and password do not match')
end
end
2 changes: 1 addition & 1 deletion spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def init_publish_client(conf)
)
end

def init_dispatcher_client(conf)
def init_web_client(conf)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it to a more appropriate name since we use it for author and publish tests

Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: false)
end
Expand Down