@rhodawkai/bounty-hunter 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,7 +20,7 @@ AI-powered bug bounty hunting, recon to report, in your terminal.**
20
20
  Python package [`rhodawk-bounty-hunter`](https://pypi.org/project/rhodawk-bounty-hunter/).
21
21
  It resolves and runs the `rhodawk` engine — fail-closed, CDN-aware autonomous
22
22
  bug bounty reconnaissance and attack-surface prioritization — and falls back to
23
- `pipx run` when the Python package is not installed yet.
23
+ `uvx` / `pipx run` when the Python package is not installed yet.
24
24
 
25
25
  ## Install
26
26
 
@@ -36,9 +36,14 @@ The wrapper exposes a single binary: `rhodawk`.
36
36
 
37
37
  1. If a real `rhodawk` is already on `PATH` (pipx / uv tool / source install),
38
38
  it is executed directly.
39
- 2. Otherwise the wrapper delegates to `pipx run --spec rhodawk-bounty-hunter rhodawk`.
39
+ 2. Otherwise the wrapper delegates to
40
+ `uvx --from rhodawk-bounty-hunter rhodawk` when `uvx` is available, else to
41
+ `pipx run --spec rhodawk-bounty-hunter rhodawk`. The wrapper's own install
42
+ directory (e.g. npx's temporary `node_modules/.bin`) is stripped from the
43
+ child `PATH`, so neither runner mistakes the wrapper itself for an
44
+ installed `rhodawk` and no "already on your PATH" warning is printed.
40
45
  3. If neither is possible, it prints install instructions for
41
- [pipx](https://pipx.pypa.io/) and the
46
+ [uv](https://docs.astral.sh/uv/) / [pipx](https://pipx.pypa.io/) and the
42
47
  [PyPI package](https://pypi.org/project/rhodawk-bounty-hunter/).
43
48
 
44
49
  ## First run
package/bin/rhodawk.js CHANGED
@@ -7,6 +7,7 @@ const { spawnSync } = require("child_process");
7
7
 
8
8
  const PKG = "rhodawk-bounty-hunter";
9
9
  const args = process.argv.slice(2);
10
+ const SELF_RESOLVED = path.resolve(__filename);
10
11
  const SELF_REAL = fs.realpathSync(__filename);
11
12
 
12
13
  if (process.env.RHODAWK_NPM_WRAPPER === "1") {
@@ -26,12 +27,68 @@ function isExecutable(filePath) {
26
27
  }
27
28
  }
28
29
 
30
+ const EXTS = process.platform === "win32" ? [".exe", ".cmd", ".bat", ""] : [""];
31
+
32
+ // Directories this wrapper itself lives in (Layer 1C, live-sandbox finding):
33
+ // under `npx -y @rhodawkai/bounty-hunter` the temp install's
34
+ // node_modules/.bin/rhodawk IS this wrapper, so that PATH entry must never
35
+ // reach child processes — otherwise pipx/uvx see "rhodawk" already on PATH
36
+ // (the wrapper, not the Python CLI) and print a confusing
37
+ // "⚠️ rhodawk is already on your PATH ... Downloading and running anyway."
38
+ // warning on every invocation of a blank machine.
39
+ function wrapperDirs() {
40
+ const dirs = new Set();
41
+ const add = (d) => {
42
+ if (d) {
43
+ try {
44
+ dirs.add(path.resolve(d));
45
+ } catch {
46
+ /* ignore unresolvable dir */
47
+ }
48
+ }
49
+ };
50
+ try {
51
+ add(path.dirname(process.argv[1]));
52
+ } catch {
53
+ /* argv[1] may be odd under embedded runners */
54
+ }
55
+ add(path.dirname(SELF_RESOLVED));
56
+ add(path.dirname(SELF_REAL));
57
+ // plus any PATH entry whose `rhodawk` resolves to this wrapper itself
58
+ const pathDirs = (process.env.PATH || "").split(path.delimiter).filter(Boolean);
59
+ for (const dir of pathDirs) {
60
+ for (const ext of EXTS) {
61
+ const candidate = path.join(dir, "rhodawk" + ext);
62
+ if (!isExecutable(candidate)) continue;
63
+ let real;
64
+ try {
65
+ real = fs.realpathSync(candidate);
66
+ } catch {
67
+ continue;
68
+ }
69
+ if (real === SELF_REAL || real === SELF_RESOLVED) {
70
+ add(dir);
71
+ break;
72
+ }
73
+ }
74
+ }
75
+ return dirs;
76
+ }
77
+
78
+ function sanitizedPath() {
79
+ const skip = wrapperDirs();
80
+ return (process.env.PATH || "")
81
+ .split(path.delimiter)
82
+ .filter(Boolean)
83
+ .filter((dir) => !skip.has(path.resolve(dir)))
84
+ .join(path.delimiter);
85
+ }
86
+
29
87
  function findExternalCmd(cmd) {
30
88
  const pathDirs = (process.env.PATH || "").split(path.delimiter).filter(Boolean);
31
- const exts = process.platform === "win32" ? [".exe", ".cmd", ".bat", ""] : [""];
32
89
 
33
90
  for (const dir of pathDirs) {
34
- for (const ext of exts) {
91
+ for (const ext of EXTS) {
35
92
  const candidate = path.join(dir, cmd + ext);
36
93
  if (!isExecutable(candidate)) continue;
37
94
  let real;
@@ -40,17 +97,25 @@ function findExternalCmd(cmd) {
40
97
  } catch {
41
98
  continue;
42
99
  }
43
- if (real === SELF_REAL) continue;
100
+ if (real === SELF_REAL || real === SELF_RESOLVED) continue;
44
101
  return candidate;
45
102
  }
46
103
  }
47
104
  return null;
48
105
  }
49
106
 
107
+ // Every child gets the sanitized PATH: both the chained Python rhodawk
108
+ // (so a real binary never re-discovers wrapper copies) and the fallback
109
+ // runners (so pipx/uvx never see node_modules/.bin/rhodawk and never emit
110
+ // the "already on your PATH" warning).
50
111
  function run(cmdPath, cmdArgs) {
51
112
  const res = spawnSync(cmdPath, cmdArgs, {
52
113
  stdio: "inherit",
53
- env: { ...process.env, RHODAWK_NPM_WRAPPER: "1" },
114
+ env: {
115
+ ...process.env,
116
+ PATH: sanitizedPath(),
117
+ RHODAWK_NPM_WRAPPER: "1",
118
+ },
54
119
  });
55
120
  if (res.error) {
56
121
  console.error(`[rhodawk] Failed to run ${cmdPath}: ${res.error.message}`);
@@ -62,18 +127,25 @@ function run(cmdPath, cmdArgs) {
62
127
  const rhodawkBin = findExternalCmd("rhodawk");
63
128
  if (rhodawkBin) {
64
129
  run(rhodawkBin, args);
65
- } else {
66
- const pipxBin = findExternalCmd("pipx");
67
- if (pipxBin) {
68
- run(pipxBin, ["run", "--spec", PKG, "rhodawk", ...args]);
69
- }
130
+ }
131
+
132
+ // Blank box, no Python rhodawk: prefer uvx (fast, silent, PEP 668-safe),
133
+ // then pipx run. If neither runner exists, print a concise install hint.
134
+ const uvxBin = findExternalCmd("uvx");
135
+ if (uvxBin) {
136
+ run(uvxBin, ["--from", PKG, "rhodawk", ...args]);
137
+ }
138
+
139
+ const pipxBin = findExternalCmd("pipx");
140
+ if (pipxBin) {
141
+ run(pipxBin, ["run", "--spec", PKG, "rhodawk", ...args]);
70
142
  }
71
143
 
72
144
  console.error(
73
- `[rhodawk] Python CLI not found on PATH.\n` +
74
- `Install the core package first:\n` +
75
- ` pipx install ${PKG}\n` +
76
- ` # or inside a virtualenv:\n` +
77
- ` pip install ${PKG}\n`
145
+ `[rhodawk] Python CLI not found on PATH, and neither uvx nor pipx is installed.\n` +
146
+ `Install the core package with one of:\n` +
147
+ ` uv tool install ${PKG} # then run: rhodawk <command>\n` +
148
+ ` pipx install ${PKG} # then run: rhodawk <command>\n` +
149
+ ` pip install ${PKG} # or inside a virtualenv\n`
78
150
  );
79
151
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhodawkai/bounty-hunter",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "RhodawkAI Bounty Hunter CLI wrapper — fail-closed, CDN-aware autonomous bug bounty reconnaissance & attack-surface prioritization.",
5
5
  "license": "MIT",
6
6
  "author": "RhodawkAI <manager@rhodawkai.com>",