fix: resolve CI lint failures across frontend and Go projects
Node.js bumped to 22 in lint workflow (pnpm 11.x requires >=22.13). Extract goconst-flagged string literals in secrets-scanner to named constants. Carry along monitor-dashboard docker/package fixes.
This commit is contained in:
parent
ca8382482b
commit
adeec9b36d
|
|
@ -123,7 +123,7 @@ jobs:
|
||||||
if: matrix.type == 'biome'
|
if: matrix.type == 'biome'
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '22'
|
||||||
|
|
||||||
- name: Setup pnpm
|
- name: Setup pnpm
|
||||||
if: matrix.type == 'biome'
|
if: matrix.type == 'biome'
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
FROM node:24-alpine
|
FROM node:24-alpine
|
||||||
|
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
RUN corepack enable && corepack prepare pnpm@10.29.1 --activate
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
FROM node:24-alpine AS build
|
FROM node:24-alpine AS build
|
||||||
|
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
RUN corepack enable && corepack prepare pnpm@10.29.1 --activate
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY frontend/package.json frontend/pnpm-lock.yaml* ./
|
COPY frontend/package.json frontend/pnpm-lock.yaml* frontend/.npmrc* ./
|
||||||
|
|
||||||
RUN pnpm install --frozen-lockfile || pnpm install
|
RUN pnpm install --frozen-lockfile || pnpm install
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
strict-dep-builds=false
|
||||||
|
|
@ -59,6 +59,10 @@
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"vite": "npm:rolldown-vite@7.2.5"
|
"vite": "npm:rolldown-vite@7.2.5"
|
||||||
}
|
},
|
||||||
|
"onlyBuiltDependencies": [
|
||||||
|
"@parcel/watcher",
|
||||||
|
"esbuild"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,9 @@ func (d *Detector) Detect(chunk types.Chunk) []types.Finding { //nolint:gocognit
|
||||||
charset := rules.DetectCharset(secret)
|
charset := rules.DetectCharset(secret)
|
||||||
var charsetStr string
|
var charsetStr string
|
||||||
switch charset {
|
switch charset {
|
||||||
case "hex":
|
case rules.CharsetNameHex:
|
||||||
charsetStr = rules.HexCharset
|
charsetStr = rules.HexCharset
|
||||||
case "base64":
|
case rules.CharsetNameBase64:
|
||||||
charsetStr = rules.Base64Charset
|
charsetStr = rules.Base64Charset
|
||||||
default:
|
default:
|
||||||
charsetStr = rules.AlphanumericCharset
|
charsetStr = rules.AlphanumericCharset
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -84,8 +84,8 @@ func TestIsPlaceholder(t *testing.T) { //nolint:dupl
|
||||||
secret: "your-api-key",
|
secret: "your-api-key",
|
||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
"placeholder": {
|
stopwordPlaceholder: {
|
||||||
secret: "placeholder",
|
secret: stopwordPlaceholder,
|
||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
"xxxx pattern": {
|
"xxxx pattern": {
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@ const (
|
||||||
Base64Charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=-_"
|
Base64Charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=-_"
|
||||||
HexCharset = "0123456789abcdefABCDEF"
|
HexCharset = "0123456789abcdefABCDEF"
|
||||||
AlphanumericCharset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
AlphanumericCharset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
||||||
|
|
||||||
|
CharsetNameHex = "hex"
|
||||||
|
CharsetNameBase64 = "base64"
|
||||||
|
CharsetNameAlphanumeric = "alphanumeric"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -98,19 +102,19 @@ func DetectCharset(s string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
if total == 0 {
|
if total == 0 {
|
||||||
return "alphanumeric"
|
return CharsetNameAlphanumeric
|
||||||
}
|
}
|
||||||
|
|
||||||
hexRatio := float64(hexCount) / float64(total)
|
hexRatio := float64(hexCount) / float64(total)
|
||||||
b64Ratio := float64(b64Count) / float64(total)
|
b64Ratio := float64(b64Count) / float64(total)
|
||||||
|
|
||||||
if hexRatio == 1.0 && isAllHexChars(s) {
|
if hexRatio == 1.0 && isAllHexChars(s) {
|
||||||
return "hex"
|
return CharsetNameHex
|
||||||
}
|
}
|
||||||
if b64Ratio >= 0.95 {
|
if b64Ratio >= 0.95 {
|
||||||
return "base64"
|
return CharsetNameBase64
|
||||||
}
|
}
|
||||||
return "alphanumeric"
|
return CharsetNameAlphanumeric
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExtractHighEntropyTokens(
|
func ExtractHighEntropyTokens(
|
||||||
|
|
|
||||||
|
|
@ -128,27 +128,27 @@ func TestDetectCharset(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
"hex string": {
|
"hex string": {
|
||||||
input: "a1b2c3d4e5f6",
|
input: "a1b2c3d4e5f6",
|
||||||
want: "hex",
|
want: CharsetNameHex,
|
||||||
},
|
},
|
||||||
"base64 with special chars": {
|
"base64 with special chars": {
|
||||||
input: "kR9mPx2vBnQ8jL5w+/YzTf==",
|
input: "kR9mPx2vBnQ8jL5w+/YzTf==",
|
||||||
want: "base64",
|
want: CharsetNameBase64,
|
||||||
},
|
},
|
||||||
"pure alphanumeric": {
|
"pure alphanumeric": {
|
||||||
input: "HelloWorld123XYZ",
|
input: "HelloWorld123XYZ",
|
||||||
want: "base64",
|
want: CharsetNameBase64,
|
||||||
},
|
},
|
||||||
"mixed with symbols": {
|
"mixed with symbols": {
|
||||||
input: "hello@world#foo$bar",
|
input: "hello@world#foo$bar",
|
||||||
want: "alphanumeric",
|
want: CharsetNameAlphanumeric,
|
||||||
},
|
},
|
||||||
"empty string": {
|
"empty string": {
|
||||||
input: "",
|
input: "",
|
||||||
want: "alphanumeric",
|
want: CharsetNameAlphanumeric,
|
||||||
},
|
},
|
||||||
"only hex digits": {
|
"only hex digits": {
|
||||||
input: "deadbeef0123456789",
|
input: "deadbeef0123456789",
|
||||||
want: "hex",
|
want: CharsetNameHex,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue