Fix code scanning alert no. 2: Regular expression injection

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Jordan <128091138+jrichy1@users.noreply.github.com>
This commit is contained in:
Jordan 2024-10-14 01:46:35 -04:00 committed by GitHub
parent 7ccef37d55
commit 7dfca51f6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -33,7 +33,8 @@
},
"dependencies": {
"@actions/core": "1.10.1",
"@actions/exec": "1.1.1"
"@actions/exec": "1.1.1",
"lodash": "^4.17.21"
},
"devDependencies": {
"@commitlint/cli": "19.5.0",

View file

@ -1,5 +1,6 @@
import * as core from '@actions/core';
import path from 'path';
import _ from 'lodash';
interface EnvironmentVariable {
key: string;
@ -29,7 +30,7 @@ class Input {
constructor() {
const envRegexInput = core.getInput('env-regex');
const envRegex = envRegexInput
? new RegExp(envRegexInput)
? new RegExp(_.escapeRegExp(envRegexInput))
: this.options.envRegex;
this._environmentVariables = new Map(
Object.entries(process.env)