@debugbundle/cli 1.1.1 → 1.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/dist/main.cjs +105 -7
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -14605,6 +14605,95 @@ function getRequestAnomalyThreshold(input2) {
14605
14605
  return null;
14606
14606
  }
14607
14607
 
14608
+ // ../../packages/shared-types/src/request-failure-noise.ts
14609
+ function isLowValueExternalProbeRequestFailure404(input2) {
14610
+ if (input2.responseStatus !== 404 || input2.httpMethod.toUpperCase() !== "GET") {
14611
+ return false;
14612
+ }
14613
+ const normalizedRoute = input2.routeTemplate.toLowerCase().replace(/\/+$/, "") || "/";
14614
+ const normalizedPath = normalizePath(input2.requestPath ?? input2.routeTemplate);
14615
+ const routesToCheck = /* @__PURE__ */ new Set([normalizedRoute, normalizedPath]);
14616
+ for (const route of routesToCheck) {
14617
+ if (isRouteOnlyExternalProbe(route)) {
14618
+ return true;
14619
+ }
14620
+ }
14621
+ return isDirectIpRequest(input2.headers ?? null) && [...routesToCheck].some(isGenericDirectIpProbeRoute);
14622
+ }
14623
+ function normalizePath(path) {
14624
+ const withoutQuery = path.split("?")[0] ?? path;
14625
+ return withoutQuery.toLowerCase().replace(/\/+$/, "") || "/";
14626
+ }
14627
+ function isRouteOnlyExternalProbe(normalizedRoute) {
14628
+ const exactRoutes = /* @__PURE__ */ new Set([
14629
+ "/.env",
14630
+ "/__debug__/render_panel",
14631
+ "/actuator",
14632
+ "/autodiscover/autodiscover.json",
14633
+ "/developmentserver/metadatauploader",
14634
+ "/cpanel",
14635
+ "/favicon.ico",
14636
+ "/geoserver/web",
14637
+ "/hnap1",
14638
+ "/logon/logonpoint/index.html",
14639
+ "/owa/auth/logon.aspx",
14640
+ "/robots.txt",
14641
+ "/rdweb/pages",
14642
+ "/web",
14643
+ "/webclient/login.xhtml",
14644
+ "/webconsole",
14645
+ "/webui",
14646
+ "/whm",
14647
+ "/wp-admin",
14648
+ "/wp-login.php",
14649
+ "/wsman",
14650
+ "/xmlrpc.php"
14651
+ ]);
14652
+ if (exactRoutes.has(normalizedRoute)) {
14653
+ return true;
14654
+ }
14655
+ return normalizedRoute.includes("/.git/") || normalizedRoute.includes("/.svn/") || normalizedRoute.includes("/api_keys") || normalizedRoute.includes("/backup/api_keys") || normalizedRoute.includes("/phpmyadmin") || normalizedRoute.includes("/pma/") || normalizedRoute.includes("/vendor/phpunit/") || normalizedRoute.startsWith("/autodiscover/") || normalizedRoute.startsWith("/cgi-bin/") || normalizedRoute.startsWith("/ecp/") || normalizedRoute.endsWith("/.git/config") || normalizedRoute.endsWith("/composer.json") || normalizedRoute.endsWith("/composer.lock") || normalizedRoute.endsWith("/package-lock.json") || normalizedRoute.endsWith("/package.json") || normalizedRoute.endsWith("/server-status") || normalizedRoute.includes("wp-config") || normalizedRoute.startsWith("/owa/") || normalizedRoute.startsWith("/rdweb/") || normalizedRoute.startsWith("/vpn/") || normalizedRoute.startsWith("/wp-") || isSensitiveBackupFileProbe(normalizedRoute);
14656
+ }
14657
+ function isSensitiveBackupFileProbe(normalizedRoute) {
14658
+ if (!/\.(?:bak|backup|dump|old|orig|save|sql|swp|tar|tar\.gz|zip)$/.test(normalizedRoute)) {
14659
+ return false;
14660
+ }
14661
+ return /(?:^|\/|\.)(?:backup|config|database|db|dump|env|secret|site|www|wp-config)(?:\/|\.|_|-|$)/.test(normalizedRoute);
14662
+ }
14663
+ function isGenericDirectIpProbeRoute(normalizedRoute) {
14664
+ return [
14665
+ "/admin",
14666
+ "/administrator",
14667
+ "/login",
14668
+ "/logincheck",
14669
+ "/remote/logincheck"
14670
+ ].includes(normalizedRoute);
14671
+ }
14672
+ function isDirectIpRequest(headers) {
14673
+ if (headers === null) {
14674
+ return false;
14675
+ }
14676
+ const host = readHeader(headers, "x-forwarded-host") ?? readHeader(headers, "host");
14677
+ if (host === null) {
14678
+ return false;
14679
+ }
14680
+ return isIpLikeHost(host);
14681
+ }
14682
+ function readHeader(headers, name) {
14683
+ const direct = headers[name] ?? headers[name.toLowerCase()];
14684
+ if (typeof direct === "string") {
14685
+ return direct;
14686
+ }
14687
+ if (Array.isArray(direct) && typeof direct[0] === "string") {
14688
+ return direct[0];
14689
+ }
14690
+ return null;
14691
+ }
14692
+ function isIpLikeHost(value) {
14693
+ const host = value.trim().replace(/:\d+$/, "");
14694
+ return /^(?:\d{1,3}\.){3}\d{1,3}$/.test(host) || /^\[[0-9a-f:]+\]$/i.test(host) || host.includes(":") && /^[0-9a-f:]+$/i.test(host);
14695
+ }
14696
+
14608
14697
  // ../../packages/shared-types/src/capture-rules.ts
