IBM Support

grdapi create_computed_attribute fails with 'Invalid Expression Or expression includes not allowed characters' ERR=2410

Troubleshooting


Problem

I am trying to create a new computed attribute using grdapi create_computed_attribute command. It fails with an error: ERR=2410 Error Creating New Computed Attribute - Invalid Expression Or expression includes not allowed characters

Cause

The following characters and words are not allowed in computed attributes, to prevent SQL injection:
INSERT, UPDATE, DELETE, TRUNCATE, ALTER, CREATE, DROP, ;, --, /*

If your computed attribute expression contains one of the above, then it will fail with this error.

Resolving The Problem

To resolve the problem, the computed attribute expression must be rewritten to avoid those characters. In most cases, this should be possible. The mysql char() function can be used to replace characters.

Problem example with semicolon


guardium> grdapi create_computed_attribute attributeLabel="app_user" entityLabel="Access Period" expression="SUBSTRING_INDEX(APP_USER_NAME,';',1)"
create_computed_attribute:
ERR=2410
Error Creating New Computed Attribute - Invalid Expression Or
expression includes not allowed characters

Working example with char(59)
guardium> grdapi create_computed_attribute attributeLabel="app_user" entityLabel="Access Period" expression="SUBSTRING_INDEX(APP_USER_NAME,char(59),1)"    
ID=20000
Attribute for Expression SUBSTRING_INDEX(APP_USER_NAME,char(59),1) Created


Mysql char() function reference
Character(s)Char() equivalent
;char(59)
--char(45,45)
/*char(47,42)

[{"Product":{"code":"SSMPHH","label":"IBM Security Guardium"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Guardium Appliances","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"},{"code":"PF035","label":"z\/OS"}],"Version":"10.0;10.0.1;10.1;10.1.2;9.0;9.1;9.5","Edition":"All Editions","Line of Business":{"code":"LOB24","label":"Security Software"}}]

Document Information

Modified date:
16 June 2018

UID

swg21997863