Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Added test to check if null bytes are allowed #45

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 12 additions & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,23 @@
end

describe :username do
let(:new_user) { build :user }

it "checks uniqueness case insensitively" do
create :user, username: "TestUser"
user2 = build :user, username: "testuser"
expect(user2.save).to be_false
end

it "cannot contain null bytes" do
new_user.username = "\x00gerard"
expect(new_user.valid?).to be_false
end

it "Test for HackerOne report #24189" do
new_user.username = "gerard%0a"
Copy link
Member

Choose a reason for hiding this comment

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

to test the hackone example explicitly you need to parse this of course, so something like Uri.decode or something., literal %0a is no problem of course.

expect(new_user.valid?).to be_false
end
end

describe '#full_name' do
Expand Down