xploitscan-shared-rules 1.4.0 → 1.5.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/dist/index.cjs CHANGED
@@ -39,6 +39,7 @@ __export(index_exports, {
39
39
  calculateGrade: () => calculateGrade,
40
40
  callSpreads: () => callSpreads,
41
41
  callbackHell: () => callbackHell,
42
+ classifyExposure: () => classifyExposure,
42
43
  clickjacking: () => clickjacking,
43
44
  clientComponentSecret: () => clientComponentSecret,
44
45
  clientSideAuth: () => clientSideAuth,
@@ -285,6 +286,27 @@ var RULE_IMPACTS = {
285
286
  VC011: "The NEXT_PUBLIC_ prefix exposes this value in the browser bundle. If it's a secret, anyone viewing your site's JavaScript can extract it."
286
287
  };
287
288
 
289
+ // src/exposure.ts
290
+ function classifyExposure(filePath) {
291
+ if (/(?:\/api\/|pages\/api\/|routes?\/|controllers?\/|endpoints?\/|server\.|app\/.*route\.)/.test(
292
+ filePath
293
+ )) {
294
+ return "public";
295
+ }
296
+ if (/(?:app\/.*page\.|pages\/(?!api\/)|views?\/|templates?\/)/.test(filePath)) {
297
+ return "public";
298
+ }
299
+ if (/(?:lib\/|utils?\/|helpers?\/|services?\/|models?\/|hooks?\/)/.test(
300
+ filePath
301
+ )) {
302
+ return "internal";
303
+ }
304
+ if (/(?:middleware|config|constants?)/.test(filePath)) {
305
+ return "internal";
306
+ }
307
+ return "unknown";
308
+ }
309
+
288
310
  // src/ast/parse.ts
289
311
  var import_parser = require("@babel/parser");
290
312
  var MAX_CACHE = 256;
@@ -8102,6 +8124,7 @@ function scanEntropy(files) {
8102
8124
  calculateGrade,
8103
8125
  callSpreads,
8104
8126
  callbackHell,
8127
+ classifyExposure,
8105
8128
  clickjacking,
8106
8129
  clientComponentSecret,
8107
8130
  clientSideAuth,