Skip to content

remove eval() - #646

Merged
borismasis merged 2 commits into
mapillary:mainfrom
k-yle:kh/eval
Oct 29, 2026
Merged

borismasis merged 2 commits into
mapillary:mainfrom
k-yle:kh/eval

Conversation

@k-yle

@k-yle k-yle commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Motivation

eval (or new Function) is considered dangerous and discouraged, even if this paticular usage is safe.

By using eval, this library prevents consumers from enabling stricter security settings like a Content Security Policy or Trusted Types.

Have you read the Contributing Guidelines?

yes

Contribution

Replaced eval/new Function with procedural code.

Instead of constructing the filter using code like return "!(" + expression + ")";, we now use actual JS code like return (x) => !f(x);

Test Plan

all the existing unit tests for FilterCreator.test.ts still pass

@meta-cla meta-cla Bot added the cla signed label Oct 19, 2026
@borismasis
borismasis merged commit 84fae01 into mapillary:main Oct 29, 2026
3 checks passed
@borismasis

Copy link
Copy Markdown
Member

Thank you for your contribution @k-yle !

@k-yle
k-yle deleted the kh/eval branch October 29, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants