MCPcopy Create free account
hub / github.com/diillson/chatcli / validateSessionName

Function validateSessionName

cli/session_manager.go:51–65  ·  view source on GitHub ↗

validateSessionName checks the session name against security rules (L4).

(name string)

Source from the content-addressed store, hash-verified

49
50// validateSessionName checks the session name against security rules (L4).
51func validateSessionName(name string) error {
52 if name == "" {
53 return fmt.Errorf("session name cannot be empty")
54 }
55 // Reject null bytes, control characters
56 for _, c := range name {
57 if c < 0x20 || c == 0x7f || c == 0x00 {
58 return fmt.Errorf("session name contains invalid control characters")
59 }
60 }
61 if !validSessionName.MatchString(name) {
62 return fmt.Errorf("session name must be alphanumeric with dash/underscore/dot only (max 255 chars)")
63 }
64 return nil
65}
66
67// getSessionPath retorna o caminho completo para um arquivo de sessão.
68func (sm *SessionManager) getSessionPath(name string) string {

Callers 1

SaveSessionV2Method · 0.70

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected