@memrov2/pentcloud-reference 0.1.0 → 0.1.1-dev.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memrov2/pentcloud-reference",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-dev.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Cloudflare-native reference tool pack",
@@ -33,6 +33,6 @@
33
33
  "access": "public"
34
34
  },
35
35
  "dependencies": {
36
- "@memrov2/pentcloud-tool-runtime": "0.1.0"
36
+ "@memrov2/pentcloud-tool-runtime": "0.1.1-dev.0"
37
37
  }
38
38
  }
package/src/index.d.mts CHANGED
@@ -12,3 +12,5 @@ export declare function fetchReference(
12
12
  sha256: string;
13
13
  bytes: Uint8Array;
14
14
  }>;
15
+
16
+ export declare function referencePath(path: string): string;
package/src/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import lock from "../tools.lock.json" with { type: "json" };
2
2
  export { lock };
3
- export async function fetchReference(path, fetcher = fetch) {
3
+ export function referencePath(path) {
4
4
  if (typeof path === "string" && path.startsWith("/opt/exploitdb/"))
5
5
  path = path.slice("/opt/exploitdb/".length);
6
6
  if (
@@ -10,6 +10,10 @@ export async function fetchReference(path, fetcher = fetch) {
10
10
  path.split("/").some((p) => !p || p === "." || p === "..")
11
11
  )
12
12
  throw new TypeError("Select a pinned exploit reference path");
13
+ return path;
14
+ }
15
+ export async function fetchReference(path, fetcher = fetch) {
16
+ path = referencePath(path);
13
17
  const url =
14
18
  "https://gitlab.com/exploit-database/exploitdb/-/raw/" +
15
19
  lock.dataRevision +
package/src/worker.d.mts CHANGED
@@ -2,7 +2,9 @@ import { DurableObject } from "cloudflare:workers";
2
2
  import type { ToolResult } from "@memrov2/pentcloud-tool-runtime";
3
3
  import type { PackRequest } from "./index.mjs";
4
4
  export declare class ReferenceRunner extends DurableObject {
5
+ ready(): Promise<{ image: string; instance: "lite"; readyMs: number }>;
5
6
  run(input: PackRequest): Promise<ToolResult>;
7
+ retire(): Promise<{ stopped: boolean; retired: true }>;
6
8
  stop(): Promise<{ stopped: boolean }>;
7
9
  readSource(
8
10
  path: string,
package/src/worker.mjs CHANGED
@@ -2,7 +2,8 @@ import { createRunner } from "@memrov2/pentcloud-tool-runtime/worker";
2
2
  import { lock, buildCommand, fetchReference } from "./index.mjs";
3
3
  const Runtime = createRunner(lock, buildCommand);
4
4
  export class ReferenceRunner extends Runtime {
5
- readSource(path) {
5
+ async readSource(path) {
6
+ if(await this.ctx.storage.get("retired"))throw new Error("Owned tool runtime is retired");
6
7
  return fetchReference(path);
7
8
  }
8
9
  }