Arcjet utilities for finding the originating IP of a request.
Installation
npm install -S @arcjet/ip
Example
import ip from"@arcjet/ip";
// Some Request-like object, such as node's `http.IncomingMessage` or next.js'// `NextRequest`const request = newNextRequest();
// A `Headers` object, which is passed separately for cases where it needs to be// constructed or sanitizedconst headers = newHeaders();
// Returns the first non-private IP address detectedconst globalIp = ip(request, headers);
console.log(globalIp);
Considerations
The IP should not be trusted as it can be spoofed in most cases, especially when
loaded via the Headers object.
In non-production environments (NODE_ENV !== "production"), we allow
private/internal addresses so that the SDKs work correctly locally.
We've chosen the approach of porting Rust's IP Parser because capturing RegExps
can be the source of ReDoS attacks, which we need to avoid. We also wanted to
keep our implementation as close to Rust as possible because we will be relying
on the Rust stdlib implementation in the future, with a fallback to this
implementation. As such, we'll need to track changes in Rust's implementation,
even though it seems to change infrequently.
detect common free/disposable email providers locally (#1096) (115d016), closes #1095
📦 Dependencies
Bump @typescript-eslint/eslint-plugin from 7.14.1 to 7.15.0 (#1063) (d4a1cfe)
Bump @typescript-eslint/eslint-plugin from 7.15.0 to 7.16.0 (#1091) (6bbcbe6)
bump @typescript-eslint/eslint-plugin from 7.16.0 to 7.16.1 (#1135) (6f4495a)
Bump @typescript-eslint/parser from 7.14.1 to 7.15.0 (#1064) (b6e2b0f)
Bump @typescript-eslint/parser from 7.15.0 to 7.16.0 (#1090) (c31957f)
bump @typescript-eslint/parser from 7.16.0 to 7.16.1 (#1132) (3feb40a)
Bump typeid-js from 0.7.0 to 1.0.0 (#1079) (fa276c5)
dev: Bump @edge-runtime/jest-environment from 2.3.10 to 3.0.0 (#1087) (1e6eb00)
dev: bump @edge-runtime/jest-environment from 3.0.0 to 3.0.1 (#1123) (9064240)
dev: Bump @rollup/wasm-node from 4.18.0 to 4.18.1 (#1092) (ffc298a)
dev: Bump bun-types from 1.1.17 to 1.1.18 (#1080) (6bb3483)
dev: bump bun-types from 1.1.18 to 1.1.20 (#1118) (dbf3826)
dev: Bump typescript from 5.5.2 to 5.5.3 (#1065) (ef05395)
example: Bump @clerk/nextjs from 5.1.6 to 5.2.2 in /examples/nextjs-14-clerk-rl in the dependencies group across 1 directory (#1082) (7ac1236)
example: Bump @clerk/nextjs from 5.1.6 to 5.2.2 in /examples/nextjs-14-clerk-shield in the dependencies group across 1 directory (#1081) (9b89f9b)
example: bump @clerk/nextjs from 5.2.2 to 5.2.3 in /examples/nextjs-14-clerk-rl in the dependencies group (#1119) (5fe9ef0)
example: bump @clerk/nextjs from 5.2.2 to 5.2.3 in /examples/nextjs-14-clerk-shield in the dependencies group (#1121) (baf55e0)
example: Bump hono from 4.4.11 to 4.4.12 in /examples/nodejs-hono-rl in the dependencies group (#1085) (3782001)
example: Bump hono from 4.4.12 to 4.4.13 in /examples/nodejs-hono-rl in the dependencies group (#1112) (49f8721)
example: Bump lucide-react from 0.399.0 to 0.400.0 in /examples/nextjs-14-authjs-5 in the dependencies group (#1066) (b44dd6a)
example: bump lucide-react from 0.407.0 to 0.408.0 in /examples/nextjs-14-authjs-5 in the dependencies group (#1116) (84bd181)
example: bump tailwindcss from 3.4.4 to 3.4.5 in /examples/nextjs-14-app-dir-rl in the dependencies group (#1124) (c73e955)
example: bump tailwindcss from 3.4.4 to 3.4.5 in /examples/nextjs-14-authjs-5 in the dependencies group (#1129) (74adca7)
example: bump tailwindcss from 3.4.4 to 3.4.5 in /examples/nextjs-14-clerk-rl in the dependencies group (#1125) (8aa2f53)
example: bump tailwindcss from 3.4.4 to 3.4.5 in /examples/nextjs-14-clerk-shield in the dependencies group (#1130) (6f76186)
example: bump tailwindcss from 3.4.4 to 3.4.5 in /examples/nextjs-14-decorate in the dependencies group (#1126) (b2d9a81)
example: bump tailwindcss from 3.4.4 to 3.4.5 in /examples/nextjs-14-ip-details in the dependencies group (#1127) (0251e74)
example: bump tailwindcss from 3.4.4 to 3.4.5 in /examples/nextjs-14-nextauth-4 in the dependencies group (#1128) (b7f0028)
example: bump tailwindcss from 3.4.4 to 3.4.5 in /examples/nextjs-14-pages-wrap in the dependencies group (#1131) (af3f8d6)
example: Bump the dependencies group across 1 directory with 2 updates (#1068) (bc86928)
example: Bump the dependencies group across 1 directory with 2 updates (#1071) (75df78a)
example: bump the dependencies group across 1 directory with 2 updates (#1117) (306d4f1)
example: Bump the dependencies group across 1 directory with 3 updates (#1072) (937b184)
example: Bump the dependencies group across 1 directory with 3 updates (#1108) (3714941)
example: Bump the dependencies group across 1 directory with 4 updates (#1106) (caaea7a)
example: Bump the dependencies group across 1 directory with 6 updates (#1109) (c877b39)
example: Bump the dependencies group in /examples/nextjs-14-app-dir-rl with 2 updates (#1104) (8cbde05)
example: Bump the dependencies group in /examples/nextjs-14-app-dir-validate-email with 2 updates (#1107) (298a70b)
example: Bump the dependencies group in /examples/nextjs-14-clerk-rl with 2 updates (#1102) (f1e7a4c)
example: Bump the dependencies group in /examples/nextjs-14-clerk-shield with 2 updates (#1101) (10184f9)
example: Bump the dependencies group in /examples/nextjs-14-decorate with 2 updates (#1111) (52394af)
example: Bump the dependencies group in /examples/nextjs-14-ip-details with 2 updates (#1105) (5127321)
example: Bump the dependencies group in /examples/nextjs-14-nextauth-4 with 2 updates (#1103) (8ef993f)
example: Bump the dependencies group in /examples/nextjs-14-openai with 2 updates (#1113) (89b3ccb)
example: bump the dependencies group in /examples/nextjs-14-openai with 2 updates (#1133) (d2ac694)
example: Bump the dependencies group in /examples/nextjs-14-pages-wrap with 2 updates (#1110) (fb05224)
example: bump the dependencies group in /examples/nextjs-14-react-hook-form with 2 updates (#1120) (729c886)
example: bump the dependencies group in /examples/nextjs-14-react-hook-form with 2 updates (#1134) (2fbe4d6)
example: Bump the dependencies group in /examples/sveltekit with 2 updates (#1093) (009591a)
example: bump the dependencies group in /examples/sveltekit with 2 updates (#1136) (c93a9eb)
🧹 Miscellaneous Chores
examples: Add example of testing APIs with Newman (#1083) (6b2ccf0)
examples: Show dynamic feature flags with LaunchDarkly (#1100) (d3bf356)
FAQs
Arcjet utilities for finding the originating IP of a request
The npm package @arcjet/ip receives a total of 1,681 weekly downloads. As such, @arcjet/ip popularity was classified as popular.
We found that @arcjet/ip demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 2 open source maintainers collaborating on the project.
Package last updated on 15 Jul 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.