Compare commits

...

3 Commits

Author SHA1 Message Date
Dmytro Chmyga
a8a764e273 patch(TPS-3315): password context values
* change release notes
2019-08-08 16:47:02 +03:00
Dmytro Chmyga
d803bd655a patch(TPS-3315): password context values
* revert changes in db log javajets

* fix mysql, mssql, oracle and redshift components

* change release notes
2019-08-08 16:23:32 +03:00
Dmytro Chmyga
64b033c51b patch(TPS-3315): password context values
* Throw runtime exception if password is used in plain text field

* Add release note
2019-08-05 15:34:50 +03:00
34 changed files with 635 additions and 7 deletions

109
PATCH_RELEASE_NOTE.md Normal file
View File

@@ -0,0 +1,109 @@
---
version: 7.2.1
module: https://talend.poolparty.biz/coretaxonomy/42
product:
- https://talend.poolparty.biz/coretaxonomy/23
---
# TPS-3315
| Info | Value |
| ---------------- | ---------------- |
| Patch Name | Patch\_20190808_TPS-3315\_v1-7.2.1 |
| Release Date | 2019-08-08 |
| Target Version | Talend-Studio-20190620\_1446-V7.2.1 |
| Product affected | Talend Studio |
## Introduction
This is a self-contained patch.
**NOTE**: For information on how to obtain this patch, reach out to your Support contact at Talend.
## Fixed issues
This patch contains the following fixes:
- TPS-3315 [7.2.1] Additional JDBC Parameter exposes the password when using a context variable of password type (TDI-42721)
## Prerequisites
Consider the following requirements for your system:
- Talend Studio 7.2.1 must be installed.
## Installation
### Installing the patch using Software update
1) Logon TAC and switch to Configuration->Software Update, then enter the correct values and save referring to the documentation: https://help.talend.com/reader/f7Em9WV_cPm2RRywucSN0Q/j9x5iXV~vyxMlUafnDejaQ
2) Switch to Software update page, where the new patch will be listed. The patch can be downloaded from here into the nexus repository.
3) On Studio Side: Logon Studio with remote mode, on the logon page the Update button is displayed: click this button to install the patch.
### Installing the patch using Talend Studio
1) Create a folder named "patches" under your studio installer directory and copy the patch .zip file to this folder.
2) Restart your studio: a window pops up, then click OK to install the patch, or restart the commandline and the patch will be installed automatically.
### Installing the patch using Commandline
Execute the following commands:
1. Talend-Studio-win-x86_64.exe -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace startServer -p 8002 --talendDebug
2. initRemote {tac_url} -ul {TAC login username} -up {TAC login password}
3. checkAndUpdate -tu {TAC login username} -tup {TAC login password}
## Uninstallation
Backup the Affected files list below. Uninstall the patch by restore the backup files.
## Affected files for this patch
The following files are installed by this patch:
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tELTMSSqlMap/tELTMSSqlMap\_main.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tELTMysqlMap/tELTMysqlMap\_main.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tELTOracleMap/tELTOracleMap\_main.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/templates/DB/CheckContextPassword.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMSSqlBulkExec/tMSSqlBulkExec\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMSSqlConnection/tMSSqlConnection\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMSSqlInput/tMSSqlInput\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMSSqlOutput/tMSSqlOutput\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMSSqlRow/tMSSqlRow\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMSSqlSCD/tMSSqlSCD\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMSSqlSP/tMSSqlSP\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMysqlBulkExec/tMysqlBulkExec\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMysqlConnection/tMysqlConnection\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMysqlInput/tMysqlInput\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMysqlOutput/tMysqlOutput\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMysqlRow/tMysqlRow\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMysqlSCD/tMysqlSCD\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMysqlSCDELT/tMysqlSCDELT\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMysqlSP/tMysqlSP\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOracleBulkExec/tOracleBulkExec\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOracleConnection/tOracleConnection\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOracleInput/tOracleInput\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOracleOutput/tOracleOutput\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOracleRow/tOracleRow\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOracleSCD/tOracleSCD\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOracleSCDELT/tOracleSCDELT\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOracleSP/tOracleSP\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftBulkExec/tRedshiftBulkExec\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftConnection/tRedshiftConnection\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftInput/tRedshiftInput\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftOutput/tRedshiftOutput\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftRow/tRedshiftRow\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftUnload/tRedshiftUnload\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.tdqprovider\_7.2.1.20190614\_0245/components/tMSSqlInvalidRows/tMSSqlInvalidRows\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.tdqprovider\_7.2.1.20190614\_0245/components/tMSSqlValidRows/tMSSqlValidRows\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.tdqprovider\_7.2.1.20190614\_0245/components/tMySQLInvalidRows/tMySQLInvalidRows\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.tdqprovider\_7.2.1.20190614\_0245/components/tMySQLValidRows/tMySQLValidRows\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.tdqprovider\_7.2.1.20190614\_0245/components/tOracleInvalidRows/tOracleInvalidRows\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.tdqprovider\_7.2.1.20190614\_0245/components/tOracleValidRows/tOracleValidRows\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.tisprovider\_7.2.1.20190614\_0242/components/tMSSqlCDC/tMSSqlCDC\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.tisprovider\_7.2.1.20190614\_0242/components/tMysqlCDC/tMysqlCDC\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.tisprovider\_7.2.1.20190614\_0242/components/tOracleCDC/tOracleCDC\_begin.javajet
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.tisprovider\_7.2.1.20190614\_0242/components/tOracleCDCOutput/tOracleCDCOutput\_begin.javajet

