cantarella-framework 1.1.0 → 1.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.0
4
+
5
+ - New native modules: CORS checker, JWT inspector, password strength estimator, and RDAP domain lookup.
6
+
3
7
  ## 1.1.0
4
8
 
5
9
  - New modules: evidence indexer, workflow plan validator, Exploit-DB reference search through searchsploit, and cookie security checker.
@@ -0,0 +1,32 @@
1
+ let input = "";
2
+ process.stdin.setEncoding("utf8");
3
+ process.stdin.on("data", (chunk) => (input += chunk));
4
+ process.stdin.on("end", () => {
5
+ const request = JSON.parse(input || "{}");
6
+ const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
7
+ const parts = String(request.target ?? "").trim().split(".");
8
+ if (parts.length !== 3) {
9
+ emit({ type: "error", message: "Target must be a JWT with three dot-separated parts." });
10
+ process.exitCode = 1;
11
+ return;
12
+ }
13
+ try {
14
+ const decode = (part) => JSON.parse(Buffer.from(part, "base64url").toString("utf8"));
15
+ const header = decode(parts[0]);
16
+ const payload = decode(parts[1]);
17
+ const expiresAt = payload.exp ? new Date(payload.exp * 1000).toISOString() : null;
18
+ const expired = payload.exp ? payload.exp * 1000 < Date.now() : null;
19
+ if (header.alg === "none") {
20
+ emit({ type: "finding", title: "JWT uses alg none", severity: "high", description: "The token header declares no signature algorithm." });
21
+ }
22
+ emit({
23
+ type: "result",
24
+ summary: `JWT alg ${header.alg ?? "unknown"}, expires ${expiresAt ?? "not set"}${expired ? " (expired)" : ""}.`,
25
+ data: { header, payload, expires_at: expiresAt, expired, signature_present: Boolean(parts[2]) },
26
+ });
27
+ emit({ type: "done", summary: "JWT inspection finished." });
28
+ } catch (error) {
29
+ emit({ type: "error", message: `JWT inspection failed: ${error.message}` });
30
+ process.exitCode = 1;
31
+ }
32
+ });
@@ -0,0 +1,14 @@
1
+ {
2
+ "schema_version": 1,
3
+ "id": "api/jwt-inspector",
4
+ "name": "JWT Inspector",
5
+ "version": "0.1.0",
6
+ "category": "api",
7
+ "kind": "native",
8
+ "risk": "info",
9
+ "description": "Decodes a JWT header and payload and reports expiry without verifying the signature.",
10
+ "entry": "index.mjs",
11
+ "core_api": "^0.1.0",
12
+ "maintenance": "active",
13
+ "options": []
14
+ }
@@ -0,0 +1,28 @@
1
+ let input = "";
2
+ process.stdin.setEncoding("utf8");
3
+ process.stdin.on("data", (chunk) => (input += chunk));
4
+ process.stdin.on("end", () => {
5
+ const request = JSON.parse(input || "{}");
6
+ const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
7
+ const password = String(request.target ?? "");
8
+ const classes = {
9
+ lowercase: /[a-z]/.test(password),
10
+ uppercase: /[A-Z]/.test(password),
11
+ digits: /\d/.test(password),
12
+ symbols: /[^A-Za-z0-9]/.test(password),
13
+ };
14
+ const variety = Object.values(classes).filter(Boolean).length;
15
+ let score = 0;
16
+ if (password.length >= 8) score += 1;
17
+ if (password.length >= 12) score += 1;
18
+ if (password.length >= 16) score += 1;
19
+ if (variety >= 3) score += 1;
20
+ if (variety === 4 && password.length >= 12) score += 1;
21
+ const labels = ["very weak", "weak", "fair", "good", "strong", "excellent"];
22
+ emit({
23
+ type: "result",
24
+ summary: `Password strength: ${labels[score]} (${score}/5), length ${password.length}.`,
25
+ data: { length: password.length, classes, score, label: labels[score] },
26
+ });
27
+ emit({ type: "done", summary: "Password strength check finished." });
28
+ });
@@ -0,0 +1,14 @@
1
+ {
2
+ "schema_version": 1,
3
+ "id": "password/password-strength",
4
+ "name": "Password Strength",
5
+ "version": "0.1.0",
6
+ "category": "password",
7
+ "kind": "native",
8
+ "risk": "info",
9
+ "description": "Estimates password strength from length and character variety.",
10
+ "entry": "index.mjs",
11
+ "core_api": "^0.1.0",
12
+ "maintenance": "active",
13
+ "options": []
14
+ }
@@ -0,0 +1,31 @@
1
+ let input = "";
2
+ process.stdin.setEncoding("utf8");
3
+ process.stdin.on("data", (chunk) => (input += chunk));
4
+ process.stdin.on("end", async () => {
5
+ const request = JSON.parse(input || "{}");
6
+ const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
7
+ const domain = String(request.target ?? "").replace(/^https?:\/\//, "").split("/")[0].toLowerCase();
8
+ try {
9
+ const response = await fetch(`https://rdap.org/domain/${encodeURIComponent(domain)}`, {
10
+ signal: AbortSignal.timeout(10000),
11
+ });
12
+ if (!response.ok) throw new Error(`RDAP returned HTTP ${response.status}`);
13
+ const body = await response.json();
14
+ const events = Object.fromEntries((body.events ?? []).map((event) => [event.eventAction, event.eventDate]));
15
+ emit({
16
+ type: "result",
17
+ summary: `${domain}: registered ${events.registration ?? "unknown"}, expires ${events.expiration ?? "unknown"}.`,
18
+ data: {
19
+ domain,
20
+ handle: body.handle,
21
+ status: body.status,
22
+ nameservers: body.nameservers?.map((item) => item.ldhName),
23
+ events,
24
+ },
25
+ });
26
+ emit({ type: "done", summary: "RDAP lookup finished." });
27
+ } catch (error) {
28
+ emit({ type: "error", message: `RDAP lookup failed: ${error.message}` });
29
+ process.exitCode = 1;
30
+ }
31
+ });
@@ -0,0 +1,14 @@
1
+ {
2
+ "schema_version": 1,
3
+ "id": "recon/rdap-lookup",
4
+ "name": "RDAP Lookup",
5
+ "version": "0.1.0",
6
+ "category": "recon",
7
+ "kind": "native",
8
+ "risk": "low",
9
+ "description": "Looks up domain registration data through RDAP.",
10
+ "entry": "index.mjs",
11
+ "core_api": "^0.1.0",
12
+ "maintenance": "active",
13
+ "options": []
14
+ }
@@ -0,0 +1,45 @@
1
+ let input = "";
2
+ process.stdin.setEncoding("utf8");
3
+ process.stdin.on("data", (chunk) => (input += chunk));
4
+ process.stdin.on("end", async () => {
5
+ const request = JSON.parse(input || "{}");
6
+ const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
7
+ const target = /^https?:\/\//.test(request.target) ? request.target : `https://${request.target}`;
8
+ try {
9
+ const response = await fetch(target, {
10
+ method: "OPTIONS",
11
+ headers: {
12
+ Origin: "https://example.com",
13
+ "Access-Control-Request-Method": "GET",
14
+ },
15
+ redirect: "manual",
16
+ signal: AbortSignal.timeout(8000),
17
+ });
18
+ const allowOrigin = response.headers.get("access-control-allow-origin");
19
+ const allowCredentials = response.headers.get("access-control-allow-credentials");
20
+ if (allowOrigin === "*" && allowCredentials === "true") {
21
+ emit({
22
+ type: "finding",
23
+ title: "Wildcard CORS with credentials",
24
+ severity: "medium",
25
+ description: "The response allows any origin while also allowing credentials.",
26
+ });
27
+ }
28
+ emit({
29
+ type: "result",
30
+ summary: `${target} CORS allow-origin: ${allowOrigin ?? "not set"}.`,
31
+ data: {
32
+ url: target,
33
+ status: response.status,
34
+ allow_origin: allowOrigin,
35
+ allow_credentials: allowCredentials,
36
+ allow_methods: response.headers.get("access-control-allow-methods"),
37
+ allow_headers: response.headers.get("access-control-allow-headers"),
38
+ },
39
+ });
40
+ emit({ type: "done", summary: "CORS check finished." });
41
+ } catch (error) {
42
+ emit({ type: "error", message: `CORS check failed: ${error.message}` });
43
+ process.exitCode = 1;
44
+ }
45
+ });
@@ -0,0 +1,14 @@
1
+ {
2
+ "schema_version": 1,
3
+ "id": "web/cors-checker",
4
+ "name": "CORS Checker",
5
+ "version": "0.1.0",
6
+ "category": "web",
7
+ "kind": "native",
8
+ "risk": "low",
9
+ "description": "Checks CORS response headers for a web origin.",
10
+ "entry": "index.mjs",
11
+ "core_api": "^0.1.0",
12
+ "maintenance": "active",
13
+ "options": []
14
+ }
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "release:notes": "node scripts/release-notes.mjs"
20
20
  },
21
21
  "type": "module",
22
- "version": "1.1.0",
22
+ "version": "1.2.0",
23
23
  "workspaces": [
24
24
  "packages/*"
25
25
  ],
@@ -11,7 +11,7 @@ process.stdout.on("error", (error) => {
11
11
  process.exit(0);
12
12
  throw error;
13
13
  });
14
- const VERSION = "1.1.0";
14
+ const VERSION = "1.2.0";
15
15
  const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
16
16
  function banner() {
17
17
  return (process.stdout.columns ?? 80) >= 72 ? BANNER : COMPACT_BANNER;
@@ -78,8 +78,8 @@ export function createGuiServer(root) {
78
78
  }
79
79
  }
80
80
  sendJson(response, 200, {
81
- version: "1.1.0",
82
- update_message: (await checkForUpdate("1.1.0")).message,
81
+ version: "1.2.0",
82
+ update_message: (await checkForUpdate("1.2.0")).message,
83
83
  categories: CATEGORIES,
84
84
  modules: modules.map(({ manifest }) => manifest),
85
85
  external_tools: [...tools.values()],