Skip to content

Commit d047312

Browse files
Potential fix for code scanning alert no. 36: Uncontrolled data used in path expression
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 90f5591 commit d047312

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/server/routes/change_hc_version.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ export default (app) =>
5151

5252
// Compare versions
5353
const newVersion = request.params.newVersion;
54-
if (newVersion) {
54+
// Accept only version strings containing digits, letters, dots, hyphens
55+
if (
56+
newVersion &&
57+
/^[a-zA-Z0-9.\-]+$/.test(newVersion)
58+
) {
5559
try {
5660
// eslint-disable-next-line import/no-named-as-default-member
5761
await updateVersion(newVersion);

0 commit comments

Comments
 (0)