Skip to content

Commit 417277a

Browse files
committed
chore: sync dist
1 parent dcd0594 commit 417277a

2 files changed

Lines changed: 10 additions & 20 deletions

File tree

dist/bin/cc-safety-net.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,10 +1580,6 @@ function splitShellCommands(command) {
15801580
let i = 0;
15811581
while (i < tokens.length) {
15821582
const token = tokens[i];
1583-
if (token === undefined) {
1584-
i++;
1585-
continue;
1586-
}
15871583
if (isOperator(token)) {
15881584
if (current.length > 0) {
15891585
segments.push(current);
@@ -1714,9 +1710,6 @@ function parseEnvAssignment(token) {
17141710
return null;
17151711
}
17161712
const eqIdx = token.indexOf("=");
1717-
if (eqIdx < 0) {
1718-
return null;
1719-
}
17201713
return { name: token.slice(0, eqIdx), value: token.slice(eqIdx + 1) };
17211714
}
17221715
function stripEnvAssignmentsWithInfo(tokens) {
@@ -2736,6 +2729,7 @@ function parseParallelCommand(tokens) {
27362729

27372730
// src/core/analyze/tmpdir.ts
27382731
import { tmpdir as tmpdir2 } from "node:os";
2732+
import { normalize as normalize2, sep as sep2 } from "node:path";
27392733
function isTmpdirOverriddenToNonTemp(envAssignments) {
27402734
if (!envAssignments.has("TMPDIR")) {
27412735
return false;
@@ -2744,8 +2738,9 @@ function isTmpdirOverriddenToNonTemp(envAssignments) {
27442738
if (tmpdirValue === "") {
27452739
return true;
27462740
}
2747-
const sysTmpdir = tmpdir2();
2748-
if (isPathOrSubpath(tmpdirValue, "/tmp") || isPathOrSubpath(tmpdirValue, "/var/tmp") || isPathOrSubpath(tmpdirValue, sysTmpdir)) {
2741+
const normalizedTmpdirValue = normalize2(tmpdirValue);
2742+
const sysTmpdir = normalize2(tmpdir2());
2743+
if (isPathOrSubpath(normalizedTmpdirValue, normalize2("/tmp")) || isPathOrSubpath(normalizedTmpdirValue, normalize2("/var/tmp")) || isPathOrSubpath(normalizedTmpdirValue, sysTmpdir)) {
27492744
return false;
27502745
}
27512746
return true;
@@ -2754,7 +2749,7 @@ function isPathOrSubpath(path, basePath) {
27542749
if (path === basePath) {
27552750
return true;
27562751
}
2757-
const baseWithSlash = basePath.endsWith("/") ? basePath : `${basePath}/`;
2752+
const baseWithSlash = basePath.endsWith(sep2) ? basePath : `${basePath}${sep2}`;
27582753
return path.startsWith(baseWithSlash);
27592754
}
27602755

dist/index.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,6 @@ function splitShellCommands(command) {
441441
let i = 0;
442442
while (i < tokens.length) {
443443
const token = tokens[i];
444-
if (token === undefined) {
445-
i++;
446-
continue;
447-
}
448444
if (isOperator(token)) {
449445
if (current.length > 0) {
450446
segments.push(current);
@@ -575,9 +571,6 @@ function parseEnvAssignment(token) {
575571
return null;
576572
}
577573
const eqIdx = token.indexOf("=");
578-
if (eqIdx < 0) {
579-
return null;
580-
}
581574
return { name: token.slice(0, eqIdx), value: token.slice(eqIdx + 1) };
582575
}
583576
function stripEnvAssignmentsWithInfo(tokens) {
@@ -1597,6 +1590,7 @@ function parseParallelCommand(tokens) {
15971590

15981591
// src/core/analyze/tmpdir.ts
15991592
import { tmpdir as tmpdir2 } from "node:os";
1593+
import { normalize as normalize2, sep as sep2 } from "node:path";
16001594
function isTmpdirOverriddenToNonTemp(envAssignments) {
16011595
if (!envAssignments.has("TMPDIR")) {
16021596
return false;
@@ -1605,8 +1599,9 @@ function isTmpdirOverriddenToNonTemp(envAssignments) {
16051599
if (tmpdirValue === "") {
16061600
return true;
16071601
}
1608-
const sysTmpdir = tmpdir2();
1609-
if (isPathOrSubpath(tmpdirValue, "/tmp") || isPathOrSubpath(tmpdirValue, "/var/tmp") || isPathOrSubpath(tmpdirValue, sysTmpdir)) {
1602+
const normalizedTmpdirValue = normalize2(tmpdirValue);
1603+
const sysTmpdir = normalize2(tmpdir2());
1604+
if (isPathOrSubpath(normalizedTmpdirValue, normalize2("/tmp")) || isPathOrSubpath(normalizedTmpdirValue, normalize2("/var/tmp")) || isPathOrSubpath(normalizedTmpdirValue, sysTmpdir)) {
16101605
return false;
16111606
}
16121607
return true;
@@ -1615,7 +1610,7 @@ function isPathOrSubpath(path, basePath) {
16151610
if (path === basePath) {
16161611
return true;
16171612
}
1618-
const baseWithSlash = basePath.endsWith("/") ? basePath : `${basePath}/`;
1613+
const baseWithSlash = basePath.endsWith(sep2) ? basePath : `${basePath}${sep2}`;
16191614
return path.startsWith(baseWithSlash);
16201615
}
16211616

0 commit comments

Comments
 (0)