MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / OnSignal

Method OnSignal

internal/security/handler_session.go:264–300  ·  view source on GitHub ↗
(requestID uint64, signal string)

Source from the content-addressed store, hash-verified

262}
263
264func (s *sessionHandler) OnSignal(requestID uint64, signal string) error {
265 mode := s.getPolicy(s.config.Shell.Mode)
266 switch mode {
267 case config2.ExecutionPolicyDisable:
268 err := message.UserMessage(
269 message.ESecuritySignalRejected,
270 "Sending signals is rejected.",
271 "Sending the signal is rejected because signal delivery is disabled.",
272 )
273 s.logger.Debug(err)
274 return err
275 case config2.ExecutionPolicyFilter:
276 if s.contains(s.config.Signal.Allow, signal) {
277 return s.backend.OnSignal(requestID, signal)
278 }
279 err := message.UserMessage(
280 message.ESecuritySignalRejected,
281 "Sending signals is rejected.",
282 "Sending the signal is rejected because the specified signal does not match the allow list.",
283 )
284 s.logger.Debug(err)
285 return err
286 case config2.ExecutionPolicyEnable:
287 fallthrough
288 default:
289 if !s.contains(s.config.Signal.Deny, signal) {
290 return s.backend.OnSignal(requestID, signal)
291 }
292 err := message.UserMessage(
293 message.ESecuritySignalRejected,
294 "Sending signals is rejected.",
295 "Sending the signal is rejected because the specified signal matches the deny list.",
296 )
297 s.logger.Debug(err)
298 return err
299 }
300}
301
302func (s *sessionHandler) OnWindow(requestID uint64, columns uint32, rows uint32, width uint32, height uint32) error {
303 return s.backend.OnWindow(requestID, columns, rows, width, height)

Callers

nothing calls this directly

Calls 5

getPolicyMethod · 0.95
containsMethod · 0.95
UserMessageFunction · 0.92
DebugMethod · 0.65
OnSignalMethod · 0.65

Tested by

no test coverage detected