Skip to content

Commit

Permalink
Make bad token creds fail
Browse files Browse the repository at this point in the history
  • Loading branch information
xendk committed Sep 25, 2024
1 parent 403e402 commit 11bbc62
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Intended Effort Versioning](https://jacobtomlinson.

## 1.3.2 - [Unreleased]

### Changed
- Invalid token creds results in 403 response, not an anonymous
response.

## [1.3.1] - 2024-09-25

### Added
Expand Down
8 changes: 8 additions & 0 deletions src/controllers/legacy_entity_controller.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ class LegacyEntityController < Amber::Controller::Base
if token.size == 2
token_user = User.find_by(hashed_password: token[0], email: token[1])
end

unless token_user
halt!(403, "Forbidden")

# Contrary to the documented behaviour, halt! doesn't actually
# break out early. Obviously a bug.
return
end
end

location = Time::Location.load("Europe/Copenhagen")
Expand Down

0 comments on commit 11bbc62

Please sign in to comment.