Skip to content

Fix tree-sitter build failures by using updated jsluice fork#1519

Closed
1234-ad wants to merge 1 commit intoprojectdiscovery:devfrom
1234-ad:fix-tree-sitter-dependency-1367
Closed

Fix tree-sitter build failures by using updated jsluice fork#1519
1234-ad wants to merge 1 commit intoprojectdiscovery:devfrom
1234-ad:fix-tree-sitter-dependency-1367

Conversation

@1234-ad
Copy link

@1234-ad 1234-ad commented Feb 4, 2026

Proposed changes

This PR fixes build failures caused by the unmaintained smacker/go-tree-sitter dependency in jsluice by temporarily using an updated fork until the upstream fix is merged.

Root Cause: The github.com/BishopFox/jsluice dependency uses smacker/go-tree-sitter which is unmaintained (last updated July 2023) and causes CGO compilation failures on Windows, Linux, and Docker environments.

Solution: Add a replace directive in go.mod to use an updated jsluice fork that migrates to official tree-sitter/go-tree-sitter bindings.

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

  • Added replace directive to use github.com/1234-ad/jsluice fork with official tree-sitter bindings
  • Removed github.com/smacker/go-tree-sitter from 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):

Build fails with CGO errors, missing types, compilation issues

After (with official tree-sitter bindings):

Build succeeds on all platforms

The jsluice fork maintains full API compatibility - all katana functionality works unchanged.

Testing:

  • Build succeeds with go build ./cmd/katana
  • All katana features using jsluice (URL extraction, secret detection) work as expected
  • No breaking changes to katana's functionality

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

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:

  1. Remove the replace directive
  2. Update to the official jsluice version with the fix

The replace directive points to commit fbbc6fac5b14 which contains the migration to official tree-sitter bindings.

Summary by CodeRabbit

  • Chores
    • Updated build dependency configuration to use a maintained fork of a critical module, improving compilation compatibility and resolving build stability issues
    • Streamlined indirect dependencies to enhance overall build reliability and consistency across development and production environments

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
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Walkthrough

The go.mod file has been updated to remove an indirect dependency on go-tree-sitter and introduce a replace directive that redirects the jsluice module to a forked version, addressing build issues while maintaining the overall dependency structure.

Changes

Cohort / File(s) Summary
Dependency Management
go.mod
Removed indirect dependency on github.com/smacker/go-tree-sitter; added replace directive to redirect github.com/BishopFox/jsluice to fork version github.com/1234-ad/jsluice v0.0.0-20260204150300-fbbc6fac5b14 with explanatory comments about fork replacement strategy.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hop through the modules, a fork in the road,
Dependencies shifted, a lighter load,
jsluice finds a new home, so merry and bright,
Build issues squashed—now everything's right!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: fixing tree-sitter build failures by using an updated jsluice fork, which directly matches the go.mod modifications made in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Adding a TODO comment with a tracking issue number
  2. Creating a follow-up issue to remove this replace directive once upstream is fixed
  3. 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-fbbc6fac5b14

Replace #ISSUE_NUMBER with an actual tracking issue number.

Comment on lines +174 to +176
// 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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 txt

Repository: 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 -20

Repository: 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:

  1. The stated removal condition is impossible to satisfy
  2. There is no upstream PR currently tracking the tree-sitter migration
  3. 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.

Copilot AI added a commit to samuel-asleep/katana that referenced this pull request Feb 4, 2026
…eeded

Co-authored-by: samuel-asleep <210051637+samuel-asleep@users.noreply.github.com>
@dogancanbakir
Copy link
Member

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!

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.

Feature / Question: go-tree-sitter dependency

2 participants