Skip to content

Commit

Permalink
Adds guard in session ACL check in case session is not found.
Browse files Browse the repository at this point in the history
Fixes #2624.
  • Loading branch information
slackpad committed Apr 13, 2017
1 parent d549c9c commit 76c1e2d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions consul/session_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func (s *Session) Apply(args *structs.SessionRequest, reply *string) error {
state := s.srv.fsm.State()
_, existing, err := state.SessionGet(nil, args.Session.ID)
if err != nil {
return fmt.Errorf("Session lookup failed: %v", err)
}
if existing == nil {
return fmt.Errorf("Unknown session %q", args.Session.ID)
}
if !acl.SessionWrite(existing.Node) {
Expand Down

0 comments on commit 76c1e2d

Please sign in to comment.