regula-wasi 3.2.2 → 3.2.3

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/README.md CHANGED
@@ -79,6 +79,9 @@ const result = await runRegula('./main.tf', {
79
79
  include: ['./custom-rules/'],
80
80
  only: ['FG_R00229'], // Only run specific rules
81
81
  exclude: ['FG_R00100'], // Exclude specific rules
82
+ noBuiltIns: false, // Disable built-in rules (use only custom rules)
83
+ noIgnore: false, // Disable .gitignore filtering
84
+ varFiles: ['./prod.tfvars'], // Terraform variable files
82
85
  });
83
86
 
84
87
  // Check for failures
@@ -88,6 +91,18 @@ if (result.summary.rule_results.FAIL > 0) {
88
91
  }
89
92
  ```
90
93
 
94
+ #### API Options
95
+
96
+ | Option | Type | Description |
97
+ |--------|------|-------------|
98
+ | `inputType` | string | Input type: `auto`, `tf`, `tf-plan`, `cfn`, `k8s`, `arm` |
99
+ | `include` | string[] | Additional rego rule files/directories to include |
100
+ | `only` | string[] | Only run these specific rule IDs |
101
+ | `exclude` | string[] | Exclude these specific rule IDs |
102
+ | `noBuiltIns` | boolean | Disable built-in rules (use only custom rules from `include`) |
103
+ | `noIgnore` | boolean | Disable .gitignore filtering |
104
+ | `varFiles` | string[] | Terraform variable files (.tfvars) to use |
105
+
91
106
  ### Prebuilt Binary
92
107
 
93
108
  Download from [Releases](https://github.com/nonfx/regula/releases) for your platform.
package/cli.js CHANGED
@@ -10,6 +10,9 @@ const __dirname = dirname(__filename);
10
10
 
11
11
  const args = process.argv.slice(2);
12
12
 
13
+ // Note: preopens "/" is required because regula needs to read IaC files from
14
+ // any path the user specifies (including absolute paths like /home/user/terraform/).
15
+ // This is expected behavior for a CLI tool that processes user-specified file paths.
13
16
  const wasi = new WASI({
14
17
  version: "preview1",
15
18
  args: ["regula", ...args],
package/index.js CHANGED
@@ -6,19 +6,22 @@ const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = dirname(__filename);
7
7
 
8
8
  /**
9
- * Run regula on the specified path(s)
9
+ * Run regula on the specified path(s) and return parsed JSON results.
10
10
  * @param {string|string[]} paths - Path(s) to IaC files or directories
11
11
  * @param {Object} options - Optional configuration
12
12
  * @param {string} options.inputType - Input type: auto, tf, tf-plan, cfn, k8s, arm
13
- * @param {string} options.format - Output format: json, text, table, sarif, junit, tap
14
13
  * @param {string[]} options.include - Additional rego files to include
15
14
  * @param {string[]} options.only - Only run specific rules
16
15
  * @param {string[]} options.exclude - Exclude specific rules
17
- * @returns {Promise<Object>} - Regula output
16
+ * @param {boolean} options.noBuiltIns - Disable built-in rules (use only custom rules from include)
17
+ * @param {boolean} options.noIgnore - Disable .gitignore filtering
18
+ * @param {string[]} options.varFiles - Terraform variable files to use
19
+ * @returns {Promise<Object>} - Parsed regula output with rule_results and summary
18
20
  */
19
21
  export async function runRegula(paths, options = {}) {
20
22
  const pathArray = Array.isArray(paths) ? paths : [paths];
21
23
 
24
+ // Always use JSON format for programmatic parsing
22
25
  const args = ["run", "--format", "json"];
23
26
 
24
27
  if (options.inputType) {
@@ -46,6 +49,21 @@ export async function runRegula(paths, options = {}) {
46
49
  }
47
50
  }
48
51
 
52
+ if (options.noBuiltIns) {
53
+ args.push("--no-built-ins");
54
+ }
55
+
56
+ if (options.noIgnore) {
57
+ args.push("--no-ignore");
58
+ }
59
+
60
+ if (options.varFiles) {
61
+ const varFiles = Array.isArray(options.varFiles) ? options.varFiles : [options.varFiles];
62
+ for (const varFile of varFiles) {
63
+ args.push("--var-file", varFile);
64
+ }
65
+ }
66
+
49
67
  args.push(...pathArray);
50
68
 
51
69
  return new Promise((resolve, reject) => {
@@ -71,7 +89,8 @@ export async function runRegula(paths, options = {}) {
71
89
  }
72
90
 
73
91
  /**
74
- * Validate IaC files and return rule results
92
+ * Validate IaC files and return rule results.
93
+ * Alias for runRegula().
75
94
  * @param {string|string[]} paths - Path(s) to IaC files or directories
76
95
  * @param {Object} options - Optional configuration
77
96
  * @returns {Promise<Object>} - Object with rule_results and summary
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "regula-wasi",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
4
4
  "description": "Infrastructure as Code security and compliance evaluation tool (WASI build). Fork of fugue/regula with security patches.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/regula.wasm CHANGED
Binary file