Compare commits

...

19 Commits

Author SHA1 Message Date
Owen
63e41e3dcd Update nextjs 2025-12-08 10:43:19 -05:00
miloschwartz
b5c6191c67 add email consent and update audience 2025-11-17 20:50:24 -05:00
Owen Schwartz
2b31dd955c Merge pull request #1848 from fosrl/dependabot/npm_and_yarn/dev-minor-updates-040abfaff9
Bump the dev-minor-updates group across 1 directory with 3 updates
2025-11-17 10:54:38 -05:00
Owen Schwartz
e7aeb4ff89 Merge pull request #1849 from fosrl/dependabot/go_modules/install/prod-minor-updates-4e8dbec1a6
Bump golang.org/x/term from 0.36.0 to 0.37.0 in /install in the prod-minor-updates group
2025-11-17 10:54:23 -05:00
Owen Schwartz
9dd1192033 Merge pull request #1855 from fosrl/dependabot/npm_and_yarn/prod-patch-updates-6d8f9bd785
Bump the prod-patch-updates group across 1 directory with 12 updates
2025-11-17 10:54:15 -05:00
Owen Schwartz
e61da0958f Merge pull request #1841 from fosrl/dependabot/github_actions/docker/setup-qemu-action-3.7.0
Bump docker/setup-qemu-action from 3.6.0 to 3.7.0
2025-11-17 10:49:20 -05:00
Owen Schwartz
fce588057e Merge pull request #1870 from fosrl/dependabot/npm_and_yarn/js-yaml-4.1.1
Bump js-yaml from 4.1.0 to 4.1.1
2025-11-17 10:48:32 -05:00
dependabot[bot]
6d1713b6b9 Bump js-yaml from 4.1.0 to 4.1.1
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.0 to 4.1.1.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.1.0...4.1.1)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-16 06:21:01 +00:00
Owen
de8262d7b9 Batch deletes 2025-11-15 11:51:52 -05:00
Owen
8ad7bcc0d6 Adjust rate limiting position 2025-11-14 11:33:52 -05:00
Owen
e62806d6fb Clean up old timestamps 2025-11-14 11:33:51 -05:00
Owen Schwartz
aabe39137b Merge pull request #1856 from LaurenceJJones/fix-remove-return-before-showing-token
fix: Remove return in installer which prevents showing token
2025-11-14 10:23:21 -05:00
dependabot[bot]
c9786946b7 Bump the prod-patch-updates group across 1 directory with 12 updates
Bumps the prod-patch-updates group with 12 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@radix-ui/react-avatar](https://github.com/radix-ui/primitives) | `1.1.10` | `1.1.11` |
| [@radix-ui/react-label](https://github.com/radix-ui/primitives) | `2.1.7` | `2.1.8` |
| [@radix-ui/react-progress](https://github.com/radix-ui/primitives) | `1.1.7` | `1.1.8` |
| [@radix-ui/react-separator](https://github.com/radix-ui/primitives) | `1.1.7` | `1.1.8` |
| [@radix-ui/react-slot](https://github.com/radix-ui/primitives) | `1.2.3` | `1.2.4` |
| [axios](https://github.com/axios/axios) | `1.13.1` | `1.13.2` |
| [eslint](https://github.com/eslint/eslint) | `9.39.0` | `9.39.1` |
| [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next) | `16.0.1` | `16.0.2` |
| [js-yaml](https://github.com/nodeca/js-yaml) | `4.1.0` | `4.1.1` |
| [maxmind](https://github.com/runk/node-maxmind) | `5.0.0` | `5.0.1` |
| [posthog-node](https://github.com/PostHog/posthog-js/tree/HEAD/packages/node) | `5.11.0` | `5.11.2` |
| [resend](https://github.com/resend/resend-node) | `6.4.0` | `6.4.2` |



Updates `@radix-ui/react-avatar` from 1.1.10 to 1.1.11
- [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md)
- [Commits](https://github.com/radix-ui/primitives/commits)

Updates `@radix-ui/react-label` from 2.1.7 to 2.1.8
- [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md)
- [Commits](https://github.com/radix-ui/primitives/commits)

Updates `@radix-ui/react-progress` from 1.1.7 to 1.1.8
- [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md)
- [Commits](https://github.com/radix-ui/primitives/commits)

Updates `@radix-ui/react-separator` from 1.1.7 to 1.1.8
- [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md)
- [Commits](https://github.com/radix-ui/primitives/commits)

Updates `@radix-ui/react-slot` from 1.2.3 to 1.2.4
- [Changelog](https://github.com/radix-ui/primitives/blob/main/release-process.md)
- [Commits](https://github.com/radix-ui/primitives/commits)

Updates `axios` from 1.13.1 to 1.13.2
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.13.1...v1.13.2)

Updates `eslint` from 9.39.0 to 9.39.1
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/compare/v9.39.0...v9.39.1)

Updates `eslint-config-next` from 16.0.1 to 16.0.2
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/commits/v16.0.2/packages/eslint-config-next)

Updates `js-yaml` from 4.1.0 to 4.1.1
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.1.0...4.1.1)

Updates `maxmind` from 5.0.0 to 5.0.1
- [Release notes](https://github.com/runk/node-maxmind/releases)
- [Commits](https://github.com/runk/node-maxmind/compare/v5.0.0...v5.0.1)

Updates `posthog-node` from 5.11.0 to 5.11.2
- [Release notes](https://github.com/PostHog/posthog-js/releases)
- [Changelog](https://github.com/PostHog/posthog-js/blob/main/packages/node/CHANGELOG.md)
- [Commits](https://github.com/PostHog/posthog-js/commits/posthog-node@5.11.2/packages/node)

Updates `resend` from 6.4.0 to 6.4.2
- [Release notes](https://github.com/resend/resend-node/releases)
- [Commits](https://github.com/resend/resend-node/compare/v6.4.0...v6.4.2)

---
updated-dependencies:
- dependency-name: "@radix-ui/react-avatar"
  dependency-version: 1.1.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: "@radix-ui/react-label"
  dependency-version: 2.1.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: "@radix-ui/react-progress"
  dependency-version: 1.1.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: "@radix-ui/react-separator"
  dependency-version: 1.1.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: "@radix-ui/react-slot"
  dependency-version: 1.2.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: axios
  dependency-version: 1.13.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: eslint
  dependency-version: 9.39.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: eslint-config-next
  dependency-version: 16.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: maxmind
  dependency-version: 5.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: posthog-node
  dependency-version: 5.11.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
- dependency-name: resend
  dependency-version: 6.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prod-patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-14 01:24:49 +00:00
dependabot[bot]
9344ab3546 Bump golang.org/x/term in /install in the prod-minor-updates group
Bumps the prod-minor-updates group in /install with 1 update: [golang.org/x/term](https://github.com/golang/term).


Updates `golang.org/x/term` from 0.36.0 to 0.37.0
- [Commits](https://github.com/golang/term/compare/v0.36.0...v0.37.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-version: 0.37.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: prod-minor-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-14 01:23:32 +00:00
dependabot[bot]
1a4078b8a1 Bump the dev-minor-updates group across 1 directory with 3 updates
Bumps the dev-minor-updates group with 3 updates in the / directory: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node), [esbuild](https://github.com/evanw/esbuild) and [esbuild-node-externals](https://github.com/pradel/esbuild-node-externals).


Updates `@types/node` from 24.9.2 to 24.10.1
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `esbuild` from 0.25.12 to 0.27.0
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.25.12...v0.27.0)

Updates `esbuild-node-externals` from 1.18.0 to 1.19.1
- [Release notes](https://github.com/pradel/esbuild-node-externals/releases)
- [Commits](https://github.com/pradel/esbuild-node-externals/compare/v1.18.0...esbuild-node-externals-v1.19.1)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 24.10.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-minor-updates
- dependency-name: esbuild
  dependency-version: 0.27.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-minor-updates
- dependency-name: esbuild-node-externals
  dependency-version: 1.19.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-minor-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-14 01:21:19 +00:00
miloschwartz
ca66637270 remove from address in saas suppport email 2025-11-13 17:37:27 -05:00
Laurence Jones
fbce392137 Remove unnecessary return after success message
Remove redundant return statement after success message.
2025-11-13 12:52:21 +00:00
dependabot[bot]
c6611471b1 Bump docker/setup-qemu-action from 3.6.0 to 3.7.0
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 3.6.0 to 3.7.0.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](29109295f8...c7c5346462)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-version: 3.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-10 01:37:59 +00:00
Owen
d38b321f85 Add missing header 2025-11-08 16:47:03 -08:00
15 changed files with 2171 additions and 323 deletions

View File

@@ -39,7 +39,7 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

View File

@@ -3,8 +3,8 @@ module installer
go 1.24.0 go 1.24.0
require ( require (
golang.org/x/term v0.36.0 golang.org/x/term v0.37.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
) )
require golang.org/x/sys v0.37.0 // indirect require golang.org/x/sys v0.38.0 // indirect

View File

@@ -1,7 +1,7 @@
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q= golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss= golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@@ -238,7 +238,6 @@ func main() {
} }
fmt.Println("CrowdSec installed successfully!") fmt.Println("CrowdSec installed successfully!")
return
} }
} }
} }

View File

@@ -1421,6 +1421,9 @@
"and": "and", "and": "and",
"privacyPolicy": "privacy policy" "privacyPolicy": "privacy policy"
}, },
"signUpMarketing": {
"keepMeInTheLoop": "Keep me in the loop with news, updates, and new features by email."
},
"siteRequired": "Site is required.", "siteRequired": "Site is required.",
"olmTunnel": "Olm Tunnel", "olmTunnel": "Olm Tunnel",
"olmTunnelDescription": "Use Olm for client connectivity", "olmTunnelDescription": "Use Olm for client connectivity",

2220
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -39,20 +39,20 @@
"@node-rs/argon2": "^2.0.2", "@node-rs/argon2": "^2.0.2",
"@oslojs/crypto": "1.0.1", "@oslojs/crypto": "1.0.1",
"@oslojs/encoding": "1.1.0", "@oslojs/encoding": "1.1.0",
"@radix-ui/react-avatar": "1.1.10", "@radix-ui/react-avatar": "1.1.11",
"@radix-ui/react-checkbox": "1.3.3", "@radix-ui/react-checkbox": "1.3.3",
"@radix-ui/react-collapsible": "1.1.12", "@radix-ui/react-collapsible": "1.1.12",
"@radix-ui/react-dialog": "1.1.15", "@radix-ui/react-dialog": "1.1.15",
"@radix-ui/react-dropdown-menu": "2.1.16", "@radix-ui/react-dropdown-menu": "2.1.16",
"@radix-ui/react-icons": "1.3.2", "@radix-ui/react-icons": "1.3.2",
"@radix-ui/react-label": "2.1.7", "@radix-ui/react-label": "2.1.8",
"@radix-ui/react-popover": "1.1.15", "@radix-ui/react-popover": "1.1.15",
"@radix-ui/react-progress": "^1.1.7", "@radix-ui/react-progress": "^1.1.8",
"@radix-ui/react-radio-group": "1.3.8", "@radix-ui/react-radio-group": "1.3.8",
"@radix-ui/react-scroll-area": "^1.2.10", "@radix-ui/react-scroll-area": "^1.2.10",
"@radix-ui/react-select": "2.2.6", "@radix-ui/react-select": "2.2.6",
"@radix-ui/react-separator": "1.1.7", "@radix-ui/react-separator": "1.1.8",
"@radix-ui/react-slot": "1.2.3", "@radix-ui/react-slot": "1.2.4",
"@radix-ui/react-switch": "1.2.6", "@radix-ui/react-switch": "1.2.6",
"@radix-ui/react-tabs": "1.1.13", "@radix-ui/react-tabs": "1.1.13",
"@radix-ui/react-toast": "1.2.15", "@radix-ui/react-toast": "1.2.15",
@@ -65,7 +65,7 @@
"@tailwindcss/forms": "^0.5.10", "@tailwindcss/forms": "^0.5.10",
"@tanstack/react-table": "8.21.3", "@tanstack/react-table": "8.21.3",
"arctic": "^3.7.0", "arctic": "^3.7.0",
"axios": "^1.13.1", "axios": "^1.13.2",
"better-sqlite3": "11.7.0", "better-sqlite3": "11.7.0",
"canvas-confetti": "1.9.4", "canvas-confetti": "1.9.4",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
@@ -78,8 +78,8 @@
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"date-fns": "4.1.0", "date-fns": "4.1.0",
"drizzle-orm": "0.44.7", "drizzle-orm": "0.44.7",
"eslint": "9.39.0", "eslint": "9.39.1",
"eslint-config-next": "16.0.1", "eslint-config-next": "16.0.3",
"express": "5.1.0", "express": "5.1.0",
"express-rate-limit": "8.2.1", "express-rate-limit": "8.2.1",
"glob": "11.0.3", "glob": "11.0.3",
@@ -89,12 +89,12 @@
"input-otp": "1.4.2", "input-otp": "1.4.2",
"ioredis": "5.8.2", "ioredis": "5.8.2",
"jmespath": "^0.16.0", "jmespath": "^0.16.0",
"js-yaml": "4.1.0", "js-yaml": "4.1.1",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"lucide-react": "^0.552.0", "lucide-react": "^0.552.0",
"maxmind": "5.0.0", "maxmind": "5.0.1",
"moment": "2.30.1", "moment": "2.30.1",
"next": "15.5.6", "next": "15.5.7",
"next-intl": "^4.4.0", "next-intl": "^4.4.0",
"next-themes": "0.4.6", "next-themes": "0.4.6",
"nextjs-toploader": "^3.9.17", "nextjs-toploader": "^3.9.17",
@@ -105,7 +105,7 @@
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"oslo": "1.2.1", "oslo": "1.2.1",
"pg": "^8.16.2", "pg": "^8.16.2",
"posthog-node": "^5.11.0", "posthog-node": "^5.11.2",
"qrcode.react": "4.2.0", "qrcode.react": "4.2.0",
"react": "19.2.0", "react": "19.2.0",
"react-day-picker": "9.11.1", "react-day-picker": "9.11.1",
@@ -115,7 +115,7 @@
"react-icons": "^5.5.0", "react-icons": "^5.5.0",
"rebuild": "0.1.2", "rebuild": "0.1.2",
"reodotdev": "^1.0.0", "reodotdev": "^1.0.0",
"resend": "^6.4.0", "resend": "^6.4.2",
"semver": "^7.7.3", "semver": "^7.7.3",
"stripe": "18.2.1", "stripe": "18.2.1",
"swagger-ui-express": "^5.0.1", "swagger-ui-express": "^5.0.1",
@@ -147,7 +147,7 @@
"@types/js-yaml": "4.0.9", "@types/js-yaml": "4.0.9",
"@types/jsonwebtoken": "^9.0.10", "@types/jsonwebtoken": "^9.0.10",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@types/node": "24.9.2", "@types/node": "24.10.1",
"@types/nodemailer": "7.0.3", "@types/nodemailer": "7.0.3",
"@types/pg": "8.15.6", "@types/pg": "8.15.6",
"@types/react": "19.2.2", "@types/react": "19.2.2",
@@ -157,8 +157,8 @@
"@types/ws": "8.18.1", "@types/ws": "8.18.1",
"@types/yargs": "17.0.34", "@types/yargs": "17.0.34",
"drizzle-kit": "0.31.6", "drizzle-kit": "0.31.6",
"esbuild": "0.25.12", "esbuild": "0.27.0",
"esbuild-node-externals": "1.18.0", "esbuild-node-externals": "1.19.1",
"postcss": "^8", "postcss": "^8",
"react-email": "4.3.2", "react-email": "4.3.2",
"tailwindcss": "^4.1.4", "tailwindcss": "^4.1.4",

View File

@@ -79,6 +79,12 @@ export function createApiServer() {
// Add request timeout middleware // Add request timeout middleware
apiServer.use(requestTimeoutMiddleware(60000)); // 60 second timeout apiServer.use(requestTimeoutMiddleware(60000)); // 60 second timeout
apiServer.use(logIncomingMiddleware);
if (build !== "oss") {
apiServer.use(`${prefix}/hybrid`, hybridRouter); // put before rate limiting because we will rate limit there separately because some of the routes are heavily used
}
if (!dev) { if (!dev) {
apiServer.use( apiServer.use(
rateLimit({ rateLimit({
@@ -101,11 +107,7 @@ export function createApiServer() {
} }
// API routes // API routes
apiServer.use(logIncomingMiddleware);
apiServer.use(prefix, unauthenticated); apiServer.use(prefix, unauthenticated);
if (build !== "oss") {
apiServer.use(`${prefix}/hybrid`, hybridRouter);
}
apiServer.use(prefix, authenticated); apiServer.use(prefix, authenticated);
// WebSocket routes // WebSocket routes

View File

@@ -72,6 +72,43 @@ export class RateLimitService {
return `ratelimit:${clientId}:${messageType}`; return `ratelimit:${clientId}:${messageType}`;
} }
// Helper function to clean up old timestamp fields from a Redis hash
private async cleanupOldTimestamps(key: string, windowStart: number): Promise<void> {
if (!redisManager.isRedisEnabled()) return;
try {
const client = redisManager.getClient();
if (!client) return;
// Get all fields in the hash
const allData = await redisManager.hgetall(key);
if (!allData || Object.keys(allData).length === 0) return;
// Find fields that are older than the window
const fieldsToDelete: string[] = [];
for (const timestamp of Object.keys(allData)) {
const time = parseInt(timestamp);
if (time < windowStart) {
fieldsToDelete.push(timestamp);
}
}
// Delete old fields in batches to avoid call stack size exceeded errors
// The spread operator can cause issues with very large arrays
if (fieldsToDelete.length > 0) {
const batchSize = 1000; // Process 1000 fields at a time
for (let i = 0; i < fieldsToDelete.length; i += batchSize) {
const batch = fieldsToDelete.slice(i, i + batchSize);
await client.hdel(key, ...batch);
}
logger.debug(`Cleaned up ${fieldsToDelete.length} old timestamp fields from ${key}`);
}
} catch (error) {
logger.error(`Failed to cleanup old timestamps for key ${key}:`, error);
// Don't throw - cleanup failures shouldn't block rate limiting
}
}
// Helper function to sync local rate limit data to Redis // Helper function to sync local rate limit data to Redis
private async syncRateLimitToRedis( private async syncRateLimitToRedis(
clientId: string, clientId: string,
@@ -81,8 +118,12 @@ export class RateLimitService {
try { try {
const currentTime = Math.floor(Date.now() / 1000); const currentTime = Math.floor(Date.now() / 1000);
const windowStart = currentTime - RATE_LIMIT_WINDOW;
const globalKey = this.getRateLimitKey(clientId); const globalKey = this.getRateLimitKey(clientId);
// Clean up old timestamp fields before writing
await this.cleanupOldTimestamps(globalKey, windowStart);
// Get current value and add pending count // Get current value and add pending count
const currentValue = await redisManager.hget( const currentValue = await redisManager.hget(
globalKey, globalKey,
@@ -93,7 +134,7 @@ export class RateLimitService {
).toString(); ).toString();
await redisManager.hset(globalKey, currentTime.toString(), newValue); await redisManager.hset(globalKey, currentTime.toString(), newValue);
// Set TTL using the client directly // Set TTL using the client directly - this prevents the key from persisting forever
if (redisManager.getClient()) { if (redisManager.getClient()) {
await redisManager await redisManager
.getClient() .getClient()
@@ -119,8 +160,12 @@ export class RateLimitService {
try { try {
const currentTime = Math.floor(Date.now() / 1000); const currentTime = Math.floor(Date.now() / 1000);
const windowStart = currentTime - RATE_LIMIT_WINDOW;
const messageTypeKey = this.getMessageTypeRateLimitKey(clientId, messageType); const messageTypeKey = this.getMessageTypeRateLimitKey(clientId, messageType);
// Clean up old timestamp fields before writing
await this.cleanupOldTimestamps(messageTypeKey, windowStart);
// Get current value and add pending count // Get current value and add pending count
const currentValue = await redisManager.hget( const currentValue = await redisManager.hget(
messageTypeKey, messageTypeKey,
@@ -135,7 +180,7 @@ export class RateLimitService {
newValue newValue
); );
// Set TTL using the client directly // Set TTL using the client directly - this prevents the key from persisting forever
if (redisManager.getClient()) { if (redisManager.getClient()) {
await redisManager await redisManager
.getClient() .getClient()
@@ -170,6 +215,10 @@ export class RateLimitService {
try { try {
const globalKey = this.getRateLimitKey(clientId); const globalKey = this.getRateLimitKey(clientId);
// Clean up old timestamp fields before reading
await this.cleanupOldTimestamps(globalKey, windowStart);
const globalRateLimitData = await redisManager.hgetall(globalKey); const globalRateLimitData = await redisManager.hgetall(globalKey);
let count = 0; let count = 0;
@@ -215,6 +264,10 @@ export class RateLimitService {
try { try {
const messageTypeKey = this.getMessageTypeRateLimitKey(clientId, messageType); const messageTypeKey = this.getMessageTypeRateLimitKey(clientId, messageType);
// Clean up old timestamp fields before reading
await this.cleanupOldTimestamps(messageTypeKey, windowStart);
const messageTypeRateLimitData = await redisManager.hgetall(messageTypeKey); const messageTypeRateLimitData = await redisManager.hgetall(messageTypeKey);
let count = 0; let count = 0;

View File

@@ -16,7 +16,7 @@ import privateConfig from "#private/lib/config";
import logger from "@server/logger"; import logger from "@server/logger";
export enum AudienceIds { export enum AudienceIds {
SignUps = "5cfbf99b-c592-40a9-9b8a-577a4681c158", SignUps = "6c4e77b2-0851-4bd6-bac8-f51f91360f1a",
Subscribed = "870b43fd-387f-44de-8fc1-707335f30b20", Subscribed = "870b43fd-387f-44de-8fc1-707335f30b20",
Churned = "f3ae92bd-2fdb-4d77-8746-2118afd62549", Churned = "f3ae92bd-2fdb-4d77-8746-2118afd62549",
Newsletter = "5500c431-191c-42f0-a5d4-8b6d445b4ea0" Newsletter = "5500c431-191c-42f0-a5d4-8b6d445b4ea0"

View File

@@ -227,6 +227,8 @@ export type UserSessionWithUser = {
export const hybridRouter = Router(); export const hybridRouter = Router();
hybridRouter.use(verifySessionRemoteExitNodeMiddleware); hybridRouter.use(verifySessionRemoteExitNodeMiddleware);
// TODO: ADD RATE LIMITING TO THESE ROUTES AS NEEDED BASED ON USAGE PATTERNS
hybridRouter.get( hybridRouter.get(
"/general-config", "/general-config",
async (req: Request, res: Response, next: NextFunction) => { async (req: Request, res: Response, next: NextFunction) => {

View File

@@ -1 +1,14 @@
/*
* This file is part of a proprietary work.
*
* Copyright (c) 2025 Fossorial, Inc.
* All rights reserved.
*
* This file is licensed under the Fossorial Commercial License.
* You may not use this file except in compliance with the License.
* Unauthorized use, copying, modification, or distribution is strictly prohibited.
*
* This file is not licensed under the AGPLv3.
*/
export * from "./sendSupportEmail"; export * from "./sendSupportEmail";

View File

@@ -68,7 +68,7 @@ export async function sendSupportEmail(
{ {
name: req.user?.email || "Support User", name: req.user?.email || "Support User",
to: "support@pangolin.net", to: "support@pangolin.net",
from: req.user?.email || config.getNoReplyEmail(), from: config.getNoReplyEmail(),
subject: `Support Request: ${subject}` subject: `Support Request: ${subject}`
} }
); );

View File

@@ -30,7 +30,8 @@ export const signupBodySchema = z.object({
password: passwordSchema, password: passwordSchema,
inviteToken: z.string().optional(), inviteToken: z.string().optional(),
inviteId: z.string().optional(), inviteId: z.string().optional(),
termsAcceptedTimestamp: z.string().nullable().optional() termsAcceptedTimestamp: z.string().nullable().optional(),
marketingEmailConsent: z.boolean().optional()
}); });
export type SignUpBody = z.infer<typeof signupBodySchema>; export type SignUpBody = z.infer<typeof signupBodySchema>;
@@ -55,7 +56,7 @@ export async function signup(
); );
} }
const { email, password, inviteToken, inviteId, termsAcceptedTimestamp } = const { email, password, inviteToken, inviteId, termsAcceptedTimestamp, marketingEmailConsent } =
parsedBody.data; parsedBody.data;
const passwordHash = await hashPassword(password); const passwordHash = await hashPassword(password);
@@ -220,8 +221,8 @@ export async function signup(
new Date(sess.expiresAt) new Date(sess.expiresAt)
); );
res.appendHeader("Set-Cookie", cookie); res.appendHeader("Set-Cookie", cookie);
if (build == "saas" && marketingEmailConsent) {
if (build == "saas") { logger.debug(`User ${email} opted in to marketing emails during signup.`);
moveEmailToAudience(email, AudienceIds.SignUps); moveEmailToAudience(email, AudienceIds.SignUps);
} }

View File

@@ -92,7 +92,8 @@ const formSchema = z
message: message:
"You must agree to the terms of service and privacy policy" "You must agree to the terms of service and privacy policy"
} }
) ),
marketingEmailConsent: z.boolean().optional()
}) })
.refine((data) => data.password === data.confirmPassword, { .refine((data) => data.password === data.confirmPassword, {
path: ["confirmPassword"], path: ["confirmPassword"],
@@ -123,7 +124,8 @@ export default function SignupForm({
email: emailParam || "", email: emailParam || "",
password: "", password: "",
confirmPassword: "", confirmPassword: "",
agreeToTerms: false agreeToTerms: false,
marketingEmailConsent: false
}, },
mode: "onChange" // Enable real-time validation mode: "onChange" // Enable real-time validation
}); });
@@ -135,7 +137,7 @@ export default function SignupForm({
passwordValue === confirmPasswordValue; passwordValue === confirmPasswordValue;
async function onSubmit(values: z.infer<typeof formSchema>) { async function onSubmit(values: z.infer<typeof formSchema>) {
const { email, password } = values; const { email, password, marketingEmailConsent } = values;
setLoading(true); setLoading(true);
const res = await api const res = await api
@@ -144,7 +146,8 @@ export default function SignupForm({
password, password,
inviteId, inviteId,
inviteToken, inviteToken,
termsAcceptedTimestamp: termsAgreedAt termsAcceptedTimestamp: termsAgreedAt,
marketingEmailConsent: build === "saas" ? marketingEmailConsent : undefined
}) })
.catch((e) => { .catch((e) => {
console.error(e); console.error(e);
@@ -489,56 +492,78 @@ export default function SignupForm({
)} )}
/> />
{build === "saas" && ( {build === "saas" && (
<FormField <>
control={form.control} <FormField
name="agreeToTerms" control={form.control}
render={({ field }) => ( name="agreeToTerms"
<FormItem className="flex flex-row items-center"> render={({ field }) => (
<FormControl> <FormItem className="flex flex-row items-center">
<Checkbox <FormControl>
checked={field.value} <Checkbox
onCheckedChange={(checked) => { checked={field.value}
field.onChange(checked); onCheckedChange={(checked) => {
handleTermsChange( field.onChange(checked);
checked as boolean handleTermsChange(
); checked as boolean
}} );
/> }}
</FormControl> />
<div className="leading-none"> </FormControl>
<FormLabel className="text-sm font-normal"> <div className="leading-none">
<div> <FormLabel className="text-sm font-normal">
{t( <div>
"signUpTerms.IAgreeToThe"
)}{" "}
<a
href="https://pangolin.net/terms-of-service.html"
target="_blank"
rel="noopener noreferrer"
className="text-primary hover:underline"
>
{t( {t(
"signUpTerms.termsOfService" "signUpTerms.IAgreeToThe"
)}{" "} )}{" "}
</a> <a
{t("signUpTerms.and")}{" "} href="https://pangolin.net/terms-of-service.html"
<a target="_blank"
href="https://pangolin.net/privacy-policy.html" rel="noopener noreferrer"
target="_blank" className="text-primary hover:underline"
rel="noopener noreferrer" >
className="text-primary hover:underline" {t(
> "signUpTerms.termsOfService"
{t( )}{" "}
"signUpTerms.privacyPolicy" </a>
)} {t("signUpTerms.and")}{" "}
</a> <a
</div> href="https://pangolin.net/privacy-policy.html"
</FormLabel> target="_blank"
<FormMessage /> rel="noopener noreferrer"
</div> className="text-primary hover:underline"
</FormItem> >
)} {t(
/> "signUpTerms.privacyPolicy"
)}
</a>
</div>
</FormLabel>
<FormMessage />
</div>
</FormItem>
)}
/>
<FormField
control={form.control}
name="marketingEmailConsent"
render={({ field }) => (
<FormItem className="flex flex-row items-start">
<FormControl>
<Checkbox
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
<div className="leading-none">
<FormLabel className="text-sm font-normal">
{t("signUpMarketing.keepMeInTheLoop")}
</FormLabel>
<FormMessage />
</div>
</FormItem>
)}
/>
</>
)} )}
{error && ( {error && (