@agenticcli/shipguard 0.3.0 → 0.4.0
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"secrets": "
|
|
3
|
-
"auth": "
|
|
4
|
-
"database": "
|
|
5
|
-
"deployment": "
|
|
6
|
-
"payments": "
|
|
2
|
+
"secrets": "cf2f74188b62c5b15dff3e9b16f768503e51e1a7584a9a63bfc35d884cf04180",
|
|
3
|
+
"auth": "cf2f74188b62c5b15dff3e9b16f768503e51e1a7584a9a63bfc35d884cf04180",
|
|
4
|
+
"database": "cf2f74188b62c5b15dff3e9b16f768503e51e1a7584a9a63bfc35d884cf04180",
|
|
5
|
+
"deployment": "cf2f74188b62c5b15dff3e9b16f768503e51e1a7584a9a63bfc35d884cf04180",
|
|
6
|
+
"payments": "cf2f74188b62c5b15dff3e9b16f768503e51e1a7584a9a63bfc35d884cf04180"
|
|
7
7
|
}
|
|
@@ -2809,6 +2809,13 @@ function applySuppressions(findings, files) {
|
|
|
2809
2809
|
import { RE2JS as RE2JS2 } from "re2js";
|
|
2810
2810
|
var activeExecutor = re2jsV1Executor;
|
|
2811
2811
|
var DEFAULT_FLOOR_PATH = path2.join(os.homedir(), ".shipguard", "release-floor.json");
|
|
2812
|
+
var NoRulesAppliedError = class extends Error {
|
|
2813
|
+
code = "NO_RULES_APPLIED";
|
|
2814
|
+
constructor(message) {
|
|
2815
|
+
super(message);
|
|
2816
|
+
this.name = "NoRulesAppliedError";
|
|
2817
|
+
}
|
|
2818
|
+
};
|
|
2812
2819
|
async function fetchProRules(frameworks, categories, apiUrl, scanId, floorPath) {
|
|
2813
2820
|
assertTrustedApiUrl(apiUrl);
|
|
2814
2821
|
const token = await getAuthToken();
|
|
@@ -2823,6 +2830,21 @@ async function fetchProRules(frameworks, categories, apiUrl, scanId, floorPath)
|
|
|
2823
2830
|
});
|
|
2824
2831
|
if (res.status === 401) throw new Error("Auth expired. Run `shipguard login` again.");
|
|
2825
2832
|
if (res.status === 402) throw new Error("No credits. Buy at https://agenticcli.dev/dashboard/billing");
|
|
2833
|
+
if (res.status === 422) {
|
|
2834
|
+
let detail = res.statusText;
|
|
2835
|
+
try {
|
|
2836
|
+
const body = await res.json();
|
|
2837
|
+
if (body?.code === "NO_RULES_APPLIED") {
|
|
2838
|
+
throw new NoRulesAppliedError(
|
|
2839
|
+
body.error ?? "Pro rule fetch resolved zero rules \u2014 the scan checked nothing (fail-closed). This is NOT a clean pass."
|
|
2840
|
+
);
|
|
2841
|
+
}
|
|
2842
|
+
detail = body?.error ?? detail;
|
|
2843
|
+
} catch (err) {
|
|
2844
|
+
if (err instanceof NoRulesAppliedError) throw err;
|
|
2845
|
+
}
|
|
2846
|
+
throw new Error(`Rule fetch failed (422): ${detail}`);
|
|
2847
|
+
}
|
|
2826
2848
|
if (!res.ok) throw new Error(`Rule fetch failed: ${res.statusText}`);
|
|
2827
2849
|
const credits = parseInt(res.headers.get("X-Credits-Remaining") ?? "0", 10);
|
|
2828
2850
|
const rulesVersion = res.headers.get("X-Rules-Version") ?? void 0;
|
|
@@ -3135,6 +3157,7 @@ export {
|
|
|
3135
3157
|
getAuthToken,
|
|
3136
3158
|
loadChecksumManifest,
|
|
3137
3159
|
applySuppressions,
|
|
3160
|
+
NoRulesAppliedError,
|
|
3138
3161
|
fetchProRules,
|
|
3139
3162
|
validateBundleCompile,
|
|
3140
3163
|
RunProRulesFatalError,
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.4.0",
|
|
3
|
+
"packageName": "@agenticcli/shipguard",
|
|
4
|
+
"nodeEngine": ">=20",
|
|
5
|
+
"exitCodes": {
|
|
6
|
+
"SAFE": 0,
|
|
7
|
+
"BLOCKED": 1,
|
|
8
|
+
"CONFIG_ERROR": 2,
|
|
9
|
+
"RUNTIME_ERROR": 3
|
|
10
|
+
},
|
|
11
|
+
"freeModules": [
|
|
12
|
+
"secrets",
|
|
13
|
+
"auth",
|
|
14
|
+
"database",
|
|
15
|
+
"payments",
|
|
16
|
+
"deployment"
|
|
17
|
+
],
|
|
18
|
+
"freeRuleIds": [
|
|
19
|
+
"hardcoded_secret",
|
|
20
|
+
"secrets",
|
|
21
|
+
"exposed_env",
|
|
22
|
+
"auth",
|
|
23
|
+
"public_admin_route",
|
|
24
|
+
"auth_route_without_guard",
|
|
25
|
+
"db-drop-table",
|
|
26
|
+
"db-drop-column",
|
|
27
|
+
"db-truncate",
|
|
28
|
+
"db-delete-without-where",
|
|
29
|
+
"db-alter-drop",
|
|
30
|
+
"db-push-in-scripts",
|
|
31
|
+
"db-schema-without-migration",
|
|
32
|
+
"database",
|
|
33
|
+
"payments",
|
|
34
|
+
"payment_webhook_without_signature_check",
|
|
35
|
+
"missing_idempotency",
|
|
36
|
+
"missing_error_handling",
|
|
37
|
+
"deployment",
|
|
38
|
+
"deployment_cors_wildcard",
|
|
39
|
+
"deployment_source_maps_exposed",
|
|
40
|
+
"deployment_missing_x_frame_options",
|
|
41
|
+
"deployment_missing_x_content_type",
|
|
42
|
+
"deployment_docker_root_user",
|
|
43
|
+
"deployment_docker_unpinned_image",
|
|
44
|
+
"deployment_compose_unpinned_image",
|
|
45
|
+
"deployment_vercel_broad_rewrite",
|
|
46
|
+
"deployment_vercel_missing_headers",
|
|
47
|
+
"deployment_netlify_missing_headers",
|
|
48
|
+
"deployment_missing_env_example",
|
|
49
|
+
"deployment_env_undocumented_keys",
|
|
50
|
+
"deployment_config_cors_wildcard_origin",
|
|
51
|
+
"deployment_config_debug_mode"
|
|
52
|
+
],
|
|
53
|
+
"freeRuleCount": 33,
|
|
54
|
+
"jsonSchemaFields": [
|
|
55
|
+
"findings",
|
|
56
|
+
"riskScore",
|
|
57
|
+
"filesScanned",
|
|
58
|
+
"timestamp",
|
|
59
|
+
"policyUsed",
|
|
60
|
+
"recommendation",
|
|
61
|
+
"rulesApplied",
|
|
62
|
+
"rulesBreakdown",
|
|
63
|
+
"schemaVersion",
|
|
64
|
+
"degraded",
|
|
65
|
+
"degradedReasons",
|
|
66
|
+
"creditsWarning",
|
|
67
|
+
"rulesVersion",
|
|
68
|
+
"aiCodeIssues"
|
|
69
|
+
],
|
|
70
|
+
"schemaVersion": "0.4",
|
|
71
|
+
"degradeCodes": [
|
|
72
|
+
"FILE_TOO_LARGE",
|
|
73
|
+
"OUTPUT_TRUNCATED",
|
|
74
|
+
"CODEREF_SKIPPED",
|
|
75
|
+
"PRO_RULES_UNAVAILABLE",
|
|
76
|
+
"INVALID_UTF8",
|
|
77
|
+
"UNREADABLE_FILE",
|
|
78
|
+
"COMPILE_FAILURE"
|
|
79
|
+
],
|
|
80
|
+
"severities": [
|
|
81
|
+
"info",
|
|
82
|
+
"low",
|
|
83
|
+
"medium",
|
|
84
|
+
"high",
|
|
85
|
+
"critical"
|
|
86
|
+
],
|
|
87
|
+
"categories": [
|
|
88
|
+
"secrets",
|
|
89
|
+
"auth",
|
|
90
|
+
"payments",
|
|
91
|
+
"database",
|
|
92
|
+
"deployment",
|
|
93
|
+
"injection",
|
|
94
|
+
"supply-chain",
|
|
95
|
+
"crypto",
|
|
96
|
+
"config"
|
|
97
|
+
],
|
|
98
|
+
"installSnippet": "npx @agenticcli/shipguard scan --changed --strict --json",
|
|
99
|
+
"re2Engine": true,
|
|
100
|
+
"generatedAt": "2026-06-25T23:16:56.961Z"
|
|
101
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
runProRulesWithDispatch,
|
|
15
15
|
saveCredentials,
|
|
16
16
|
secretsCheck
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-XOWMKGOE.js";
|
|
18
18
|
import {
|
|
19
19
|
DEFAULT_MAX_FILES,
|
|
20
20
|
DEFAULT_MAX_FILE_SIZE_BYTES,
|
|
@@ -1176,7 +1176,7 @@ function sendTelemetry(payload) {
|
|
|
1176
1176
|
|
|
1177
1177
|
// src/commands/scan.ts
|
|
1178
1178
|
var LEARN_MORE = "Docs https://agenticcli.dev/docs \xB7 Site https://agenticcli.dev \xB7 Pricing https://agenticcli.dev/pricing \xB7 Issues https://github.com/agenticcli/shipguard/issues";
|
|
1179
|
-
var CLI_VERSION = true ? "0.
|
|
1179
|
+
var CLI_VERSION = true ? "0.4.0" : process.env.npm_package_version ?? "0.0.0-dev";
|
|
1180
1180
|
function resolveExitCode(opts) {
|
|
1181
1181
|
if (opts.strict && opts.blockingCount > 0) {
|
|
1182
1182
|
return EXIT_CODES.BLOCKED;
|
|
@@ -1283,7 +1283,7 @@ async function runScan(ctx) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
try {
|
|
1285
1285
|
const { detectFrameworks } = await import("./framework-PA6RVE7G.js");
|
|
1286
|
-
const { fetchProRules } = await import("./pro-scanner-
|
|
1286
|
+
const { fetchProRules } = await import("./pro-scanner-ENFCTA4R.js");
|
|
1287
1287
|
const { hasConfig, generateConfig } = await import("./config-generator-RMWNQQHW.js");
|
|
1288
1288
|
const detectedResult = detectFrameworks(cwd);
|
|
1289
1289
|
const { frameworks } = detectedResult;
|
|
@@ -1319,6 +1319,16 @@ async function runScan(ctx) {
|
|
|
1319
1319
|
}
|
|
1320
1320
|
} catch (err) {
|
|
1321
1321
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1322
|
+
const isNoRulesApplied = err instanceof Error && err.name === "NoRulesAppliedError" || err?.code === "NO_RULES_APPLIED";
|
|
1323
|
+
if (isNoRulesApplied) {
|
|
1324
|
+
if (!machineOutput) {
|
|
1325
|
+
logger.error(`Pro rules unavailable (fail-closed): ${errMsg}`);
|
|
1326
|
+
logger.error("This scan applied ZERO rules \u2014 it checked nothing. Refusing to report a clean pass.");
|
|
1327
|
+
} else {
|
|
1328
|
+
console.log(JSON.stringify({ error: errMsg, code: "NO_RULES_APPLIED" }));
|
|
1329
|
+
}
|
|
1330
|
+
process.exit(EXIT_CODES.RUNTIME_ERROR);
|
|
1331
|
+
}
|
|
1322
1332
|
logger.warn(`Pro rules unavailable: ${errMsg}`);
|
|
1323
1333
|
logger.warn("Degrading to free scan \u2014 pro rules will not be applied");
|
|
1324
1334
|
degraded = true;
|
|
@@ -1732,7 +1742,7 @@ if (rawArgs[0] === "?") {
|
|
|
1732
1742
|
process.argv = [process.argv[0], process.argv[1], "help"];
|
|
1733
1743
|
}
|
|
1734
1744
|
program.name("shipguard").description("CLI-first release gate for AI-built apps").version(
|
|
1735
|
-
true ? "0.
|
|
1745
|
+
true ? "0.4.0" : process.env.npm_package_version ?? "0.0.0-dev"
|
|
1736
1746
|
).helpCommand(false).addHelpText("after", `
|
|
1737
1747
|
Learn more:
|
|
1738
1748
|
Docs https://agenticcli.dev/docs
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NoRulesAppliedError,
|
|
2
3
|
RunProRulesFatalError,
|
|
3
4
|
fetchProRules,
|
|
4
5
|
runProRules,
|
|
5
6
|
runProRulesWithDispatch,
|
|
6
7
|
validateBundleCompile
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XOWMKGOE.js";
|
|
8
9
|
import "./chunk-ANTCYKRO.js";
|
|
9
10
|
export {
|
|
11
|
+
NoRulesAppliedError,
|
|
10
12
|
RunProRulesFatalError,
|
|
11
13
|
fetchProRules,
|
|
12
14
|
runProRules,
|