@chain305/x-security 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/bin/xsecurity.mjs +20 -7
  2. package/package.json +6 -1
package/bin/xsecurity.mjs CHANGED
@@ -46718,12 +46718,12 @@ var require_dist_cjs15 = __commonJS({
46718
46718
  }
46719
46719
  return ["md/nodejs", node_process.versions.node];
46720
46720
  };
46721
- var getNodeModulesParentDirs = (dirname4) => {
46721
+ var getNodeModulesParentDirs = (dirname5) => {
46722
46722
  const cwd = process.cwd();
46723
- if (!dirname4) {
46723
+ if (!dirname5) {
46724
46724
  return [cwd];
46725
46725
  }
46726
- const normalizedPath = node_path.normalize(dirname4);
46726
+ const normalizedPath = node_path.normalize(dirname5);
46727
46727
  const parts = normalizedPath.split(node_path.sep);
46728
46728
  const nodeModulesIndex = parts.indexOf("node_modules");
46729
46729
  const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(node_path.sep) : normalizedPath;
@@ -46771,8 +46771,8 @@ var require_dist_cjs15 = __commonJS({
46771
46771
  tscVersion = null;
46772
46772
  return void 0;
46773
46773
  }
46774
- const dirname4 = typeof __dirname !== "undefined" ? __dirname : void 0;
46775
- const nodeModulesParentDirs = getNodeModulesParentDirs(dirname4);
46774
+ const dirname5 = typeof __dirname !== "undefined" ? __dirname : void 0;
46775
+ const nodeModulesParentDirs = getNodeModulesParentDirs(dirname5);
46776
46776
  let versionFromApp;
46777
46777
  for (const nodeModulesParentDir of nodeModulesParentDirs) {
46778
46778
  try {
@@ -74421,8 +74421,21 @@ var init_byo_commands = __esm({
74421
74421
 
74422
74422
  // src/bin/lazy.ts
74423
74423
  var lazy_exports = {};
74424
- import { basename as basename2 } from "node:path";
74424
+ import { readFileSync as readFileSync4 } from "node:fs";
74425
+ import { basename as basename2, dirname as dirname4, join as join12 } from "node:path";
74426
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
74425
74427
  import { Command as Command2 } from "commander";
74428
+ function resolveVersion() {
74429
+ const here = dirname4(fileURLToPath2(import.meta.url));
74430
+ for (const rel of ["../package.json", "../../package.json"]) {
74431
+ try {
74432
+ const v = JSON.parse(readFileSync4(join12(here, rel), "utf8")).version;
74433
+ if (typeof v === "string") return v;
74434
+ } catch {
74435
+ }
74436
+ }
74437
+ return "0.0.0";
74438
+ }
74426
74439
  var program;
74427
74440
  var init_lazy = __esm({
74428
74441
  "src/bin/lazy.ts"() {
@@ -74441,7 +74454,7 @@ var init_lazy = __esm({
74441
74454
  init_byo_commands();
74442
74455
  init_dist4();
74443
74456
  program = new Command2();
74444
- program.name(basename2(process.argv[1] ?? "lazy").replace(/\.(mjs|cjs|js)$/, "")).description("Compile, validate, test, and report on x-security policies in OpenAPI specs.").version("0.1.0");
74457
+ program.name(basename2(process.argv[1] ?? "lazy").replace(/\.(mjs|cjs|js)$/, "")).description("Compile, validate, test, and report on x-security policies in OpenAPI specs.").version(resolveVersion());
74445
74458
  program.command("generate <spec>").description("Compile an annotated OpenAPI spec into target-specific gateway config.").requiredOption("--target <name>", "Target: kong|coraza|bunkerweb|openappsec|firewall").option("--out <dir>", "Output directory (default: ./writ-out/<target>)").option("--dry-run", "Print planned artifacts without writing to disk").option("--no-strict", "Allow unresolved variables (default: strict)").option("--vault", "Resolve $vault.* refs via HashiCorp Vault (uses VAULT_ADDR + VAULT_TOKEN or AppRole)").option("--aws-secrets", "Resolve $aws.* refs via AWS Secrets Manager (uses default credential chain + AWS_REGION)").option("--vault-kv-version <v>", "Vault KV engine version: 1 or 2 (default 2)", (v) => v === "1" ? 1 : 2).option("--no-with-consumers", "Kong only: emit spec-only output (omit consumers + per-plugin credentials). Consumers are emitted by default so OSS Kong gateways actually authenticate; pass this for the spec-only baseline.").option("--kong-deployment <mode>", "Kong only: standalone|behind-proxy|with-coraza|with-istio. with-coraza rewrites all service URLs to http://coraza:8080.", "standalone").option("--kong-edition <edition>", "Kong only: oss|enterprise. enterprise emits openid-connect (real JWKS+RS256) instead of HS256 jwt_secrets downgrade.", "oss").option("--kong-dbless", "Kong only: deployment runs in DB-less mode (KONG_DATABASE=off). Per-identity rate-limits fall back to policy=local with a structured warning instead of policy=cluster.", false).option("--kong-policy <mode>", "Kong only: rate-limit policy. local|cluster. Default local (safe for OSS DB-less). Pass cluster only when Kong is running in database mode (postgres/cassandra); cluster is a boot error in DB-less Kong.", "local").option("--coraza-engine <name>", "Coraza only: modsec-nginx|modsec-apache|coraza-go|coraza-spoa (default modsec-nginx).", "modsec-nginx").option("--coraza-peers <list>", 'Coraza only (coraza-spoa|coraza-go): HAProxy peer-replication for stick-tables. Format: "name1:host1:port1,name2:host2:port2". When set, emitted haproxy-stick-tables.cfg includes a `peers writ` section so counters replicate across instances.').option("--strict-fidelity", "Exit 4 (S3) if any spec field cannot be enforced by the chosen target+engine. Independent of --strict.").action(async (spec, opts) => {
74446
74459
  try {
74447
74460
  if (opts.target === "kong") {
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@chain305/x-security",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Writ CLI — generate/validate/test/report/diff/init against multiple gateway targets",
5
5
  "license": "Apache-2.0",
6
+ "homepage": "https://usewaf.com",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ZeeshanSultan/x-security.git"
10
+ },
6
11
  "type": "module",
7
12
  "bin": {
8
13
  "xsecurity": "./bin/xsecurity.mjs"