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 analytics/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import js from "@eslint/js";
import securityPlugin from "eslint-plugin-security";
import tseslint from "typescript-eslint";

export default tseslint.config(
Expand Down Expand Up @@ -62,6 +63,24 @@ export default tseslint.config(
"object-shorthand": "error",
},
},
// Security hotspot rules (eslint-plugin-security): recommended set on source files,
// noisy/irrelevant rules off. detect-object-injection fires on every computed property
// access; the CSRF/mustache rules assume Express/server-side templates we don't use;
// Buffer noAssert is a deprecated pattern. Unambiguous rules are errors.
{
files: ["**/*.ts"],
ignores: ["test/**", "**/*.test.ts"],
plugins: { security: securityPlugin },
rules: {
...securityPlugin.configs.recommended.rules,
"security/detect-object-injection": "off",
"security/detect-no-csrf-before-method-override": "off",
"security/detect-disable-mustache-escape": "off",
"security/detect-buffer-noassert": "off",
"security/detect-pseudoRandomBytes": "error",
"security/detect-eval-with-expression": "error",
},
},
// Test files: vitest globals + relax unsafe rules (mocks are inherently untyped)
{
files: ["test/**/*.ts", "**/*.test.ts"],
Expand Down
47 changes: 42 additions & 5 deletions analytics/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@vitest/coverage-v8": "^5.1.0",
"dotenv": "^18.0.10",
"eslint": "^10.15.0",
"eslint-plugin-security": "^4.2.1",
"prettier": "^3.10.1",
"serverless-scaleway-functions": ">=0.4.16",
"tsdown": "^0.23.7",
Expand Down
4 changes: 4 additions & 0 deletions analytics/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ export class FileHitStorage implements HitStorage {

async getWithMeta(key: string): Promise<GetResult | null> {
const filePath = this.pathFor(key);
// eslint-disable-next-line security/detect-non-literal-fs-filename -- key = pinned ALLOWED_SITE + UTC timestamp, never request data
if (!existsSync(filePath)) {
return null;
}
// eslint-disable-next-line security/detect-non-literal-fs-filename -- same key derivation as above
const body = await readFile(filePath, "utf8");
return { body, etag: this.etagOf(body) };
}
Expand All @@ -73,7 +75,9 @@ export class FileHitStorage implements HitStorage {
return { ok: false, status: 412 };
}
const filePath = this.pathFor(key);
// eslint-disable-next-line security/detect-non-literal-fs-filename -- same key derivation as above
await mkdir(path.dirname(filePath), { recursive: true });
// eslint-disable-next-line security/detect-non-literal-fs-filename -- same key derivation as above
await writeFile(filePath, body, "utf8");
return { ok: true, etag: this.etagOf(body) };
}
Expand Down
18 changes: 18 additions & 0 deletions bunny_js/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import js from "@eslint/js";
import securityPlugin from "eslint-plugin-security";
import tseslint from "typescript-eslint";

export default tseslint.config(
Expand Down Expand Up @@ -47,6 +48,23 @@ export default tseslint.config(
"object-shorthand": "error",
},
},
// Security hotspot rules (eslint-plugin-security): recommended set on source files,
// noisy/irrelevant rules off. detect-object-injection fires on every computed property
// access; the CSRF/mustache rules assume Express/server-side templates we don't use;
// Buffer noAssert is a deprecated pattern. Unambiguous rules are errors.
{
files: ["src/**/*.ts", "scripts/**/*.ts"],
plugins: { security: securityPlugin },
rules: {
...securityPlugin.configs.recommended.rules,
"security/detect-object-injection": "off",
"security/detect-no-csrf-before-method-override": "off",
"security/detect-disable-mustache-escape": "off",
"security/detect-buffer-noassert": "off",
"security/detect-pseudoRandomBytes": "error",
"security/detect-eval-with-expression": "error",
},
},
// Test files: type-aware like the rest of the package, plus vitest globals.
{
files: ["test/**/*.ts", "**/*.test.ts"],
Expand Down
47 changes: 42 additions & 5 deletions bunny_js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bunny_js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@vitest/coverage-v8": "^5.1.0",
"@vitest/eslint-plugin": "^1.6.27",
"eslint": "^10.0.0",
"eslint-plugin-security": "^4.2.1",
"prettier": "^3.6.2",
"tsdown": "^0.23.1",
"tsx": "^4.23.15",
Expand Down
19 changes: 19 additions & 0 deletions comment_service/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import js from "@eslint/js";
import securityPlugin from "eslint-plugin-security";
import tseslint from "typescript-eslint";

export default tseslint.config(
Expand Down Expand Up @@ -49,6 +50,24 @@ export default tseslint.config(
"object-shorthand": "error",
},
},
// Security hotspot rules (eslint-plugin-security): recommended set on source files,
// noisy/irrelevant rules off. detect-object-injection fires on every computed property
// access; the CSRF/mustache rules assume Express/server-side templates we don't use;
// Buffer noAssert is a deprecated pattern. Unambiguous rules are errors.
{
files: ["**/*.ts"],
ignores: ["test/**", "**/*.test.ts"],
plugins: { security: securityPlugin },
rules: {
...securityPlugin.configs.recommended.rules,
"security/detect-object-injection": "off",
"security/detect-no-csrf-before-method-override": "off",
"security/detect-disable-mustache-escape": "off",
"security/detect-buffer-noassert": "off",
"security/detect-pseudoRandomBytes": "error",
"security/detect-eval-with-expression": "error",
},
},
// Test files: vitest globals + relax unsafe rules (mocks are inherently untyped)
{
files: ["test/**/*.ts", "**/*.test.ts"],
Expand Down
37 changes: 37 additions & 0 deletions comment_service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions comment_service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@types/node": "^26.6.6",
"@vitest/coverage-v8": "^5.1.0",
"eslint": "^10.15.0",
"eslint-plugin-security": "^4.2.1",
"prettier": "^3.10.1",
"serverless-scaleway-functions": ">=0.4.16",
"tsdown": "^0.23.7",
Expand Down
18 changes: 18 additions & 0 deletions scw_js/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import js from "@eslint/js";
import securityPlugin from "eslint-plugin-security";
import tseslint from "typescript-eslint";

export default tseslint.config(
Expand Down Expand Up @@ -57,6 +58,23 @@ export default tseslint.config(
"object-shorthand": "error",
},
},
// Security hotspot rules (eslint-plugin-security): recommended set on source files,
// noisy/irrelevant rules off. detect-object-injection fires on every computed property
// access; the CSRF/mustache rules assume Express/server-side templates we don't use;
// Buffer noAssert is a deprecated pattern. Unambiguous rules are errors.
{
files: ["*.ts", "scripts/**/*.ts"],
plugins: { security: securityPlugin },
rules: {
...securityPlugin.configs.recommended.rules,
"security/detect-object-injection": "off",
"security/detect-no-csrf-before-method-override": "off",
"security/detect-disable-mustache-escape": "off",
"security/detect-buffer-noassert": "off",
"security/detect-pseudoRandomBytes": "error",
"security/detect-eval-with-expression": "error",
},
},
// Test files: type-aware like the rest of the package (now in tsconfig's `include`), plus
// vitest globals.
{
Expand Down
Loading