Skip to content

Commit

Permalink
Fix incorrect duplicate params check in OAuth pipes
Browse files Browse the repository at this point in the history
  • Loading branch information
akadusei committed Aug 9, 2024
1 parent e621c08 commit a7a2c13
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased] -

### Fixed
- Fix incorrect duplicate params check in OAuth pipes

## [1.2.1] - 2024-07-25

### Fixed
Expand Down
5 changes: 5 additions & 0 deletions src/shield/actions/api/oauth/authorization/pipes.cr
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,10 @@ module Shield::Api::Oauth::Authorization::Pipes
state: state
})
end

# @[Override]
private def has_duplicate_params
has_duplicate_params(params.from_form_data)
end
end
end
10 changes: 9 additions & 1 deletion src/shield/actions/oauth/pipes.cr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ module Shield::Oauth::Pipes
end

private def has_duplicate_params
params.from_query.any? { |name, _| name.size > 1 }
has_duplicate_params(params.from_query)
end

private def has_duplicate_params(params)
params.each do |name, _|
return true if params.fetch_all(name).size > 1
end

false
end
end
end

0 comments on commit a7a2c13

Please sign in to comment.