subto 8.0.0 → 8.0.1
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/dist/package/README.md +3 -3
- package/dist/package/index.js +1 -1
- package/index.js +13 -2
- package/package.json +1 -1
package/dist/package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ Commands
|
|
|
40
40
|
{
|
|
41
41
|
"url": "https://example.com",
|
|
42
42
|
"source": "cli",
|
|
43
|
-
"client": { "name": "subto-cli", "version": "8.0.
|
|
43
|
+
"client": { "name": "subto-cli", "version": "8.0.1" }
|
|
44
44
|
}
|
|
45
45
|
```
|
|
46
46
|
|
|
@@ -98,11 +98,11 @@ Download
|
|
|
98
98
|
After publishing or packing, a distributable tarball will be available under `./dist/` e.g.:
|
|
99
99
|
|
|
100
100
|
```
|
|
101
|
-
./dist/subto-8.0.
|
|
101
|
+
./dist/subto-8.0.1.tgz
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
You can download that file directly and install locally with:
|
|
105
105
|
|
|
106
106
|
```bash
|
|
107
|
-
npm install -g ./dist/subto-8.0.
|
|
107
|
+
npm install -g ./dist/subto-8.0.1.tgz
|
|
108
108
|
```
|
package/dist/package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const chalk = (_chalk && _chalk.default) ? _chalk.default : _chalk;
|
|
|
11
11
|
const CONFIG_DIR = path.join(os.homedir(), '.subto');
|
|
12
12
|
const CONFIG_PATH = path.join(CONFIG_DIR, 'config.json');
|
|
13
13
|
const DEFAULT_API_BASE = 'https://subto.one';
|
|
14
|
-
const CLIENT_META = { name: 'subto-cli', version: '8.0.
|
|
14
|
+
const CLIENT_META = { name: 'subto-cli', version: '8.0.1' };
|
|
15
15
|
|
|
16
16
|
function configFilePath() { return CONFIG_PATH; }
|
|
17
17
|
|
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const chalk = (_chalk && _chalk.default) ? _chalk.default : _chalk;
|
|
|
11
11
|
const CONFIG_DIR = path.join(os.homedir(), '.subto');
|
|
12
12
|
const CONFIG_PATH = path.join(CONFIG_DIR, 'config.json');
|
|
13
13
|
const DEFAULT_API_BASE = 'https://subto.one/api/v1';
|
|
14
|
-
const CLIENT_META = { name: 'subto-cli', version: '8.0.
|
|
14
|
+
const CLIENT_META = { name: 'subto-cli', version: '8.0.1' };
|
|
15
15
|
const cp = require('child_process');
|
|
16
16
|
|
|
17
17
|
// Normalize SUBTO API base so callers can set either
|
|
@@ -132,6 +132,13 @@ async function storeOpenRouterKeyInteractive(keyArg, modelArg) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
async function promptHidden(prompt) {
|
|
135
|
+
function isByteStringSafe(s){
|
|
136
|
+
if (typeof s !== 'string') return false;
|
|
137
|
+
for (let i = 0; i < s.length; i++) {
|
|
138
|
+
if (s.charCodeAt(i) > 255) return false;
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
135
142
|
if (!process.stdin.isTTY) throw new Error('Interactive prompt required');
|
|
136
143
|
return new Promise((resolve, reject) => {
|
|
137
144
|
const stdin = process.stdin;
|
|
@@ -172,6 +179,10 @@ async function postScan(url, apiKey) {
|
|
|
172
179
|
const body = { url, source: 'cli', client: CLIENT_META };
|
|
173
180
|
const fetchFn = global.fetch;
|
|
174
181
|
if (typeof fetchFn !== 'function') throw new Error('Global fetch() is not available in this Node runtime. Use Node 18+');
|
|
182
|
+
// Validate header-safety to avoid undici/node fetch ByteString conversion errors
|
|
183
|
+
if (!isByteStringSafe(String(apiKey || ''))) {
|
|
184
|
+
throw new Error('API key contains unsupported characters (non-Latin-1). Re-run `subto login` and paste a plain ASCII API key.');
|
|
185
|
+
}
|
|
175
186
|
const res = await fetchFn(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}`, 'User-Agent': `${CLIENT_META.name}/${CLIENT_META.version}` }, body: JSON.stringify(body) });
|
|
176
187
|
const text = await res.text();
|
|
177
188
|
let data = null; try { data = text ? JSON.parse(text) : null; } catch (e) { data = text; }
|
|
@@ -481,7 +492,7 @@ async function startChatREPL(scanData){
|
|
|
481
492
|
|
|
482
493
|
async function run(argv) {
|
|
483
494
|
const program = new Command();
|
|
484
|
-
program.name('subto').description('Subto CLI — wrapper around Subto.One API').version(CLIENT_META.version || '8.0.
|
|
495
|
+
program.name('subto').description('Subto CLI — wrapper around Subto.One API').version(CLIENT_META.version || '8.0.1');
|
|
485
496
|
program.option('-v, --verbose', 'Show verbose HTTP logs');
|
|
486
497
|
program.option('--chat', 'Start local AI assistant (no command required)');
|
|
487
498
|
program.option('--no-auto-skip', 'Disable automatic skipping of external APIs when scans appear stuck');
|