@arcjet/bun 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 +2 -2
- package/dist/index.js +9 -4
- package/package.json +9 -9
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
|
|
38
|
+
2. Install versioned Agent Skills so your coding agent matches this SDK:
|
|
39
39
|
```sh
|
|
40
|
-
npx
|
|
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/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cloudflare,
|
|
1
|
+
import { cloudflare, createClientIpDiagnostics, hasTrustAllProxy, parseProxies, resolveClientIp } from "@arcjet/ip";
|
|
2
2
|
import core from "arcjet";
|
|
3
3
|
import { readBodyWeb } from "@arcjet/body";
|
|
4
4
|
import { baseUrl, isDevelopment, logLevel, platform } from "@arcjet/env";
|
|
@@ -10,7 +10,7 @@ import { env } from "bun";
|
|
|
10
10
|
export * from "arcjet";
|
|
11
11
|
//#region src/index.ts
|
|
12
12
|
/** SDK version. Updated by the release process. */
|
|
13
|
-
const VERSION = "1.
|
|
13
|
+
const VERSION = "1.12.0";
|
|
14
14
|
let warnedForAutomaticBodyRead = false;
|
|
15
15
|
/**
|
|
16
16
|
* Create a remote client.
|
|
@@ -49,19 +49,24 @@ function arcjet(options) {
|
|
|
49
49
|
const ipCache = /* @__PURE__ */ new WeakMap();
|
|
50
50
|
const log = options.log ? options.log : new Logger({ level: logLevel(env) });
|
|
51
51
|
const proxies = Array.isArray(options.proxies) ? parseProxies(options.proxies) : void 0;
|
|
52
|
+
const reportClientIp = createClientIpDiagnostics(log);
|
|
53
|
+
if (proxies && hasTrustAllProxy(proxies)) log.warn({ trustAll: true }, "Arcjet proxy configuration trusts an entire IP address family; use the narrowest proxy CIDRs possible.");
|
|
52
54
|
if (isDevelopment(env)) log.warn("Arcjet will use 127.0.0.1 when missing public IP address in development mode");
|
|
53
55
|
function toArcjetRequest(request, props, ipSrc) {
|
|
54
56
|
const cookies = request.headers.get("cookie") ?? "";
|
|
55
57
|
const headers = new ArcjetHeaders(request.headers);
|
|
56
58
|
const url = new URL(request.url);
|
|
57
|
-
const
|
|
58
|
-
let ip = ipSrc || xArcjetIp || findIp({
|
|
59
|
+
const ipDetails = resolveClientIp({
|
|
59
60
|
ip: ipCache.get(request),
|
|
60
61
|
headers
|
|
61
62
|
}, {
|
|
63
|
+
development: isDevelopment(env),
|
|
64
|
+
ipSrc,
|
|
62
65
|
platform: platform(env),
|
|
63
66
|
proxies
|
|
64
67
|
});
|
|
68
|
+
reportClientIp(ipDetails);
|
|
69
|
+
let ip = ipDetails.ip;
|
|
65
70
|
if (ip === "") {
|
|
66
71
|
if (isDevelopment(env)) ip = "127.0.0.1";
|
|
67
72
|
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/bun",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Arcjet runtime security SDK for Bun — bot protection, rate limiting, prompt injection detection, PII blocking, and WAF",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
"test": "npm run build"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@arcjet/body": "1.
|
|
63
|
-
"@arcjet/env": "1.
|
|
64
|
-
"@arcjet/headers": "1.
|
|
65
|
-
"@arcjet/ip": "1.
|
|
66
|
-
"@arcjet/logger": "1.
|
|
67
|
-
"@arcjet/protocol": "1.
|
|
68
|
-
"@arcjet/transport": "1.
|
|
69
|
-
"arcjet": "1.
|
|
62
|
+
"@arcjet/body": "1.12.0",
|
|
63
|
+
"@arcjet/env": "1.12.0",
|
|
64
|
+
"@arcjet/headers": "1.12.0",
|
|
65
|
+
"@arcjet/ip": "1.12.0",
|
|
66
|
+
"@arcjet/logger": "1.12.0",
|
|
67
|
+
"@arcjet/protocol": "1.12.0",
|
|
68
|
+
"@arcjet/transport": "1.12.0",
|
|
69
|
+
"arcjet": "1.12.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"bun-types": "1.3.14",
|