🔌 Dynamic Query Endpoint
/api/v1/etl/query
Executes a read-only SQL query and returns the serialized results.
📦 Request Payload
The endpoint expects a simple JSON object with the query to execute:🛡️ Security Filter (Simulated WAF)
To prevent SQL injections and the execution of destructive statements, the controller intercepts the raw query and passes it through a series of strict validations before sending it toJdbcTemplate.
🛑 Firewall Rules
- Read Exclusivity: The statement must strictly start with the
SELECTkeyword. - Single Statements: The stacking of multiple queries through the intermediate use of semicolons (
;) is prohibited. - Keyword Blacklist: The text is scanned using regular expressions against dangerous commands to neutralize structure manipulation or accesses.
🚦 Network Saturation Protection
As a last line of defense, the transaction at the database level is marked as read-only (@Transactional(readOnly = true)). Furthermore, if the user’s original query omits a limit clause, the server automatically injects a LIMIT 15.
This prevents network saturation and memory collapse on the frontend in case a massive SELECT * is executed on a table with tens of thousands of logistics records.