huge update.
fix issues with failing tests (I'm just gonna fucking assume directx isn't installed on the github actions machines). Added MUCH better RBAC support and control Fixed an issue when you have over a million clients RBAC would be slow asf Add settings page with some basic settings and configs you can change.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { getConfig } from "./config";
|
||||
import { isRateLimited, recordFailedAttempt, recordSuccessfulAttempt } from "./rateLimit";
|
||||
|
||||
describe("rateLimit", () => {
|
||||
test("locks out after repeated failures", () => {
|
||||
const maxAttempts = Math.max(1, Number(getConfig().security.loginMaxAttempts) || 5);
|
||||
const ip = `10.0.0.${Date.now()}`;
|
||||
for (let i = 0; i < 5; i += 1) {
|
||||
for (let i = 0; i < maxAttempts; i += 1) {
|
||||
recordFailedAttempt(ip);
|
||||
}
|
||||
|
||||
@@ -14,8 +16,9 @@ describe("rateLimit", () => {
|
||||
});
|
||||
|
||||
test("successful attempt clears lock state", () => {
|
||||
const maxAttempts = Math.max(1, Number(getConfig().security.loginMaxAttempts) || 5);
|
||||
const ip = `10.0.1.${Date.now()}`;
|
||||
for (let i = 0; i < 5; i += 1) {
|
||||
for (let i = 0; i < maxAttempts; i += 1) {
|
||||
recordFailedAttempt(ip);
|
||||
}
|
||||
expect(isRateLimited(ip).limited).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user