@synkro-sh/cli 1.5.4 → 1.5.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/dist/bootstrap.js +13 -11
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -1
package/dist/bootstrap.js
CHANGED
|
@@ -2861,28 +2861,31 @@ async function main() {
|
|
|
2861
2861
|
if (tName !== 'Bash' && tName !== 'Shell' && tName !== 'terminal' &&
|
|
2862
2862
|
tName !== 'run_terminal_cmd' && tName !== 'execute_command') return false;
|
|
2863
2863
|
// Reject any shell metacharacter that could turn a "read" into a write
|
|
2864
|
-
// or chain to an unsafe consumer
|
|
2865
|
-
//
|
|
2866
|
-
|
|
2864
|
+
// or chain to an unsafe consumer. Using string includes instead of a
|
|
2865
|
+
// regex because escaping inside a String.raw template literal is a
|
|
2866
|
+
// footgun (we got bitten by an unbalanced-paren regex once already).
|
|
2867
|
+
const UNSAFE_CHARS = ['>', ';', '&', '|', '\`'];
|
|
2868
|
+
for (const ch of UNSAFE_CHARS) { if (cmd.indexOf(ch) !== -1) return false; }
|
|
2869
|
+
const padded = ' ' + cmd + ' ';
|
|
2870
|
+
const UNSAFE_WORDS = [' sudo ', ' su ', ' rm ', ' mv ', ' cp ', ' chmod ', ' chown ', ' tee ', ' kill ', ' sed -i', ' sed --in-place', '\$('];
|
|
2871
|
+
for (const w of UNSAFE_WORDS) { if (padded.indexOf(w) !== -1) return false; }
|
|
2867
2872
|
const SAFE_VERBS = new Set([
|
|
2868
2873
|
'cat','head','tail','less','more','grep','egrep','fgrep','rg','ag',
|
|
2869
2874
|
'find','fd','ls','wc','cmp','diff','file','stat','which','whereis','type',
|
|
2870
2875
|
'pwd','whoami','id','date','echo','printf','env','true','false',
|
|
2871
2876
|
'jq','yq','awk','sort','uniq','cut','tr','xxd','hexdump','od','column',
|
|
2872
2877
|
'node','npm','pnpm','yarn','bun','python','python3','ruby','go','rustc','cargo',
|
|
2873
|
-
'git',
|
|
2878
|
+
'git','sed',
|
|
2874
2879
|
]);
|
|
2875
|
-
const tokens = cmd.trim().split(
|
|
2880
|
+
const tokens = cmd.trim().split(' ').filter(t => t.length > 0);
|
|
2876
2881
|
const verb = tokens[0] || '';
|
|
2877
2882
|
if (!SAFE_VERBS.has(verb)) return false;
|
|
2878
|
-
// For multi-mode tools, only allow read subcommands / version flags.
|
|
2879
2883
|
if (verb === 'git') {
|
|
2880
2884
|
const SAFE_GIT = new Set(['log','show','diff','blame','status','branch','tag','remote','config','rev-parse','ls-files','ls-tree','cat-file','shortlog','reflog','describe','symbolic-ref']);
|
|
2881
2885
|
const sub = tokens[1] || '';
|
|
2882
2886
|
return SAFE_GIT.has(sub);
|
|
2883
2887
|
}
|
|
2884
2888
|
if (['npm','pnpm','yarn','bun','cargo','go'].includes(verb)) {
|
|
2885
|
-
// Only allow plain version/info/list/why probes — block install/add/update/run/exec.
|
|
2886
2889
|
const sub = tokens[1] || '';
|
|
2887
2890
|
const SAFE_PKG = new Set(['--version','-v','version','list','ls','why','view','show','info','outdated','-h','--help','help']);
|
|
2888
2891
|
return SAFE_PKG.has(sub);
|
|
@@ -2891,8 +2894,7 @@ async function main() {
|
|
|
2891
2894
|
const sub = tokens[1] || '';
|
|
2892
2895
|
return sub === '--version' || sub === '-v' || sub === '-V';
|
|
2893
2896
|
}
|
|
2894
|
-
// sed without -i
|
|
2895
|
-
// sed -i above. Anything else with a SAFE_VERB and no metachars is fine.
|
|
2897
|
+
// sed: only safe without -i (we filtered that above).
|
|
2896
2898
|
return true;
|
|
2897
2899
|
}
|
|
2898
2900
|
|
|
@@ -5852,7 +5854,7 @@ function writeConfigEnv(opts) {
|
|
|
5852
5854
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
5853
5855
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
5854
5856
|
`SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
|
|
5855
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.5.
|
|
5857
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.5.5")}`
|
|
5856
5858
|
];
|
|
5857
5859
|
if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
|
|
5858
5860
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
@@ -7242,7 +7244,7 @@ var args = process.argv.slice(2);
|
|
|
7242
7244
|
var cmd = args[0] || "";
|
|
7243
7245
|
var subArgs = args.slice(1);
|
|
7244
7246
|
function printVersion() {
|
|
7245
|
-
console.log("1.5.
|
|
7247
|
+
console.log("1.5.5");
|
|
7246
7248
|
}
|
|
7247
7249
|
function printHelp() {
|
|
7248
7250
|
console.log(`Synkro CLI \u2014 runtime safety for AI coding agents
|