ValidatePIDWithOwnership performs comprehensive PID validation including process ownership checks
(pid int)
| 95 | |
| 96 | // ValidatePIDWithOwnership performs comprehensive PID validation including process ownership checks |
| 97 | func (pv *ProcessValidator) ValidatePIDWithOwnership(pid int) error { |
| 98 | // First perform basic PID validation |
| 99 | if err := pv.ValidatePID(pid); err != nil { |
| 100 | return err |
| 101 | } |
| 102 | |
| 103 | // Then perform ownership validation |
| 104 | if err := pv.validateProcessOwnership(pid); err != nil { |
| 105 | return PIDValidationError{ |
| 106 | PID: pid, |
| 107 | Message: fmt.Sprintf("ownership validation failed: %s", err.Error()), |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | return nil |
| 112 | } |
| 113 | |
| 114 | // validateProcessOwnership checks if the process belongs to an allowed parent |
| 115 | func (pv *ProcessValidator) validateProcessOwnership(pid int) error { |
no test coverage detected