fix(arangoDBPlugin): prevent AQL injection via unsafe string concatenation#41641
Merged
fix(arangoDBPlugin): prevent AQL injection via unsafe string concatenation#41641
Conversation
…ation Sanitize collection names and escape string values in AQL query templates generated by StructureUtils to prevent AQL injection. Changes: - Add sanitizeCollectionName() that backtick-quotes collection names, escaping internal backticks per AQL identifier quoting rules. - Add escapeAqlStringLiteral() that escapes backslashes, double quotes, and newlines in string values embedded in AQL queries. - Apply sanitization to generateSelectTemplate, generateCreateTemplate, generateUpdateTemplate, generateRemoveTemplate, and getOneDocumentQuery. - Add StructureUtilsTest with 15 tests covering normal usage, null handling, and injection attempts via both collection names and filter values. Co-authored-by: subratadeypappu <subrata71@users.noreply.github.com>
Contributor
WalkthroughThe ArangoDB plugin now sanitizes collection names and string filter values in AQL query construction through two new helper methods, treating untrusted inputs as potentially malicious and escaping them to prevent injection attacks. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
NilanshBansal
approved these changes
Mar 23, 2026
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.
Description
Fixes an AQL (ArangoDB Query Language) injection vulnerability in the ArangoDB plugin where user-provided inputs (collection names, filter keys, and values) were concatenated directly into query strings without sanitization or parameter binding.
TL;DR: The
StructureUtilsclass constructed AQL queries via unsafe string concatenation, allowing attackers to manipulate query structure and execute arbitrary AQL commands. This fix introduces proper escaping for string literals and backtick-quoting for collection names.Vulnerability Details
The methods
generateSelectTemplate,generateCreateTemplate,generateUpdateTemplate,generateRemoveTemplate, andgetOneDocumentQueryinStructureUtils.javawere vulnerable to AQL injection. For example:An attacker controlling
filterValue(e.g.," OR 1==1 RETURN document //) could force the query to return all documents.Fix
sanitizeCollectionName()- Backtick-quotes collection names for safe AQL identifier inclusion, escaping internal backticks by doubling them per AQL quoting rules.escapeAqlStringLiteral()- Escapes\,",\n,\rin string values for safe inclusion within double-quoted AQL string literals.Advisory
Fixes https://linear.app/appsmith/issue/APP-15027/aql-injection-in-arangodb-plugin-via-unsafe-string-concatenation
Automation
/ok-to-test tags="@tag.All"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/23336206945
Commit: 9d43228
Cypress dashboard.
Tags:
@tag.AllSpec:
Fri, 20 Mar 2026 10:21:45 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
Bug Fixes
Tests