This PR removes the CGo dependency on smacker/go-tree-sitter by replacing BishopFox/jsluice with a pure-Go JavaScript endpoint extractor built on dop251/goja.
The go-tree-sitter library requires CGo, which complicates cross-platform builds (especially for darwin/arm64, windows, and 386 targets). By switching to dop251/goja — a pure-Go ECMAScript engine — we eliminate the CGo requirement entirely.
BishopFox/jsluice + smacker/go-tree-sitter with dop251/goja/parser and dop251/goja/astpkg/utils/jsluice.go that extracts endpoints from:
fetch(), window.open(), location.replace() callsXMLHttpRequest.open() calls$.get, $.post, $.ajax)location.href = "/path")"/api/" + id + "/data")//go:build !(386 || windows))parser_nojs.go — jsluice functionality now works on all platforms/claim #1367
$ go test ./...
ok github.com/projectdiscovery/katana/pkg/engine/parser 0.038s
ok github.com/projectdiscovery/katana/pkg/utils 0.012s
...
$ CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build ./cmd/katana # Success
$ CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ./cmd/katana # Success
$ CGO_ENABLED=0 GOOS=linux GOARCH=386 go build ./cmd/katana # Success
github.com/BishopFox/jsluice — removed from go.modgithub.com/smacker/go-tree-sitter — removed from go.mod and go.sumgithub.com/ditashi/jsbeautifier-go — removed (was a transitive dep of jsluice)github.com/dop251/goja — pure-Go ECMAScript engine (no CGo)🤖 Generated with Claude Code
Bug Fixes
New Features
Tests
Chores
285729101
@285729101
ProjectDiscovery
@projectdiscovery
Hermes1118
@dalledajay-gmail-com