Skip to content
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
2 changes: 1 addition & 1 deletion app/forms/openid_connect_token_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def url_options
attr_reader :identity

def find_identity_with_code
return if code.blank?
return if code.blank? || code.include?("\x00")

session_expiration = AppConfig.env.session_timeout_in_minutes.to_i.minutes.ago
@identity = Identity.where(session_uuid: code).
Expand Down
9 changes: 9 additions & 0 deletions spec/forms/openid_connect_token_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@
end
end

context 'the code has a null byte' do
let(:code) { "\x00code"}

it 'is invalid' do
expect(valid?).to eq(false)
expect(form.errors[:code]).to include(t('openid_connect.token.errors.invalid_code'))
end
end

context 'code has expired' do
before { identity.update(updated_at: 1.day.ago) }

Expand Down