Fix tree-sitter build failures by using updated jsluice fork#1519
Fix tree-sitter build failures by using updated jsluice fork#15191234-ad wants to merge 1 commit intoprojectdiscovery:devfrom
Conversation
Add replace directive to use updated jsluice fork that migrates to official tree-sitter bindings, resolving build issues caused by the unmaintained smacker/go-tree-sitter dependency. This change eliminates CGO-related build failures on Windows, Linux, and Docker environments. Fixes projectdiscovery#1367
WalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@go.mod`:
- Around line 174-176: The go.mod comment references a non-existent upstream PR
(https://github.com/BishopFox/jsluice/pull/33) as the removal condition for the
temporary fork; update the comment and tracking so the replacement (the replace
directive for github.com/BishopFox/jsluice => github.com/1234-ad/jsluice) has a
real exit path: either open the actual PR in BishopFox/jsluice and update the
comment to reference that PR number, or if a PR already exists under a different
number, change the comment to point to the correct PR, or link a canonical
GitHub issue/internal tracking ID instead and note that link in the go.mod
comment so future maintainers know when the fork can be removed; leave the
replace directive intact until that tracked upstream change is merged.
🧹 Nitpick comments (1)
go.mod (1)
174-176: Consider adding a mechanism to track removal of this temporary fix.The comments indicate this replace directive should be removed once the upstream PR is merged. However, there's no automated way to track or remind about this removal.
Consider:
- Adding a TODO comment with a tracking issue number
- Creating a follow-up issue to remove this replace directive once upstream is fixed
- Adding a note in the project's documentation or CHANGELOG about this temporary dependency override
📝 Suggested enhancement for better tracking
-// Use jsluice fork with official tree-sitter bindings to fix build issues -// This can be removed once https://github.com/BishopFox/jsluice/pull/33 is merged +// TODO(`#ISSUE_NUMBER`): Use jsluice fork with official tree-sitter bindings to fix build issues +// This MUST be removed once https://github.com/BishopFox/jsluice/pull/33 is merged and released replace github.com/BishopFox/jsluice => github.com/1234-ad/jsluice v0.0.0-20260204150300-fbbc6fac5b14Replace
#ISSUE_NUMBERwith an actual tracking issue number.
| // Use jsluice fork with official tree-sitter bindings to fix build issues | ||
| // This can be removed once https://github.com/BishopFox/jsluice/pull/33 is merged | ||
| replace github.com/BishopFox/jsluice => github.com/1234-ad/jsluice v0.0.0-20260204150300-fbbc6fac5b14 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's see the full context of the go.mod file changes
cat -n go.mod | sed -n '165,180p'Repository: projectdiscovery/katana
Length of output: 699
🏁 Script executed:
# Check if there are any related comments or tracking issues in the codebase
rg -i "jsluice|BishopFox" --type go --type md --type txtRepository: projectdiscovery/katana
Length of output: 2675
🏁 Script executed:
# Check the git history of this change to understand context
git log --oneline --all -- go.mod | head -20Repository: projectdiscovery/katana
Length of output: 1439
🌐 Web query:
BishopFox jsluice PR 33 tree-sitter
💡 Result:
There doesn’t appear to be a Pull Request #33 in BishopFox/jsluice. The repo’s PR list shows only #29 as the newest visible PR (and 16 closed PRs total), with no #33 present. [1]
If your intent was “tree-sitter support in jsluice”: jsluice is built around Tree-sitter (via go-tree-sitter) to parse JavaScript into syntax trees and then extract URLs/secrets, and it also has a query mode to run raw Tree-sitter queries. [2][3]
Sources:
[1] BishopFox/jsluice pull requests list: https://github.com/BishopFox/jsluice/pulls
[2] BishopFox/jsluice README (go-tree-sitter usage): https://github.com/BishopFox/jsluice
[3] Bishop Fox blog (jsluice “Trees and Queries” / Tree-sitter query mode): https://bishopfox.com/blog/jsluice-javascript-technical-deep-dive
The referenced upstream PR #33 does not exist in BishopFox/jsluice.
The code comment references BishopFox/jsluice#33 as the condition for removing this temporary fork, but that PR does not exist (only PR #29 is visible in the BishopFox/jsluice repository). This means:
- The stated removal condition is impossible to satisfy
- There is no upstream PR currently tracking the tree-sitter migration
- The temporary fork replacement lacks a clear exit path
Consider either:
- Creating an actual upstream PR in BishopFox/jsluice to address the tree-sitter migration and update the go.mod comment to reference the correct PR
- If an upstream PR already exists under a different number, update the comment to reference the correct PR
- Establish an alternative mechanism to track when this fork can be replaced (e.g., GitHub issue, internal tracking)
🤖 Prompt for AI Agents
In `@go.mod` around lines 174 - 176, The go.mod comment references a non-existent
upstream PR (https://github.com/BishopFox/jsluice/pull/33) as the removal
condition for the temporary fork; update the comment and tracking so the
replacement (the replace directive for github.com/BishopFox/jsluice =>
github.com/1234-ad/jsluice) has a real exit path: either open the actual PR in
BishopFox/jsluice and update the comment to reference that PR number, or if a PR
already exists under a different number, change the comment to point to the
correct PR, or link a canonical GitHub issue/internal tracking ID instead and
note that link in the go.mod comment so future maintainers know when the fork
can be removed; leave the replace directive intact until that tracked upstream
change is merged.
…eeded Co-authored-by: samuel-asleep <210051637+samuel-asleep@users.noreply.github.com>
|
Hi, thanks for your interest in contributing! Just a heads up, we ask contributors to work on 1 active issue at a time (see). Also, we welcome AI-assisted development, but submissions must be complete, tested, and ready to merge. Please also make sure to fill out the PR template with proof that your changes work. We're closing this PR along with your other open submissions. Once you're ready, feel free to pick one issue to focus on and resubmit; we'd be happy to review it. Appreciate your understanding! |
Proposed changes
This PR fixes build failures caused by the unmaintained
smacker/go-tree-sitterdependency in jsluice by temporarily using an updated fork until the upstream fix is merged.Root Cause: The
github.com/BishopFox/jsluicedependency usessmacker/go-tree-sitterwhich is unmaintained (last updated July 2023) and causes CGO compilation failures on Windows, Linux, and Docker environments.Solution: Add a
replacedirective ingo.modto use an updated jsluice fork that migrates to officialtree-sitter/go-tree-sitterbindings.Upstream Fix: I've created BishopFox/jsluice#33 to fix this in the upstream repository. Once merged, this replace directive can be removed.
Changes Made
go.mod
replacedirective to usegithub.com/1234-ad/jsluicefork with official tree-sitter bindingsgithub.com/smacker/go-tree-sitterfrom indirect dependencies (no longer needed)Benefits
✅ Fixes build failures on Windows, Linux, and Docker
✅ Uses actively maintained official tree-sitter bindings
✅ No code changes required - drop-in replacement
✅ Temporary workaround until upstream PR is merged
Proof
Before (with smacker/go-tree-sitter):
After (with official tree-sitter bindings):
The jsluice fork maintains full API compatibility - all katana functionality works unchanged.
Testing:
go build ./cmd/katanaChecklist
Related Issues
Fixes #1367
Notes
This is a temporary workaround using a replace directive. Once BishopFox/jsluice#33 is merged and a new jsluice version is released, we should:
The replace directive points to commit
fbbc6fac5b14which contains the migration to official tree-sitter bindings.Summary by CodeRabbit