Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

Addresses review feedback on #480 for the GitLab Terraform state scanner implementation.

Changes

  • Replace custom sanitizeFilename with stdlib: Changed from map-based rune replacement to strings.Map with strings.ContainsRune

    // Before: Custom map with manual iteration
    replacements := map[rune]rune{'/': '_', '\\': '_', ...}
    runes := []rune(name)
    for i, r := range runes {
        if replacement, ok := replacements[r]; ok {
            runes[i] = replacement
        }
    }
    return string(runes)
    
    // After: Idiomatic stdlib approach
    invalidChars := `/\:*?"<>|`
    return strings.Map(func(r rune) rune {
        if strings.ContainsRune(invalidChars, r) {
            return '_'
        }
        return r
    }, name)
  • Remove obvious comments: Stripped inline comments that don't provide additional context (e.g., "Initialize scanner", "Download state file", "Save to file"). Retained godoc function documentation.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…t comments

Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 19, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 192.0.2.2
    • Triggering command: /home/REDACTED/work/pipeleek/pipeleek/pipeleek /home/REDACTED/work/pipeleek/pipeleek/pipeleek gluna shodan --json /tmp/TestGLunaShodan_HTTPModule1972720415/001/shodan-export.json go1.25.1 -c=4 -nolocalimports -importcfg /tmp/go-build3505984053/b203/importcfg -pack /home/REDACTED/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.1.linux-amd64/src/net/http/internal/httpcommon/httpcommon.go -o 0.1-go1.25.1.lin-pthread mpile rg/toolchain@v0.-fmessage-length=0 -p lehog/v3/pkg/det-o mpile rg/toolchain@v0.-trimpath (packet block)
  • 192.0.2.4
    • Triggering command: /home/REDACTED/work/pipeleek/pipeleek/pipeleek /home/REDACTED/work/pipeleek/pipeleek/pipeleek gluna shodan --json /tmp/TestGLunaShodan_MultipleInstances2496836229/001/shodan-export.json go1.25.1 -c=4 -nolocalimports -importcfg /tmp/go-build3505984053/b204/importcfg -pack /home/REDACTED/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.1.linux-amd64/src/net/http/httptest/httptest.go -o 0.1-go1.25.1.lin. 6.0/ripemd160/ri/tmp/cgo-gcc-input-671594281.c rg/toolchain@v0.0.1-go1.25.1.linux-amd64/pkg/tool/linux_amd64/compile -p lehog/v3/pkg/det-unsafeptr=false mpile rg/toolchain@v0./tmp/go-build3505984053/b125/vet.cfg (packet block)
  • example.invalid
    • Triggering command: /home/REDACTED/work/pipeleek/pipeleek/pipeleek /home/REDACTED/work/pipeleek/pipeleek/pipeleek gluna shodan --json /tmp/TestGLunaShodan_WithHostname799684312/001/shodan-export.json ty/trufflehog/v3. db.org/mongo-dri-imultiarch rg/toolchain@v0.x86_64-linux-gnu ck/betterstack.g/home/REDACTED/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.1.linux-amd64/pkg/too/home/REDACTED/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.1.linux-amd64/src/net--token lehog/v3/pkg/det-unsafeptr=false mpile rg/toolchain@v0./tmp/go-build3505984053/b072/vet.cfg -o 0.1-go1.25.1.lin-dumpbase g@v1.1.0/digest._cgo_.c rg/toolchain@v0.-dumpbase-ext /coveralls.go lehog/v3/pkg/det-o mpile rg/toolchain@v0.-trimpath (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] WIP address review comments on GitLab Terraform state scanner Refactor sanitizeFilename to use Go stdlib and remove redundant comments Jan 19, 2026
Copilot AI requested a review from frjcomp January 19, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants