Merge pull request #299 from soraxas/feat/more-generic-cache

Remove checking for parent / grandparent process
This commit is contained in:
Bernd Schoolmann 2024-11-01 22:09:47 +01:00 committed by GitHub
commit 490dfae155
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,9 +55,12 @@ func (s *SessionStore) CreateSession(pid int, parentpid int, grandparentpid int,
func (s *SessionStore) verifySession(ctx sockets.CallingContext, sessionType SessionType) bool { func (s *SessionStore) verifySession(ctx sockets.CallingContext, sessionType SessionType) bool {
for _, session := range s.Store { for _, session := range s.Store {
if session.ParentPid == ctx.ParentProcessPid && session.GrandParentPid == ctx.GrandParentProcessPid && session.sessionType == sessionType { if session.sessionType == sessionType {
if session.Expires.After(time.Now()) { // only check for ancestor if the session is not a ssh session
return true if sessionType == SSHKey || (session.ParentPid == ctx.ParentProcessPid && session.GrandParentPid == ctx.GrandParentProcessPid) {
if session.Expires.After(time.Now()) {
return true
}
} }
} }
} }