14609
14698
  var CAPTURE_RULE_EVENT_TYPES = [
14610
14699
  "backend_exception",
@@ -19998,7 +20087,7 @@ var ProjectMetricsSchema = external_exports.object({
19998
20087
  monthly_raw_ingested_events: external_exports.number().int().nonnegative(),
19999
20088
  retained_bundles: external_exports.number().int().nonnegative(),
20000
20089
  monthly_alert_deliveries: external_exports.number().int().nonnegative()
20001
- }).strict();
20090
+ });
20002
20091
  var ProjectRecordSchema = external_exports.object({
20003
20092
  project_id: external_exports.string(),
20004
20093
  organization_id: external_exports.string(),
@@ -20015,13 +20104,13 @@ var ProjectRecordSchema = external_exports.object({
20015
20104
  metrics: ProjectMetricsSchema,
20016
20105
  created_at: external_exports.string(),
20017
20106
  updated_at: external_exports.string()
20018
- }).strict();
20107
+ });
20019
20108
  var ProjectListResponseSchema = external_exports.object({
20020
20109
  projects: external_exports.array(ProjectRecordSchema)
20021
- }).strict();
20110
+ });
20022
20111
  var ProjectCreateResponseSchema = external_exports.object({
20023
20112
  project: ProjectRecordSchema
20024
- }).strict();
20113
+ });
20025
20114
  var DeletedProjectRecordSchema = external_exports.object({
20026
20115
  project_id: external_exports.string(),
20027
20116
  organization_id: external_exports.string(),
@@ -20037,10 +20126,10 @@ var DeletedProjectRecordSchema = external_exports.object({
20037
20126
  organization_plan: external_exports.enum(["free", "solo", "team"]),
20038
20127
  created_at: external_exports.string(),
20039
20128
  updated_at: external_exports.string()
20040
- }).strict();
20129
+ });
20041
20130
  var ProjectDeleteResponseSchema = external_exports.object({
20042
20131
  project: DeletedProjectRecordSchema
20043
- }).strict();
20132
+ });
20044
20133
  var ApiErrorResponseSchema2 = external_exports.object({
20045
20134
  error: external_exports.string()
20046
20135
  }).strict();
@@ -24809,6 +24898,15 @@ function collectRequestAnomalyAggregates(batches, capturePreset) {
24809
24898
  if (threshold === null || responseStatus === null || method === null || routeTemplate === null) {
24810
24899
  continue;
24811
24900
  }
24901
+ if (isLowValueExternalProbeRequestFailure404({
24902
+ httpMethod: method,
24903
+ requestPath: event.payload.path,
24904
+ routeTemplate,
24905
+ responseStatus,
24906
+ headers: event.payload.headers
24907
+ })) {
24908
+ continue;
24909
+ }
24812
24910
  const projectId = requireProjectId(event);
24813
24911
  const incidentFingerprint = buildRequestAnomalyFingerprint({
24814
24912
  projectId,
@@ -34488,7 +34586,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
34488
34586
  // package.json
34489
34587
  var package_default = {
34490
34588
  name: "@debugbundle/cli",
34491
- version: "1.1.1",
34589
+ version: "1.1.2",
34492
34590
  private: false,
34493
34591
  description: "Command-line interface for DebugBundle",
34494
34592
  license: "AGPL-3.0-only",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugbundle/cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "private": false,
5
5
  "description": "Command-line interface for DebugBundle",
6
6
  "license": "AGPL-3.0-only",