fix(common): make SlickDataView filtering CSP-safe by default - #1285
Open
ghiscoding wants to merge 1 commit into
Open
fix(common): make SlickDataView filtering CSP-safe by default#1285ghiscoding wants to merge 1 commit into
ghiscoding wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
replicate Slickgrid-Universal PR 2774 into SlickGrid. You can see the included ChatGPT summary below.
Summary
Make
SlickDataViewfiltering CSP-safe by default by removing runtime filter compilation throughnew Function().The previous CSP-safe and non-CSP filtering paths are consolidated into a single callback-based implementation. Existing
inlineFiltersanduseCSPSafeFilteroptions remain accepted for backward compatibility, but are now deprecated no-ops because filtering is always CSP-safe.Why
The generated filter implementation required CSP policies to allow
unsafe-eval, which prevents strict Content Security Policy usage wheninlineFiltersis enabled.This repo uses
inlineFiltersin many examples and tests, so keeping the option accepted is important for backward compatibility. However, the option can no longer preserve its previous generated-code behavior if DataView filtering is to be unconditionally CSP-safe.Changes
new Function().setFilter(),getFilter(), and filtered item dispatch.inlineFiltersanduseCSPSafeFilter; both remain accepted but are ignored.FilterCspFnandFilterWithCspCachingFnaliases.useCSPSafeFilter.Not Included
Backward Compatibility
Existing code that passes
inlineFilters: trueoruseCSPSafeFilter: truecontinues to compile and run.The behavioral difference is that
inlineFiltersno longer enables generated runtime filtering. Filtering results remain compatible, but performance characteristics can change for consumers that relied on the old generated-code path.Because SlickGrid uses
inlineFiltersmore widely than the fork this was copied from, this trade-off affects more local examples and consumers. The copied PR’s benchmark notes that string-heavy predicates may be slower when compared with the old generatedFunctionpath, while default filtering and numeric/branch-heavy predicates are equivalent or improved.Validation
npm run build:typespassed.npm run lintpassed.npm run build:prodpassed.Checklist