Skip to content

Commit

Permalink
fix: javascript.lang.security.audit.unsafe-formatstring.unsafe-format…
Browse files Browse the repository at this point in the history
…string
  • Loading branch information
zijiren233 committed Aug 19, 2024
1 parent 667272c commit d06aeff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/providers/template/src/utils/json-yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function evaluateExpression(expression: string, data?: {
[key: string]: any;
}): any | undefined {
try {
// console.log(`expression: ${expression}\ndata: `, data)
// console.log("expression: ", expression, " data: ", data)
// const result = new Function('data', `with(data) { return ${expression}; }`)(data);
const initInterpreterFunc = (interpreter: any, ctx: any) => {
interpreter.setProperty(ctx, 'data', interpreter.nativeToPseudo(data));
Expand All @@ -166,7 +166,7 @@ export function evaluateExpression(expression: string, data?: {
// console.log('resoult: ', interpreter.value)
return interpreter.value;
} catch (error) {
console.error(`Failed to evaluate expression: ${expression}`, error, "data: ", data);
console.error("Failed to evaluate expression: ", expression, " data: ", data, error);
return undefined;
}
};
Expand Down

0 comments on commit d06aeff

Please sign in to comment.