MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / checkCommentQuoteDesync

Function checkCommentQuoteDesync

tools/bash/security.go:325–348  ·  view source on GitHub ↗
(command string)

Source from the content-addressed store, hash-verified

323}
324
325func checkCommentQuoteDesync(command string) []SecurityFinding {
326 if !strings.ContainsAny(command, "'\"") {
327 return nil
328 }
329 inSingle, inDouble := false, false
330 for i := 0; i < len(command); i++ {
331 switch command[i] {
332 case '\'':
333 if !inDouble {
334 inSingle = !inSingle
335 for j := i + 1; j < len(command) && command[j] != '\''; j++ {
336 if command[j] == '#' {
337 return []SecurityFinding{{ID: CheckCommentQuoteDesync, Description: "Comment-quote desync: # inside single quotes"}}
338 }
339 }
340 }
341 case '"':
342 if !inSingle {
343 inDouble = !inDouble
344 }
345 }
346 }
347 return nil
348}
349
350func checkQuotedNewline(command string) []SecurityFinding {
351 inSingle, inDouble := false, false

Callers 1

RunAllSecurityChecksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected