EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB484512: Secure text input through parameterized queries


Jun Zhu

Product Owner, Principal • MicroStrategy


This article addresses the change starting from MicroStrategy version 2021 where SQL executions containing text inputs are secured through parameterized queries. This article explains how to enable/disable secure text input and provides a list of certified gateways.

Description

For enhanced security, starting from Strategy version 2021, all SQL executions containing text inputs from filters, search conditions, and text prompts will be secured through parameterized queries.  
Note: Prior to the 2021 release, only text prompts used within Freeform SQL reports are parameterized.

Example

Without parameterized query, a report SQL may look like this:

select a11.CUSTOMER_ID  CUSTOMER_ID, 

max(a12.CUST_LAST_NAME)  CUST_LAST_NAME, 

max(a12.CUST_FIRST_NAME)  CUST_FIRST_NAME, 

sum(a11.TOT_COST)  WJXBFS1 

from customer_sls a11 

join lu_customer a12 

  on (a11.CUSTOMER_ID = a12.CUSTOMER_ID) 

where a12.CUST_LAST_NAME < 'Abas’ 

group by a11.CUSTOMER_ID 

 
After enabling the parameterized queries, the same report SQL will look like this:
select a11.CUSTOMER_ID  CUSTOMER_ID, 

max(a12.CUST_LAST_NAME)  CUST_LAST_NAME, 

max(a12.CUST_FIRST_NAME)  CUST_FIRST_NAME, 

sum(a11.TOT_COST)  WJXBFS1 

from customer_sls a11 

join lu_customer a12 

  on (a11.CUSTOMER_ID = a12.CUSTOMER_ID) 

where a12.CUST_LAST_NAME < ? 

group by a11.CUSTOMER_ID 

with parameters: 

Abas 

How to enable secure text input 

With the release of 2021, secure text input is enabled by default on all existing database connections, as well as newly created connections when the following requirements are met:

  • The metadata must be upgraded to Strategy 2021.
  • The warehouse is running on a certified gateway. The following section entails a list of certified gateways.

It is recommended to always enable secure text input. However, platform administrators can toggle this functionality if needed: 

  • In Strategy Developer, platform administrator can select/deselect the Use parameterized queries checkbox under the Advanced tab of the Database Connections dialog.

ka0PW0000003TBxYAM_0EM2R000000apxh.jpeg
  • On Strategy Web and Workstation, the same setting can be found by expanding the Advanced Setting on each database connection.

ka0PW0000003TBxYAM_0EM2R000000apxm.jpeg

Certified Gateways

2021 platform release:

  • Amazon Redshift
  • IBM Db2 Version 11.5 for Linux, UNIX and Windows
  • IBM IAS
  • IBM IPS
  • IBM Netezza 7.2.x
  • MemSQL
  • MySQL 8.x
  • Oracle 18c
  • Oracle 19c
  • SAP HANA 1.x
  • SAP HANA 2.x
  • Teradata 16.x
  • Teradata 17.00
  • PostgreSQL 13.x
  • Amazon Aurora PostgreSQL Compatible
  • Yellowbrick
  • Snowflake
  • Google BigQuery

 2021 Update 1 release (Users need to manually upgrade MD):

  • Microsoft SQL Server 2008 and 2008 R2
  • Microsoft SQL Server 2012
  • Microsoft SQL Server 2014
  • Microsoft SQL Server 2016
  • Microsoft SQL Server 2017
  • Microsoft SQL Server 2019
  • Azure Synapse Analytics
  • MongoDB 4.x DBMS
  • Exasol version 7.x
  • Oracle 21c
  • Google Cloud Spanner

2021 Update 5 release:

  • Databricks
  • Denodo (requires manual Metadata update)

Note: In the 2021 Update 4 release, users do not need to manually upgrade MD. When the iServer starts, these Gateways will be enabled by default.

Parameterized SQL View

By default, if a user views the SQL without executing the report, the SQL view will not show parameterized view. Only after the execution can Query Details accurately show the queries that have been sent to the warehouse, with parameterized mode. However, we understand that in some situations users want to view the query in parameterized mode before they sent the request to run in the warehouse. For this, we provide a VLDB setting at both the Report level and Database Instance level for users to control the mode of the SQL view before execution.
 
