fix(reports): derive report SELECT aliases from the whitelist #472
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-690-report-alias-injection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The saved-report compiler wrote the caller's column
headerstraight into the SELECT list as a quoted identifier, so aheadercarrying a"closed the identifier and appended arbitrary SQL to the compiled query. The alias was the one value that escaped the whitelist discipline the field, filter and sort paths already have.The SQL alias now comes from the whitelisted field key that
ticket_columnaccepts, so nocolumnspayload reaches the SQL text.CompiledQuerycarries the SQL output names in a newcolumnsvector and the operator-chosen display headers inaliases; the executor re-keys eachrow_to_jsonobject from the former to the latter, so the wire shape (rows keyed by header,aliaseslisting the headers) is unchanged for the SPA and for the scheduled-report CSV render. A field selected twice gets a_2suffix on its SQL alias so the two columns keep distinct row keys.parse_columnsadditionally rejects a header containing a double quote or longer than 100 characters with a 400, so a hostile payload fails loudly instead of rendering under a different name.#PMS-690