(command string)
| 323 | } |
| 324 | |
| 325 | func 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 | |
| 350 | func checkQuotedNewline(command string) []SecurityFinding { |
| 351 | inSingle, inDouble := false, false |
no outgoing calls
no test coverage detected