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

Function IsSensitivePath

utils/path.go:38–52  ·  view source on GitHub ↗

IsSensitivePath checks whether a file path points to a known sensitive location.

(absPath string)

Source from the content-addressed store, hash-verified

36
37// IsSensitivePath checks whether a file path points to a known sensitive location.
38func IsSensitivePath(absPath string) bool {
39 normalizedPath := filepath.ToSlash(absPath)
40 if runtime.GOOS != "windows" {
41 normalizedPath = strings.ToLower(normalizedPath)
42 }
43 for _, sensitive := range sensitivePaths {
44 sensitive = strings.ToLower(sensitive)
45 if strings.Contains(normalizedPath, "/"+sensitive+"/") ||
46 strings.HasSuffix(normalizedPath, "/"+sensitive) ||
47 strings.Contains(normalizedPath, "/"+sensitive) {
48 return true
49 }
50 }
51 return false
52}
53
54// ReadFileContent lê o conteúdo de um arquivo, expandindo ~ para o diretório home,
55// mostrando um indicador de progresso para arquivos grandes.

Callers 1

ReadFileContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected