@westbayberry/dg 1.0.35 → 1.0.37
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/index.mjs +43 -20
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -226,7 +226,7 @@ function loadDgrc() {
|
|
|
226
226
|
function validateApiUrl(url) {
|
|
227
227
|
try {
|
|
228
228
|
const parsed = new URL(url);
|
|
229
|
-
const isLocal = parsed.hostname === "localhost" || parsed.hostname.startsWith("127.");
|
|
229
|
+
const isLocal = parsed.hostname === "localhost" || parsed.hostname.startsWith("127.") || parsed.hostname.startsWith("100.") || parsed.hostname.startsWith("192.168.");
|
|
230
230
|
if (parsed.protocol !== "https:" && !isLocal) {
|
|
231
231
|
process.stderr.write(`Error: API URL must use HTTPS (got ${parsed.protocol}). Use localhost for local testing.
|
|
232
232
|
`);
|
|
@@ -40070,7 +40070,7 @@ __export(static_output_exports, {
|
|
|
40070
40070
|
function printTrialBanner(result) {
|
|
40071
40071
|
if (result.trialScansRemaining === void 0) return;
|
|
40072
40072
|
process.stderr.write(
|
|
40073
|
-
import_chalk4.default.dim(` Free tier \xB7 Run \`dg login\` for
|
|
40073
|
+
import_chalk4.default.dim(` Free tier \xB7 Run \`dg login\` for higher scan limits.
|
|
40074
40074
|
`)
|
|
40075
40075
|
);
|
|
40076
40076
|
}
|
|
@@ -40082,7 +40082,7 @@ function handleTrialExhausted2(error, jsonMode = false) {
|
|
|
40082
40082
|
hasKey = !!getStoredApiKey2();
|
|
40083
40083
|
} catch {
|
|
40084
40084
|
}
|
|
40085
|
-
const message = hasKey ? "Your API key may be invalid or expired. Run `dg logout` then `dg login` to re-authenticate." : "
|
|
40085
|
+
const message = hasKey ? "Your API key may be invalid or expired. Run `dg logout` then `dg login` to re-authenticate." : "Monthly scan limit reached. Run `dg login` to create a free account for higher limits.";
|
|
40086
40086
|
if (jsonMode) {
|
|
40087
40087
|
process.stdout.write(JSON.stringify({
|
|
40088
40088
|
error: true,
|
|
@@ -40099,7 +40099,7 @@ function handleTrialExhausted2(error, jsonMode = false) {
|
|
|
40099
40099
|
`));
|
|
40100
40100
|
} else {
|
|
40101
40101
|
process.stderr.write(
|
|
40102
|
-
import_chalk4.default.yellow("\n
|
|
40102
|
+
import_chalk4.default.yellow("\n Monthly scan limit reached (200 scans/month on free tier).\n") + import_chalk4.default.white(" Run `dg login` for higher limits, or upgrade at westbayberry.com/pricing\n\n")
|
|
40103
40103
|
);
|
|
40104
40104
|
}
|
|
40105
40105
|
}
|
|
@@ -40137,7 +40137,15 @@ function actionBadge(score) {
|
|
|
40137
40137
|
}
|
|
40138
40138
|
function renderResultStatic(result, config) {
|
|
40139
40139
|
if (config.json) {
|
|
40140
|
-
|
|
40140
|
+
const json = JSON.stringify(result, null, 2);
|
|
40141
|
+
const fs2 = __require("fs");
|
|
40142
|
+
const path = __require("path");
|
|
40143
|
+
const filename = `dg-scan-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`;
|
|
40144
|
+
const filepath = path.resolve(process.cwd(), filename);
|
|
40145
|
+
fs2.writeFileSync(filepath, json + "\n");
|
|
40146
|
+
process.stderr.write(import_chalk4.default.green(` Scan results saved to ${filename}
|
|
40147
|
+
`));
|
|
40148
|
+
return json;
|
|
40141
40149
|
}
|
|
40142
40150
|
const lines = [];
|
|
40143
40151
|
const actionStr = result.action.toUpperCase();
|
|
@@ -42778,7 +42786,7 @@ var init_InteractiveResultsView = __esm({
|
|
|
42778
42786
|
(durationMs / 1e3).toFixed(1),
|
|
42779
42787
|
"s"
|
|
42780
42788
|
] }),
|
|
42781
|
-
result.trialScansRemaining !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "Free tier \xB7 dg login for
|
|
42789
|
+
result.trialScansRemaining !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "Free tier \xB7 dg login for higher scan limits" })
|
|
42782
42790
|
] })
|
|
42783
42791
|
]
|
|
42784
42792
|
}
|
|
@@ -42902,14 +42910,14 @@ var init_InteractiveResultsView = __esm({
|
|
|
42902
42910
|
" of ",
|
|
42903
42911
|
discoveredTotal,
|
|
42904
42912
|
" packages ",
|
|
42905
|
-
import_chalk10.default.dim("\u2014
|
|
42913
|
+
import_chalk10.default.dim("\u2014 increase --max-packages for full scans")
|
|
42906
42914
|
] }),
|
|
42907
42915
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { justifyContent: "space-between", children: [
|
|
42908
42916
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
42909
42917
|
(durationMs / 1e3).toFixed(1),
|
|
42910
42918
|
"s"
|
|
42911
42919
|
] }),
|
|
42912
|
-
result.trialScansRemaining !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "Free tier \xB7 dg login for
|
|
42920
|
+
result.trialScansRemaining !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { dimColor: true, children: "Free tier \xB7 dg login for higher scan limits" })
|
|
42913
42921
|
] })
|
|
42914
42922
|
]
|
|
42915
42923
|
}
|
|
@@ -43000,15 +43008,6 @@ var init_InteractiveResultsView = __esm({
|
|
|
43000
43008
|
] }, `reason-${i}`)
|
|
43001
43009
|
);
|
|
43002
43010
|
}
|
|
43003
|
-
allLines.push(
|
|
43004
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { dimColor: true, children: [
|
|
43005
|
-
import_chalk10.default.yellow(" \u2192"),
|
|
43006
|
-
" ",
|
|
43007
|
-
import_chalk10.default.yellow("Upgrade to Pro"),
|
|
43008
|
-
" to see finding details ",
|
|
43009
|
-
import_chalk10.default.dim("\u2014 dg login")
|
|
43010
|
-
] }, "upgrade")
|
|
43011
|
-
);
|
|
43012
43011
|
}
|
|
43013
43012
|
for (let idx = 0; idx < visibleFindings.length; idx++) {
|
|
43014
43013
|
const f = visibleFindings[idx];
|
|
@@ -43492,6 +43491,19 @@ async function main() {
|
|
|
43492
43491
|
}
|
|
43493
43492
|
return;
|
|
43494
43493
|
}
|
|
43494
|
+
if (rawCommand === "status") {
|
|
43495
|
+
const { getStoredApiKey: getStoredApiKey2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
43496
|
+
const chalk10 = (await Promise.resolve().then(() => __toESM(require_source()))).default;
|
|
43497
|
+
const apiKey = getStoredApiKey2();
|
|
43498
|
+
if (apiKey) {
|
|
43499
|
+
process.stderr.write(chalk10.green(` Authenticated`) + chalk10.dim(` (key: ${apiKey.slice(0, 12)}...)
|
|
43500
|
+
`));
|
|
43501
|
+
} else {
|
|
43502
|
+
process.stderr.write(chalk10.yellow(` Not authenticated.`) + chalk10.dim(` Run \`dg login\` to sign in.
|
|
43503
|
+
`));
|
|
43504
|
+
}
|
|
43505
|
+
return;
|
|
43506
|
+
}
|
|
43495
43507
|
if (rawCommand === "hook") {
|
|
43496
43508
|
const { handleHookCommand: handleHookCommand2 } = await Promise.resolve().then(() => (init_hook(), hook_exports));
|
|
43497
43509
|
handleHookCommand2(process.argv.slice(3));
|
|
@@ -43502,13 +43514,24 @@ async function main() {
|
|
|
43502
43514
|
return;
|
|
43503
43515
|
}
|
|
43504
43516
|
if (rawCommand === "logout") {
|
|
43505
|
-
const { clearCredentials: clearCredentials2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
43506
|
-
clearCredentials2();
|
|
43517
|
+
const { getStoredApiKey: getStoredApiKey2, clearCredentials: clearCredentials2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
43507
43518
|
const chalk10 = (await Promise.resolve().then(() => __toESM(require_source()))).default;
|
|
43519
|
+
const apiKey = getStoredApiKey2();
|
|
43520
|
+
if (apiKey) {
|
|
43521
|
+
try {
|
|
43522
|
+
await fetch("https://api.westbayberry.com/v1/auth/revoke", {
|
|
43523
|
+
method: "POST",
|
|
43524
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
43525
|
+
signal: AbortSignal.timeout(5e3)
|
|
43526
|
+
});
|
|
43527
|
+
} catch {
|
|
43528
|
+
}
|
|
43529
|
+
}
|
|
43530
|
+
clearCredentials2();
|
|
43508
43531
|
process.stderr.write(chalk10.green(" Logged out.\n"));
|
|
43509
43532
|
return;
|
|
43510
43533
|
}
|
|
43511
|
-
const KNOWN_COMMANDS = ["scan", "npm", "pip", "wrap", "login", "
|
|
43534
|
+
const KNOWN_COMMANDS = ["scan", "npm", "pip", "wrap", "login", "logout", "status", "hook", "update"];
|
|
43512
43535
|
if (rawCommand && !rawCommand.startsWith("-") && !KNOWN_COMMANDS.includes(rawCommand)) {
|
|
43513
43536
|
const chalk10 = (await Promise.resolve().then(() => __toESM(require_source()))).default;
|
|
43514
43537
|
const best = closestCommand(rawCommand, KNOWN_COMMANDS);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@westbayberry/dg",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"description": "Supply chain security scanner for npm and Python dependencies — detects malicious packages, typosquatting, dependency confusion, and 26+ attack patterns",
|
|
5
5
|
"bin": {
|
|
6
6
|
"dependency-guardian": "dist/index.mjs",
|