Repository navigation
CNS-108 console: DOT fix for DataFlow Viz - #38272
Merged
Merged
Conversation
catalog strings produced malformed output. Add `dotString` and `dotAttributes`, and build every node, edge and subgraph through them, so escaping is applied uniformly instead of per call site. Moves the pure graph code to dataflowGraph.ts so it can be unit tested; most of the diff is that move. Closes: CNS-108
Alphadelta14
approved these changes
Aug 17, 2026
Alphadelta14
left a comment
Member
There was a problem hiding this comment.
feels like something we'd be leverage a library to do than handling ourselves. the edges are pretty sharp
| return [m, enrichedRoots[0], enrichedLirOperators]; | ||
| } | ||
|
|
||
| const noArrangementRegionColor = "#12b886"; |
Member
There was a problem hiding this comment.
probably want your constants up towards the top of the module. and don't we use UPPER_CASE_WITH_UNDERS for module consts?
| * brackets and commas regardless of what the catalog reported. | ||
| */ | ||
| export function stringifyAddress(address: string[]) { | ||
| return JSON.stringify(address.map((val) => parseInt(val))); |
Member
There was a problem hiding this comment.
does ts support direct functions? is this not just address.map(parseInt)?
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.
Excluding tests, 169 of 255 lines are relocated rather than new.
It's probably easier to review this on the command line with
--color-moved:Motivation
scopeToGvescaped only"when building DOT. A backslash in an interpolated value pairs with the inserted one to form\\, freeing the next quote to close the string early, so catalog text (operator names, LIR plan text) could inject DOT attributes. An injectedhrefrenders as an anchor in the SVG, giving script execution in the Console origin.Fixes: https://linear.app/materializeinc/issue/CNS-108/dataflow-visualizer-doesnt-escape-properly-allowing-xss
Description
Adds
dotString/dotAttributes, which escape backslashes before quotes. Every node, edge, pseudo-operator and subgraph builds its attributes through them, so no call site can interpolate raw text into an attribute position. Also covers the subgraph name, previously interpolated bare.The pure functions move to
dataflowGraph.tsso they are testable without loadingd3-graphviz. Most of the diff is that move plus testsVerification
dataflowGraph.test.tssplits emitted DOT into syntax and string context by Graphviz's own termination rule, then asserts injected text stays data in all four catalog-derived positions, thatArrangeBy[[Column(0, "id")]]round-trips, and that quote-only escaping would be caught.Manually confirmed that visualizations still render after refactor.