Skip to content

fix(interfaces): validate WHERE clause column names in UQI filtering - #42224

Merged
wyattwalter merged 1 commit into
releasefrom
fix/uqi-where-clause-column-validation
Sep 11, 2026
Merged

fix(interfaces): validate WHERE clause column names in UQI filtering#42224
wyattwalter merged 1 commit into
releasefrom
fix/uqi-where-clause-column-validation

Conversation

@wyattwalter

@wyattwalter wyattwalter commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Description

Hardens column handling in the WHERE clause of UQI in-memory filtering (used by the Google Sheets and Amazon S3 plugins).

  • FilterDataServiceCE.filterDataNew() checks every column referenced in the WHERE condition, including nested AND/OR groups, against the columns present in the data before building the query. Unknown columns return a validation error.
  • Quote characters in column identifiers are escaped in the generated filter expression.

Advisory: GHSA-cm7r-f7h3-q33p
Part of https://linear.app/appsmith/issue/APP-15874

Testing

  • Server unit tests

New tests in FilterDataServiceTest:

  • testWhereWithUnknownColumn_throwsException
  • testWhereWithUnknownColumnInNestedGroup_throwsException
  • testWhereWithColumnNameContainingQuote_throwsException
  • testWhereWithKnownColumn_filtersRows
  • testGenerateLogicalExpression_quotesColumnNameContainingQuote

Impact on existing instances

  • Working queries: no change.
  • A WHERE condition on a column that isn't in the data already failed; it now fails before the query is built, with <column> not found in the known column names, instead of an in-memory database error.
  • Rollback: restores the previous behavior.

Automation

/ok-to-test tags="@tag.All"

Communication

  • No

🤖 Generated with Claude Code

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/34604046075
Commit: 5633f15
Cypress dashboard.
Tags: @tag.All
Spec:


Fri, 11 Sep 2026 14:25:05 UTC

Summary by CodeRabbit

  • Bug Fixes
    • Filtering now rejects conditions that reference unknown or invalid column paths.
    • Nested AND and OR conditions are validated consistently.
    • Column names containing quotation marks are handled safely when generating filter queries.
    • Valid filters continue to work as expected.

Check every column referenced in a WHERE condition, including nested
AND/OR groups, against the columns present in the data before building
the filter query, and escape quote characters in column identifiers.

GHSA: https://github.com/appsmithorg/appsmith/security/advisories/GHSA-cm7r-f7h3-q33p

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Sep 11, 2026

Copy link
Copy Markdown

APP-15874

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 1a8740f1-9842-4aa6-a961-fdca16ab507d

📥 Commits

Reviewing files that changed from the base of the PR and between 179453b and 5633f15.

📒 Files selected for processing (2)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/services/ce/FilterDataServiceCE.java
  • app/server/appsmith-interfaces/src/test/java/com/appsmith/external/services/FilterDataServiceTest.java

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The filter service now validates condition column paths against the generated schema, including nested conditions. SQL generation escapes embedded double quotes. Tests cover invalid paths, valid filtering, plugin errors, and quote escaping.

Changes

Condition filtering

Layer / File(s) Summary
Condition validation
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/services/ce/FilterDataServiceCE.java, app/server/appsmith-interfaces/src/test/java/com/appsmith/external/services/FilterDataServiceTest.java
filterDataNew validates direct and nested condition paths against the schema. Tests verify rejected unknown columns, accepted known columns, and plugin error details.
SQL path escaping
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/services/ce/FilterDataServiceCE.java, app/server/appsmith-interfaces/src/test/java/com/appsmith/external/services/FilterDataServiceTest.java
Null checks and value comparisons escape embedded double quotes in condition paths. Tests verify the generated logical expressions.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: subrata71

Merge Risk: ⚪ Minimal · up to 5633f

The filtering changes validate referenced columns before query execution and consistently escape quoted identifiers. No merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: validating WHERE-clause column names in UQI filtering.
Description check ✅ Passed The description explains the motivation, implementation, security advisory, related issue, testing performed, impact, rollback behavior, and communication decision. It provides sufficient context for …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/uqi-where-clause-column-validation

Columns stand checked before queries flow
Nested branches now know what they show
Quotes double up in SQL’s bright stream
Known fields pass through the filtering scheme
Tests guard each path with a watchful glow

Comment @coderabbitai help to get the list of available commands.

@wyattwalter wyattwalter added the ok-to-test Required label for CI label Sep 11, 2026
@wyattwalter
wyattwalter marked this pull request as ready for review September 11, 2026 13:25
@wyattwalter
wyattwalter requested a review from a team as a code owner September 11, 2026 13:25
@wyattwalter
wyattwalter merged commit 084f282 into release Sep 11, 2026
101 checks passed
@wyattwalter
wyattwalter deleted the fix/uqi-where-clause-column-validation branch September 11, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants