7.12.0-alpha4 throws on simple Variable-Instance-Query

Only happens when Auth is enabled. To reproduce:

run:
docker run --rm -p 8080:8080 camunda/camunda-bpm-platform:7.12.0-alpha4
visit:
http://localhost:8080/camunda/api/engine/engine/default/variable-instance?variableValues=k_eq_v

Need to login to cockpit first (to set auth cookie). Don’t use the /engine-rest endpoint (as it is not secured).

Output:
03-Oct-2019 19:43:31.193 SEVERE [http-nio-8080-exec-2] org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context:

Error querying database. Cause: org.h2.jdbc.JdbcSQLException: Ambiguous column name “NAME_”; SQL statement:

select distinct RES.*

from (
      select
        RES.*,
        ( 

case
when
RES.TASK_ID_ is not null
and RES.EXECUTION_ID_ is not null
then EXECUTION.ACT_INST_ID_

when
  RES.CASE_EXECUTION_ID_ is not null
then RES.CASE_EXECUTION_ID_


  when
    EXECUTION.PARENT_ID_ is null
  and RES.IS_CONCURRENT_LOCAL_ = 0
  then EXECUTION.ID_


  when
    EXECUTION.IS_SCOPE_ = 1
    and EXECUTION.PARENT_ID_ is not null
  and RES.IS_CONCURRENT_LOCAL_ = 0
  then PARENT_EXECUTION.ACT_INST_ID_

  else EXECUTION.ACT_INST_ID_
end

) ACT_INST_ID_

      from ACT_RU_VARIABLE RES

      left join ACT_RU_EXECUTION EXECUTION
      on RES.EXECUTION_ID_ = EXECUTION.ID_

      left join ACT_RU_EXECUTION PARENT_EXECUTION
      on EXECUTION.PARENT_ID_ = PARENT_EXECUTION.ID_

       
        left join ACT_RU_EXECUTION PROC_EXECUTION
        on PROC_EXECUTION.ID_ = RES.PROC_INST_ID_

        left join ACT_RE_PROCDEF PROCDEF
        on PROCDEF.ID_ = PROC_EXECUTION.PROC_DEF_ID_   
               
           
 
 
 
 
left JOIN (
SELECT A.*
FROM ACT_RU_AUTHORIZATION A
WHERE A.TYPE_ < 2     
AND ( A.USER_ID_ in ( ?, '*')           
 
  OR A.GROUP_ID_ IN  (  ? , ? , ? , ? ) 
 
)
 
  AND (
   
     (  
      A.RESOURCE_TYPE_ = ? AND BITAND(A.PERMS_,?) = ?
     OR 
      A.RESOURCE_TYPE_ = ? AND BITAND(A.PERMS_,?) = ?
     OR 
      A.RESOURCE_TYPE_ = ? AND BITAND(A.PERMS_,?) = ?
     ) 
   
   
  )
   
)


          AUTH ON (
          AUTH.RESOURCE_ID_ in (
                                RES.PROC_INST_ID_,
                                PROC_EXECUTION.ID_,
                                PROCDEF.KEY_,
                                RES.TASK_ID_,
                                '*')
          )
         
       
       WHERE  
          

    NAME_= ?
  


          
          
          
            and
            


(

  (  RES.TYPE_ is not null and RES.TYPE_ = ?
    
     
    
      and RES.TEXT_ is not null and 
	  RES.TEXT_
	  
=

	  ? )

)

          
        

        

  
      and (
      (RES.CASE_EXECUTION_ID_ IS NOT NULL)
      OR
      (AUTH.RESOURCE_ID_ IS NOT NULL)
        
      ) 
) RES

order by RES.ID_ asc
LIMIT ? OFFSET ? [90059-190]

Hi @apinske,

Thanks for reporting this. I was able to reproduce and rootcause the problem and have created the following ticket: https://app.camunda.com/jira/browse/CAM-10864. We will fix this with the 7.12.0 final release.

Cheers,
Thorben