Skip to content

Commit

Permalink
prevent regex backtracking
Browse files Browse the repository at this point in the history
  • Loading branch information
dbauszus-glx committed Nov 2, 2023
1 parent 05ec21f commit d3d551e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mod/provider/cloudfront.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = async ref => {
try {

// Subtitutes {*} with process.env.SRC_* key values.
const url = (ref.params?.url || ref).replace(/[{](.*?)[}]/g,
const url = (ref.params?.url || ref).replace(/{(?!{)(.*?)}/g,
matched => process.env[`SRC_${matched.replace(/(^{)|(}$)/g, '')}`])

const date = new Date(Date.now())
Expand Down
2 changes: 1 addition & 1 deletion mod/provider/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = async ref => {
try {

// Subtitutes {*} with process.env.SRC_* key values.
const path = (ref.params?.url || ref).replace(/[{](.*?)[}]/g,
const path = (ref.params?.url || ref).replace(/{(?!{)(.*?)}/g,
matched => process.env[`SRC_${matched.replace(/(^{)|(}$)/g, '')}`])

const file = readFileSync(join(__dirname, `../../${path}`))
Expand Down

0 comments on commit d3d551e

Please sign in to comment.