Once the metadata is upgraded to Strategy 2021, the setting is under Data > VLDB Properties... > Select/Insert > Parameterized SQL View.

ka0PW0000003TBxYAM_0EM2R000000aq3V.jpeg

With this setting turned on, when viewing SQL without execution, users will be able to preview the SQL in parameterized mode.

Logging

There are multiple reasons that can potentially affect the parameterization. To help users understand the settings enabled in a specific engine, we implemented extra logging for parameterized query related VLDB settings. To enable the setting, please use Strategy Diagnostics and Performance Logging Tool to enable the File Log for Engine > SQL Trace.

ka0PW0000003TBxYAM_0EM2R000000aq3a.jpeg

Once the log is enabled and a report is run when the parameterized query is turned on, a sample logging entry will look like:

2020-07-11 16:47:43.252-04:00 [HOST:IP-0AF41735][SERVER:T57_IP-0AF41735_200611153024719_8712_0001_yisofi][PID:7960][THR:7784][Engine][SQL Trace][UID:54F3D26011D2896560009A8E67019608][SID:36E0B0973F8FB5BBD76B1E60C2F0C622][OID:E8C28452417B57519AA859BBCEC88BE3] Parameterized Query for Text Input enabled for DBRole XYZWH, Report [C01-DB Qual-R02] 

 
If the database connection has parameterized query enabled, but the gateway is not yet certified, a sample logging entry will look like:
2020-08-05 16:56:55.976-04:00 [HOST:IP-0AF417E2][SERVER:T148_IP-0AF417E2_200804140111205_2824_0001_picofo][PID:9352][THR:12468][Engine][SQL Trace][UID:177BA03045F8E12426075297825740AD][SID:97B2F831AC0FB114F20190DB6F70EFAD][OID:B04ED38C493BBDF08F5729A54C054971] Report:[CAWR02 DM AFB SFB] Parameterized query is enabled for database connection XYZWH but NOT used. This is because the database used by XYZWH has not been certified with parameterized query by Strategy. 

 

Potential performance improvements

  • How to enable bulk load to improve bulk insert performance  

Known limitations and solutions

With all major gateways provide support for parametrized query, there are a few known limitations related to specific gateways/drivers when parametrized query is enabled. Please review the following articles if you are encountering similar issues:

  • Reports containing a text filter may fail when used with parameterized query against older SQL Server versions  
  • Report with a text filter returns different data when parameterized query is enable
  • When parameters exceed the allowed max length after enabling Parameterized Query, the “String data, right truncated” error is received
  • When parameterized query is turned on for MySQL 5.x server, data mismatch is observed against MySQL 5.x ODBC driver
  • "The incoming request has too many parameters" error results when the parameter exceeds the maximum limitation after enabling Parameterized Query
  • "String data, right truncated" error is received when running a report that contains FFSQL and with Parameterized Query enabled
  • "STRING TO BE PREPARED CONTAINS INVALID USE OF PARAMETER MARKERS" is seen when trying to run FFSQL report
  • "QueryEngine encountered error: Unknown failed. Unable to connect." is seen when trying to run FFSQL report with the Parameterized Query enabled
  • MySQL driver Memory corruption may occur when parameterized query is enabled against certain MySQL 8.0 ODBC driver versions
  • "A column or character expression is larger than the max size" error obtained for concatenation operator against Teradata ODBC driver on Windows platform when enabling Parameterized Query
  • Reports against Amazon Redshift may have performance degradation when Parameterized Query is enabled
  • "cannot CREATE VIEW with parameters" is returned when running a report against Redshift and parameterized query enabled
  • Snowflake ODBC driver returns the error, "Bind variables not allowed in view and UDF definitions"
  • Could not determine data type of parameter #1
  • XQuery reports fail due to Parameterized Query being enabled after upgrading to MicroStrategy 2021
  • SQL changes from implicit table creation to explicit table creation after upgrading to MicroStrategy 2021

Comment

0 comments

Details

Knowledge Article

Published:

August 13, 2020

Last Updated:

October 21, 2024