@arcjet/astro 1.11.0 → 1.12.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/README.md CHANGED
@@ -35,9 +35,9 @@ Your app's AI features and agents take real actions, calling tools, reading data
35
35
  ```sh
36
36
  npx @arcjet/cli auth login
37
37
  ```
38
- 2. Install the Arcjet skill to give your coding agent the docs it needs:
38
+ 2. Install versioned Agent Skills so your coding agent matches this SDK:
39
39
  ```sh
40
- npx skills add arcjet/skills
40
+ npx @tanstack/intent@latest install
41
41
  ```
42
42
  3. Tell your agent what to protect — it handles the rest.
43
43
 
package/dist/internal.js CHANGED
@@ -1,4 +1,4 @@
1
- import { findIp, parseProxies } from "@arcjet/ip";
1
+ import { createClientIpDiagnostics, hasTrustAllProxy, parseProxies, resolveClientIp } from "@arcjet/ip";
2
2
  import { readBodyWeb } from "@arcjet/body";
3
3
  import { baseUrl, isDevelopment, logLevel, platform } from "@arcjet/env";
4
4
  import { ArcjetHeaders } from "@arcjet/headers";
@@ -10,7 +10,7 @@ import { ARCJET_BASE_URL, ARCJET_ENV, ARCJET_KEY, ARCJET_LOG_LEVEL, FIREBASE_CON
10
10
  export * from "arcjet";
11
11
  //#region src/internal.ts
12
12
  /** SDK version. Updated by the release process. */
13
- const VERSION = "1.11.0";
13
+ const VERSION = "1.12.0";
14
14
  let warnedForAutomaticBodyRead = false;
15
15
  const ipSymbol = Symbol.for("arcjet.ip");
16
16
  const env = {
@@ -60,6 +60,8 @@ function createArcjetClient(options) {
60
60
  const client = options.client ?? createRemoteClient();
61
61
  const log = options.log ? options.log : new Logger({ level: logLevel(env) });
62
62
  const proxies = Array.isArray(options.proxies) ? parseProxies(options.proxies) : void 0;
63
+ const reportClientIp = createClientIpDiagnostics(log);
64
+ if (proxies && hasTrustAllProxy(proxies)) log.warn({ trustAll: true }, "Arcjet proxy configuration trusts an entire IP address family; use the narrowest proxy CIDRs possible.");
63
65
  if (isDevelopment(process.env)) log.warn("Arcjet will use 127.0.0.1 when missing public IP address in development mode");
64
66
  function toArcjetRequest(request, props, ipSrc) {
65
67
  const clientAddress = ipSrc ? void 0 : Reflect.get(request, ipSymbol);
@@ -67,14 +69,17 @@ function createArcjetClient(options) {
67
69
  const cookies = request.headers.get("cookie") ?? "";
68
70
  const headers = new ArcjetHeaders(request.headers);
69
71
  const url = new URL(request.url);
70
- const xArcjetIp = isDevelopment(env) ? headers.get("x-arcjet-ip") : void 0;
71
- let ip = ipSrc || xArcjetIp || findIp({
72
+ const ipDetails = resolveClientIp({
72
73
  ip: clientAddress,
73
74
  headers
74
75
  }, {
76
+ development: isDevelopment(env),
77
+ ipSrc,
75
78
  platform: platform(env),
76
79
  proxies
77
80
  });
81
+ reportClientIp(ipDetails);
82
+ let ip = ipDetails.ip;
78
83
  if (ip === "") {
79
84
  if (isDevelopment(env)) ip = "127.0.0.1";
80
85
  else log.warn(`Client IP address is missing. If this is a dev environment set the ARCJET_ENV env var to "development"`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcjet/astro",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Arcjet runtime security SDK for Astro — bot protection, rate limiting, prompt injection detection, PII blocking, and WAF",
5
5
  "keywords": [
6
6
  "ai",
@@ -62,14 +62,14 @@
62
62
  "test": "npm run build && npm run test-coverage"
63
63
  },
64
64
  "dependencies": {
65
- "@arcjet/body": "1.11.0",
66
- "@arcjet/env": "1.11.0",
67
- "@arcjet/headers": "1.11.0",
68
- "@arcjet/ip": "1.11.0",
69
- "@arcjet/logger": "1.11.0",
70
- "@arcjet/protocol": "1.11.0",
71
- "@arcjet/transport": "1.11.0",
72
- "arcjet": "1.11.0"
65
+ "@arcjet/body": "1.12.0",
66
+ "@arcjet/env": "1.12.0",
67
+ "@arcjet/headers": "1.12.0",
68
+ "@arcjet/ip": "1.12.0",
69
+ "@arcjet/logger": "1.12.0",
70
+ "@arcjet/protocol": "1.12.0",
71
+ "@arcjet/transport": "1.12.0",
72
+ "arcjet": "1.12.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "astro": "7.2.2",