View File

@@ -16,6 +16,7 @@
java.util.HashSet
"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%

View File

@@ -17,6 +17,7 @@
java.util.HashSet
"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%

View File

@@ -18,8 +18,56 @@
"
%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
DbMapComponent node = (DbMapComponent) codeGenArgument.getArgument();
boolean stats = codeGenArgument.isStatistics();

View File

@@ -15,6 +15,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -6,6 +6,7 @@ imports="
"
%>
<%@ include file="../templates/DB/HelpClass/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class ConnectionUtil extends DefaultConnectionUtil{

View File

@@ -13,6 +13,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Input/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBInputBeginUtil extends DefaultDBInputUtil{

View File

@@ -17,6 +17,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -6,6 +6,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Row/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBRowBeginUtil extends DefaultDBRowUtil{

View File

@@ -18,6 +18,7 @@ imports="
skeleton="../templates/slowly_change_dimension.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();

View File

@@ -9,6 +9,7 @@ imports="
"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();

View File

@@ -14,6 +14,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="../templates/Log4j/Log4jDBConnUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -6,6 +6,7 @@ imports="
"
%>
<%@ include file="../templates/DB/HelpClass/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class ConnectionUtil extends DefaultConnectionUtil{

View File

@@ -13,6 +13,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Input/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBInputBeginUtil extends DefaultDBInputUtil{

View File

@@ -17,6 +17,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -6,6 +6,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Row/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBRowBeginUtil extends DefaultDBRowUtil{

View File

@@ -16,7 +16,7 @@ imports="
"
skeleton="../templates/slowly_change_dimension.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();

View File

@@ -14,7 +14,7 @@ imports="
"
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -8,6 +8,7 @@ imports="
"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();

View File

@@ -18,6 +18,7 @@ skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="../templates/Log4j/Log4jDBConnUtil.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -96,6 +97,57 @@ String url_<%=cid%> = null;
int deletedCount_<%=cid%>=0;
<%
boolean useExistingConnection = "true".equalsIgnoreCase(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
if(useExistingConnection) {
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "conn_" + connection;

View File

@@ -7,6 +7,56 @@ imports="
%>
<%@ include file="../templates/DB/HelpClass/HelpClass.javajet"%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
class ConnectionUtil extends DefaultConnectionUtil{
public void beforeComponentProcess(INode node){

View File

@@ -14,6 +14,56 @@ imports="
%>
<%@ include file="../templates/DB/Input/HelpClass.javajet"%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
class DBInputBeginUtil extends DefaultDBInputUtil{
private INode node = null;

View File

@@ -51,6 +51,56 @@ skeleton="../templates/db_output_bulk.skeleton"
boolean createGeometryColumns = ("true").equals(ElementParameterParser.getValue(node,"__GEOMETRY_COLUMNS__"));
boolean useExistingConnection = "true".equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
String rejectConnName = null;
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");

View File

@@ -6,8 +6,58 @@ imports="
"
%>
<%@ include file="../templates/DB/Row/HelpClass.javajet"%>
<%
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
class DBRowBeginUtil extends DefaultDBRowUtil{
public void beforeComponentProcess(INode node){

View File

@@ -18,6 +18,56 @@ skeleton="../templates/slowly_change_dimension.skeleton"
%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();
String cid = node.getUniqueName();

View File

@@ -14,8 +14,57 @@ imports="
"
skeleton="../templates/db_output_bulk.skeleton"
%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();

View File

@@ -7,8 +7,57 @@ imports="
java.util.Map
"
%>
<%
//TPS-3315
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String user_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
String localServiceName_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__LOCAL_SERVICE_NAME__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(localServiceName_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
//
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode) codeGenArgument.getArgument();
String cid = node.getUniqueName();

View File

@@ -14,6 +14,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="../templates/Log4j/Log4jDBConnUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -6,6 +6,7 @@ imports="
"
%>
<%@ include file="../templates/DB/HelpClass/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class ConnectionUtil extends DefaultConnectionUtil{

View File

@@ -13,6 +13,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Input/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBInputBeginUtil extends DefaultDBInputUtil{

View File

@@ -16,6 +16,7 @@ imports="
skeleton="../templates/db_output_bulk.skeleton"
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/DBLogUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -8,6 +8,7 @@ imports="
"
%>
<%@ include file="../templates/DB/Row/HelpClass.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
class DBRowBeginUtil extends DefaultDBRowUtil{

View File

@@ -14,6 +14,7 @@ imports="
"
%>
<%@ include file="../templates/Log4j/Log4jDBConnUtil.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/DB/CheckContextPassword.javajet"%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();

View File

@@ -0,0 +1,50 @@
<%@jet%>
<%
org.talend.designer.codegen.config.CodeGeneratorArgument codeGenArgument_pwdCheck = (org.talend.designer.codegen.config.CodeGeneratorArgument)argument;
org.talend.core.model.process.INode node_pwdCheck = (org.talend.core.model.process.INode)codeGenArgument_pwdCheck.getArgument();
boolean useExistingConnection_pwdCheck = "true".equalsIgnoreCase(ElementParameterParser.getValue(node_pwdCheck,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConnection_pwdCheck) {
String dbhost_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__HOST__");
String dbuser_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__USER__");
String dbport_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PORT__");
String dbname_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__DBNAME__");
String dbproperties_pwdCheck = ElementParameterParser.getValue(node_pwdCheck, "__PROPERTIES__");
final class ValueChecker {
public boolean checkValueForPassword(String inputValue, org.talend.core.model.process.IContext context) {
if(null == inputValue) {
return false;
}
java.util.List<String> parsed = new java.util.ArrayList<String>();
String value = inputValue.trim();
while(org.talend.core.model.utils.ContextParameterUtils.containContextVariables(value)) {
String nonQuoteStr = org.talend.core.utils.TalendQuoteUtils.filterQuote(value);
String contextVar = org.talend.core.model.utils.ContextParameterUtils.getVariableFromCode(nonQuoteStr);
parsed.add(contextVar);
String curValue = org.talend.core.model.utils.ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + contextVar;
int index = value.indexOf(curValue);
if(index != -1) {
value = value.substring(index + curValue.length(), value.length());
}
}
for(String parsedParam : parsed) {
org.talend.core.model.process.IContextParameter param = context.getContextParameter(parsedParam);
if(org.talend.core.model.utils.ContextParameterUtils.isPasswordType(param)) {
return true;
}
}
return false;
}
}
ValueChecker checker = new ValueChecker();
org.talend.core.model.process.IContext context_pwdCheck = node_pwdCheck.getProcess().getContextManager().getDefaultContext();
if(checker.checkValueForPassword(dbhost_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbport_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbname_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbproperties_pwdCheck, context_pwdCheck) || checker.checkValueForPassword(dbuser_pwdCheck, context_pwdCheck)) {
%>
if(true) {
throw new RuntimeException("Password context variable is used in plain text field!");
}
<%
}
}
%>