Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

extracting context parameters for specific tasks programmatically

Hi all,

 

I wonder if there's some way to access the task-specific context parameters defined in Job Conductor, for auditing reasons.

 

Apparently, the values are stored encrypted in the TAC DB, and I couldn't figure out how to decrypt them. Also, direct access to the TAC DB might not be available. However, those parameters are accessible in a non-encrypted manner from the GUI, so I should be able to somehow access them programmatically. Unfortunately, the metaServlet JSON API doesn't provide an action to get those parameters, I can only set them using createTask or updateTask.

 

So, any suggestions?

Labels (3)
8 Replies
Anonymous
Not applicable
Author

Hello,

Thanks for posting your issue here.

We have redirected your issue to our TAC experts and will keep you posted.

Best regards

Sabrina

Anonymous
Not applicable
Author

Hi,

 

now we have no metaservlet operation to do this call. I think we can extend listTasks operation for this. Please create TMC new feature in Talend jira.

 

Thanks,

Yuri

Anonymous
Not applicable
Author

OK, will do so, thanks.

Any other workarounds? Like, is there a way to e.g. export the tasks in some parseable form?
Dezzsoke
Contributor III
Contributor III

If you have access to the database behind tac then you can use the following Java code to decrypt the values.

The column that holds the actual values:

talend_tac.executiontaskjobprm.defaultvalue 

 

The Java Code:

String paramString = context.prompt;
System.out.println(paramString);

// This was working with 5.4 and 5.6 I had to decrypt the org.talend.utils package, and under that there was this security.AES.class  which contains this code

byte[] KeyValues = { -87, -101, -56, 50, 86, 53, -29, 3 };
Cipher ecipher;
Cipher dcipher;

String str = System.getProperty("os.name");
boolean bool = false;
if (str != null) {
	bool = str.contains("SunOS");
}
Provider localProvider = null;
if (bool) {
 localProvider = Security.getProvider("SunJCE");
 }

KeyGenerator localKeyGenerator = null;
SecureRandom localSecureRandom = null;
if (bool) {
	localKeyGenerator = KeyGenerator.getInstance("AES", localProvider);
} else {
	localKeyGenerator = KeyGenerator.getInstance("AES");
}
localSecureRandom = SecureRandom.getInstance("SHA1PRNG");
localSecureRandom.setSeed(KeyValues);
localKeyGenerator.init(128, localSecureRandom);
SecretKey localSecretKey = localKeyGenerator.generateKey();
if (bool) {
	ecipher = Cipher.getInstance("AES", localProvider);
    dcipher = Cipher.getInstance("AES", localProvider);
} else {
	ecipher = Cipher.getInstance("AES");
    dcipher = Cipher.getInstance("AES");
}
ecipher.init(1, localSecretKey);
dcipher.init(2, localSecretKey);
      
//This is where we have the magic happening:
byte[] arrayOfByte = Base64.decodeBase64(paramString.getBytes("UTF8"));
arrayOfByte = dcipher.doFinal(arrayOfByte);
String retStr = new String(arrayOfByte, "UTF8");
    
System.out.println(retStr);

I also needed a library to make this work (commons-codec-1.7)

Anonymous
Not applicable
Author

Hi,
Is there any update on this ? I would like to know if “GetTaskList” request can now also extract custom context parameters for all the tasks. It would be a great help if it is possible.
Thanks in advance.
Regards
Aakanksha
ajaychaubey
Contributor
Contributor

Hi Team,

Are there ways to decrypt those context values from TAC DB.

 

Both "originalvalue" and "defaultvalue" from table executiontaskjobprm and "contextvalues" from table executiontaskhistory all are encryption columns.

 

Regards,

Prasanna

Dezzsoke
Contributor III
Contributor III

You can check the source code extract those 8 lines of code and do the
decryption 0683p000009MACn.png

FYI tac and studio uses different keys.
ajaychaubey
Contributor
Contributor

Thanks for your quick reply

I am looking forward to extract these information from TAC DB ( MySql) directly.