@vm0/cli 9.98.1 → 9.98.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.
@@ -49,7 +49,7 @@ if (DSN) {
49
49
  Sentry.init({
50
50
  dsn: DSN,
51
51
  environment: process.env.SENTRY_ENVIRONMENT ?? "production",
52
- release: "9.98.1",
52
+ release: "9.98.2",
53
53
  sendDefaultPii: false,
54
54
  tracesSampleRate: 0,
55
55
  shutdownTimeout: 500,
@@ -68,7 +68,7 @@ if (DSN) {
68
68
  }
69
69
  });
70
70
  Sentry.setContext("cli", {
71
- version: "9.98.1",
71
+ version: "9.98.2",
72
72
  command: process.argv.slice(2).join(" ")
73
73
  });
74
74
  Sentry.setContext("runtime", {
@@ -27148,7 +27148,40 @@ function matchFirewallPath(path, pattern) {
27148
27148
  if (pi !== pathSegs.length) return null;
27149
27149
  return params;
27150
27150
  }
27151
- function findMatchingPermissions(method, path, config) {
27151
+ function parseGraphQLRule(rest) {
27152
+ const gqlIdx = rest.indexOf(" GraphQL");
27153
+ if (gqlIdx === -1) return null;
27154
+ const path = gqlIdx > 0 ? rest.slice(0, gqlIdx) : "/";
27155
+ const suffixParts = rest.slice(gqlIdx + 1).split(/\s+/);
27156
+ let typeFilter = null;
27157
+ let opFilter = null;
27158
+ for (let i = 1; i < suffixParts.length; i++) {
27159
+ const part = suffixParts[i];
27160
+ if (part.startsWith("type:")) {
27161
+ typeFilter = part.slice(5);
27162
+ } else if (part.startsWith("operationName:")) {
27163
+ opFilter = part.slice(14);
27164
+ }
27165
+ }
27166
+ return { path, typeFilter, opFilter };
27167
+ }
27168
+ function matchGraphQLBody(body, typeFilter, opFilter) {
27169
+ if (!body) return false;
27170
+ if (typeFilter !== null && body.type !== typeFilter) {
27171
+ return false;
27172
+ }
27173
+ if (opFilter !== null) {
27174
+ const opName = body.operationName;
27175
+ if (!opName) return false;
27176
+ if (opFilter.endsWith("*")) {
27177
+ if (!opName.startsWith(opFilter.slice(0, -1))) return false;
27178
+ } else if (opName !== opFilter) {
27179
+ return false;
27180
+ }
27181
+ }
27182
+ return true;
27183
+ }
27184
+ function findMatchingPermissions(method, path, config, graphqlBody) {
27152
27185
  const upperMethod = method.toUpperCase();
27153
27186
  const matched = /* @__PURE__ */ new Set();
27154
27187
  for (const api of config.apis) {
@@ -27159,9 +27192,14 @@ function findMatchingPermissions(method, path, config) {
27159
27192
  const spaceIdx = rule.indexOf(" ");
27160
27193
  if (spaceIdx === -1) continue;
27161
27194
  const ruleMethod = rule.slice(0, spaceIdx).toUpperCase();
27162
- const rulePath = rule.slice(spaceIdx + 1);
27195
+ const rest = rule.slice(spaceIdx + 1);
27163
27196
  if (ruleMethod !== "ANY" && ruleMethod !== upperMethod) continue;
27197
+ const gql = parseGraphQLRule(rest);
27198
+ const rulePath = gql ? gql.path : rest;
27164
27199
  if (matchFirewallPath(path, rulePath) !== null) {
27200
+ if (gql && (gql.typeFilter !== null || gql.opFilter !== null) && !matchGraphQLBody(graphqlBody, gql.typeFilter, gql.opFilter)) {
27201
+ continue;
27202
+ }
27165
27203
  matched.add(perm.name);
27166
27204
  break;
27167
27205
  }
@@ -31843,4 +31881,4 @@ export {
31843
31881
  parseTime,
31844
31882
  paginate
31845
31883
  };
31846
- //# sourceMappingURL=chunk-F2IYWURQ.js.map
31884
+ //# sourceMappingURL=chunk-3S6PEJ3G.js.map