mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 08:02:26 +00:00
fix: Resource secret heuristic is wrong (#2632)
This commit is contained in:
committed by
GitHub
parent
34abe01c2f
commit
0d6c1ec064
@@ -104,28 +104,29 @@
|
||||
|
||||
function linkedSecretValue(x: string) {
|
||||
let r = 0
|
||||
if (x.includes('secret')) {
|
||||
let lowerCasedX = x.toLowerCase()
|
||||
if (lowerCasedX.includes('secret')) {
|
||||
r += 10
|
||||
}
|
||||
if (x.includes('password')) {
|
||||
if (lowerCasedX.includes('password')) {
|
||||
r += 5
|
||||
}
|
||||
if (x.includes('private')) {
|
||||
if (lowerCasedX.includes('private')) {
|
||||
r += 4
|
||||
}
|
||||
if (x.includes('key')) {
|
||||
if (lowerCasedX.includes('key')) {
|
||||
r += 3
|
||||
}
|
||||
if (x.includes('token')) {
|
||||
if (lowerCasedX.includes('token')) {
|
||||
r += 2
|
||||
}
|
||||
if (x.includes('pass')) {
|
||||
if (lowerCasedX.includes('pass')) {
|
||||
r += 1
|
||||
}
|
||||
return r
|
||||
}
|
||||
$: linkedSecret = linkedSecretCandidates?.sort(
|
||||
(ua, ub) => linkedSecretValue(ua) - linkedSecretValue(ub)
|
||||
(ua, ub) => linkedSecretValue(ub) - linkedSecretValue(ua)
|
||||
)?.[0]
|
||||
|
||||
let scopes: string[] = []
|
||||
|
||||
Reference in New Issue
Block a user