Skip to content

Commit a79f583

Browse files
committed
fix security scanner issue
1 parent 1c7e528 commit a79f583

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

api/src/unraid-api/unraid-file-modifier/modifications/hosts.modification.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ export default class HostsModification extends FileModification {
1414
protected async generatePatch(overridePath?: string): Promise<string> {
1515
const originalContent = await readFile(this.filePath, 'utf8');
1616

17+
// Use a case-insensitive word-boundary regex so the hostname must appear as an independent token
18+
// prevents partial string & look-alike conflicts such as "keys.lime-technology.com.example.com"
19+
const hostPattern = /\bkeys\.lime-technology\.com\b/i;
20+
1721
const newContent = originalContent
1822
.split('\n')
19-
.filter((line) => !line.includes('keys.lime-technology.com'))
23+
.filter((line) => !hostPattern.test(line))
2024
.join('\n');
2125

2226
return this.createPatchWithDiff(overridePath ?? this.filePath, originalContent, newContent);

0 commit comments

Comments
 (0)