Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions apps/dokploy/__test__/lib/id-format.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { generateAppName } from "@dokploy/server/db/schema/utils";
import { nanoid } from "nanoid";
import { describe, expect, it } from "vitest";

describe("id format", () => {
it("nanoid returns 21 url-safe characters", () => {
for (let i = 0; i < 100; i++) {
expect(nanoid()).toMatch(/^[A-Za-z0-9_-]{21}$/);
}
});

it("generateAppName ends with a 6-character lowercase suffix", () => {
for (let i = 0; i < 100; i++) {
const appName = generateAppName("app");
expect(appName.startsWith("app-")).toBe(true);
expect(appName).toMatch(/-[a-z1-9]{6}$/);
}
});
});
38 changes: 38 additions & 0 deletions apps/dokploy/__test__/security/bcrypt-hash-compat.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import bcrypt from "bcrypt";
import { describe, expect, it } from "vitest";

// Generated with bcrypt 5.1.1, the version these hashes were stored with.
const LEGACY_HASHES = [
{
label: "login password ($2b$, cost 10)",
password: "legacy-login-password",
hash: "$2b$10$OZR9Sl3nuE.yt3N7Uz77Eu./0x/5vtxeregQv82qIwpWTJvrXoMMy",
},
{
label: "super password ($2b$, cost 12)",
password: "legacy-super-password",
hash: "$2b$12$l/i9B3BhLSjMvj0tSNi90.ArVCiYRq4rZSccKNrYh2woqzIiyadES",
},
{
label: "$2a$ hash (cost 10)",
password: "legacy-basic-auth",
hash: "$2a$10$.3CLNohfPPBm3RvuTs/IQucFilfkHNwtftJP6si4XSzO3ir03pp2O",
},
];

describe("bcrypt hash compatibility", () => {
it.each(LEGACY_HASHES)(
"verifies a stored $label",
async ({ password, hash }) => {
expect(await bcrypt.compare(password, hash)).toBe(true);
expect(bcrypt.compareSync(password, hash)).toBe(true);
expect(await bcrypt.compare(`${password}-wrong`, hash)).toBe(false);
},
);

it("still produces $2b$ hashes that Traefik basic auth accepts", async () => {
const hash = await bcrypt.hash("basic-auth-password", 10);
expect(hash).toMatch(/^\$2b\$\d{2}\$[./A-Za-z0-9]{53}$/);
expect(await bcrypt.compare("basic-auth-password", hash)).toBe(true);
});
});
16 changes: 8 additions & 8 deletions apps/dokploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"@dokploy/trpc-openapi": "0.0.18",
"@faker-js/faker": "^10.6.0",
"@hookform/resolvers": "^5.9.2",
"@octokit/auth-app": "^6.1.4",
"@octokit/webhooks": "^13.9.1",
"@octokit/auth-app": "^8.3.1",
"@octokit/webhooks": "^14.2.0",
"@openpanel/nextjs": "^1.5.2",
"@react-email/components": "^1.0.12",
"@stepperize/react": "4.0.1",
Expand All @@ -93,15 +93,15 @@
"adm-zip": "^0.6.1",
"ai": "^7.0.153",
"ai-sdk-ollama": "^4.5.1",
"bcrypt": "5.1.1",
"bcrypt": "6.0.0",
"better-auth": "1.7.12",
"bl": "7.0.13",
"boxen": "^9.0.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"copy-to-clipboard": "^3.3.3",
"date-fns": "3.6.0",
"date-fns": "4.4.0",
"dockerode": "5.0.1",
"dompurify": "^3.4.17",
"dotenv": "18.0.9",
Expand All @@ -113,15 +113,15 @@
"lodash": "4.18.1",
"lucide-react": "^1.61.0",
"micromatch": "4.0.8",
"nanoid": "3.3.20",
"nanoid": "6.0.2",
"next": "16.4.3",
"next-themes": "^0.4.6",
"nextjs-toploader": "^3.9.17",
"node-os-utils": "2.0.5",
"node-os-utils": "3.1.0",
"node-pty": "1.1.0",
"node-schedule": "2.1.1",
"nodemailer": "10.2.1",
"octokit": "3.2.2",
"octokit": "5.0.5",
"pino": "10.4.0",
"pino-pretty": "13.2.0",
"postgres": "3.4.9",
Expand Down Expand Up @@ -159,7 +159,7 @@
},
"devDependencies": {
"@tailwindcss/postcss": "^4.3.3",
"@types/bcrypt": "5.0.2",
"@types/bcrypt": "6.0.0",
"@types/dompurify": "^3.2.0",
"@types/js-cookie": "^3.0.6",
"@types/lodash": "4.17.27",
Expand Down
Loading