Skip to content

Commit fa756da

Browse files
CopilotChristopher-C-Robinson
authored andcommitted
Fix incomplete sanitization vulnerability by using replaceAll
Co-authored-by: Christopher-C-Robinson <78235938+Christopher-C-Robinson@users.noreply.github.com>
1 parent b626ca7 commit fa756da

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/extension.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ async function onSave(event: vscode.TextDocumentWillSaveEvent)
163163

164164
if (configuration.files.include.length > 0)
165165
{
166-
include = configuration.files.include.some(inc => matches(inc, sourceCodeFilePathRelative) || matches(inc, sourceCodeFilePathRelative.replace("../", "").replace("./", "")));
166+
include = configuration.files.include.some(inc => matches(inc, sourceCodeFilePathRelative) || matches(inc, sourceCodeFilePathRelative.replaceAll("../", "").replaceAll("./", "")));
167167
}
168168

169169
if (configuration.files.exclude.length > 0)
170170
{
171-
exclude = configuration.files.exclude.some(exc => matches(exc, sourceCodeFilePathRelative) || matches(exc, sourceCodeFilePathRelative.replace("../", "").replace("./", "")));
171+
exclude = configuration.files.exclude.some(exc => matches(exc, sourceCodeFilePathRelative) || matches(exc, sourceCodeFilePathRelative.replaceAll("../", "").replaceAll("./", "")));
172172
}
173173

174174
if (include && !exclude)
@@ -229,12 +229,12 @@ async function organize(sourceCodeFilePath: string, configuration: Configuration
229229

230230
if (configuration.files.include.length > 0)
231231
{
232-
include = configuration.files.include.some(inc => matches(inc, sourceCodeFilePathRelative) || matches(inc, sourceCodeFilePathRelative.replace("../", "").replace("./", "")));
232+
include = configuration.files.include.some(inc => matches(inc, sourceCodeFilePathRelative) || matches(inc, sourceCodeFilePathRelative.replaceAll("../", "").replaceAll("./", "")));
233233
}
234234

235235
if (configuration.files.exclude.length > 0)
236236
{
237-
exclude = configuration.files.exclude.some(exc => matches(exc, sourceCodeFilePathRelative) || matches(exc, sourceCodeFilePathRelative.replace("../", "").replace("./", "")));
237+
exclude = configuration.files.exclude.some(exc => matches(exc, sourceCodeFilePathRelative) || matches(exc, sourceCodeFilePathRelative.replaceAll("../", "").replaceAll("./", "")));
238238
}
239239

240240
if (include && !exclude)

0 commit comments

Comments
 (0)