You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by sc...@apache.org on 2017/02/24 09:14:37 UTC

svn commit: r1784249 - in /manifoldcf/trunk: ./ connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/ connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/

Author: schuch
Date: Fri Feb 24 09:14:37 2017
New Revision: 1784249

URL: http://svn.apache.org/viewvc?rev=1784249&view=rev
Log:
Fix for CONNECTORS-1382

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConnector.java
    manifoldcf/trunk/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationView.html
    manifoldcf/trunk/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/Configuration_Server.html

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1784249&r1=1784248&r2=1784249&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Fri Feb 24 09:14:37 2017
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 2.7-dev =====================
 
+CONNECTORS-1382: Slack notification connector now treats the webhook url
+as sensitive information
+(Markus Schuch)
+
 CONNECTORS-1381: Fix slack notification connector not to send the proxy
 password to the client in plaintext
 (Markus Schuch)
@@ -72,7 +76,7 @@ transformation connections.
 CONNECTORS-1344: Adds Slack Notification Connector
 (Odilo Oehmichen, Markus Schuch, Rüdiger Kurz)
 
-CONNECTORS-1349: Fix the modified_date and original_size Solr 
+CONNECTORS-1349: Fix the modified_date and original_size Solr
 attributes.
 (Cihad Guzel)
 
@@ -132,7 +136,7 @@ CONNECTORS-1329: Add logging to LDAP con
 CONNECTORS-1326: Fix URL for Confluence documents.
 (Chalitha Perera)
 
-CONNECTORS-1325: Deal with SharePoint bad XML when document has 
+CONNECTORS-1325: Deal with SharePoint bad XML when document has
 optional plane utf-16 characters.  Documents with these are skipped
 since Java can't represent them either.
 (Karl Wright)
@@ -254,7 +258,7 @@ CONNECTORS-1266: Fix an infinite loop in
 CONNECTORS-1265: Adjust interval for checking validity of http connection.
 (Shinichiro Abe, Karl Wright)
 
-CONNECTORS-1263: New version of Alfresco-indexer package. 
+CONNECTORS-1263: New version of Alfresco-indexer package.
 (Maurizio Pillitu)
 
 CONNECTORS-1262: Fix Alfresco-webscript connector's version string,
@@ -416,7 +420,7 @@ CONNECTORS-1204: Add ability to post ori
 to Solr from JCIFS connector.  Also improve efficiency of JCIFS connector.
 (Karl Wright)
 
-CONNECTORS-1193: Add ability to discard web content based on a 
+CONNECTORS-1193: Add ability to discard web content based on a
 set of regular expressions.
 (Arcadius Ahouansou)
 
@@ -1338,7 +1342,7 @@ CONNECTORS-863: Increase the number of z
 this permits agents processes to start on linux.
 (Karl Wright)
 
-CONNECTORS-862: Reduce the binary image footprint by consolidating the 
+CONNECTORS-862: Reduce the binary image footprint by consolidating the
 various lib directories and just changing classpaths.
 (Karl Wright)
 
@@ -1973,7 +1977,7 @@ CONNECTORS-658: Add common metadata supp
 to Livelink connector.
 (David Morana, Karl Wright)
 
-CONNECTORS-654: Move extension to mimetype mapping to a 
+CONNECTORS-654: Move extension to mimetype mapping to a
 central location.
 (Mark Lugert, Karl Wright)
 
@@ -2096,7 +2100,7 @@ JDBC connections under some error condit
 
 CONNECTORS-619: Include slf4j jars in multiprocess agents classpath.
 This was causing Solrj to not work on multiprocess deployments.
-(Erlend Garåsen, Karl Wright) 
+(Erlend Garåsen, Karl Wright)
 
 CONNECTORS-618: MySQL orders indexes so that NULL values are first.
 This is a problem for the stuffer query, which then must go through
@@ -2235,7 +2239,7 @@ we have.
 
 CONNECTORS-577: Typo in language message properties which cause stack
 traces
-(Erlend Garåsen) 
+(Erlend Garåsen)
 
 CONNECTORS-120: Port ManifoldCF to httpcomponents 4.2.2, from legacy
 commons-httpclient 3.1 (mcf edition).
@@ -2457,7 +2461,7 @@ CONNECTORS-505: Fix for "unknown state"
 UI.
 (Ahmet Arslan, Karl Wright)
 
-CONNECTORS-504: Stop agents process from talking to database after 
+CONNECTORS-504: Stop agents process from talking to database after
 the stop signal has been sent.
 (Karl Wright)
 
@@ -2749,7 +2753,7 @@ etc.
 CONNECTORS-419: Alfresco Connector needs to invoke the ingestDocument for each d:content property of a node
 (Piergiorgio Lucidi)
 
-CONNECTORS-417: CMIS Connector creates documentURI with wrong value when version is null. 
+CONNECTORS-417: CMIS Connector creates documentURI with wrong value when version is null.
 Now the documentURI to get the content stream is retrieved from the CMIS server using an internal method of the OpenCMIS API.
 (Piergiorgio Lucidi)
 
@@ -3365,11 +3369,11 @@ CONNECTORS-220: Fix long-standing issue
 problems.  Reset logic was insufficiently robust.
 (Farzad Valad, Karl Wright)
 
-CONNECTORS-217: Check running more than one of instance of agent. 
+CONNECTORS-217: Check running more than one of instance of agent.
 (Shinichiro Abe)
 
-CONNECTORS-218: LockClean supports relative path 
-to the synchronization directory. 
+CONNECTORS-218: LockClean supports relative path
+to the synchronization directory.
 (Shinichiro Abe)
 
 CONNECTORS-215: Setting an environment variable of agent.
@@ -3603,7 +3607,7 @@ CONNECTORS-130: Block the Solr output co
 that have folder-level security.
 (Karl Wright)
 
-CONNECTORS-129: Add an API reset/outputconnections/xxx command, to 
+CONNECTORS-129: Add an API reset/outputconnections/xxx command, to
 forget the index state for an output connection.
 (Karl Wright)
 
@@ -3746,7 +3750,7 @@ CONNECTORS-105: File system connector UI
 metaphor for paths and rules.
 (Karl Wright)
 
-CONNECTORS-101: File system connector paths should automatically get default 
+CONNECTORS-101: File system connector paths should automatically get default
 rules added.
 (Karl Wright)
 
@@ -3762,7 +3766,7 @@ CONNECTORS-97: Web connector session aut
 due to cookies httpclient thought were illegal, but browsers would accept.
 (Karl Wright)
 
-CONNECTORS-91: Made the initialization commands more accessible via code. 
+CONNECTORS-91: Made the initialization commands more accessible via code.
 (Jettro Coenradie, Karl Wright)
 
 CONNECTORS-90: Fixed a localization issue where database errors that should be

Modified: manifoldcf/trunk/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConnector.java?rev=1784249&r1=1784248&r2=1784249&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConnector.java (original)
+++ manifoldcf/trunk/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConnector.java Fri Feb 24 09:14:37 2017
@@ -66,7 +66,7 @@ public class SlackConnector extends org.
   @Override
   public void connect(ConfigParams configParameters) {
     super.connect(configParameters);
-    this.webHookUrl = configParameters.getParameter(SlackConfig.WEBHOOK_URL_PARAM);
+    this.webHookUrl = configParameters.getObfuscatedParameter(SlackConfig.WEBHOOK_URL_PARAM);
 
     String proxyHost = configParameters.getParameter(SlackConfig.PROXY_HOST_PARAM);
     String proxyPortString = configParameters.getParameter(SlackConfig.PROXY_PORT_PARAM);
@@ -330,7 +330,13 @@ public class SlackConnector extends org.
   }
 
   private static void fillInServerConfigurationMap(Map<String, Object> paramMap, IPasswordMapperActivity mapper, ConfigParams parameters) {
-    String webHookUrl = getEmptyOnNull(parameters, SlackConfig.WEBHOOK_URL_PARAM);
+    String webHookUrl = parameters.getObfuscatedParameter(SlackConfig.WEBHOOK_URL_PARAM);
+    if (webHookUrl == null) {
+      webHookUrl = StringUtils.EMPTY;
+    } else {
+      webHookUrl = mapper.mapPasswordToKey(webHookUrl);
+    }
+
     String proxyHost = getEmptyOnNull(parameters, SlackConfig.PROXY_HOST_PARAM);
     String proxyPort = getEmptyOnNull(parameters, SlackConfig.PROXY_PORT_PARAM);
     String proxyUsername = getEmptyOnNull(parameters, SlackConfig.PROXY_USERNAME_PARAM);
@@ -380,7 +386,7 @@ public class SlackConnector extends org.
 
     final String webHookUrl = variableContext.getParameter("webHookUrl");
     if (webHookUrl != null) {
-      parameters.setParameter(SlackConfig.WEBHOOK_URL_PARAM, webHookUrl);
+      parameters.setObfuscatedParameter(SlackConfig.WEBHOOK_URL_PARAM, variableContext.mapKeyToPassword(webHookUrl));
     }
 
     final String proxyHost = variableContext.getParameter("proxyHost");

Modified: manifoldcf/trunk/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationView.html
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationView.html?rev=1784249&r1=1784248&r2=1784249&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationView.html (original)
+++ manifoldcf/trunk/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationView.html Fri Feb 24 09:14:37 2017
@@ -22,7 +22,9 @@ limitations under the License.
       <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.WebHookUrlColon'))</nobr>
     </td>
     <td class="value">
-      <nobr>$Encoder.bodyEscape($WEBHOOK_URL)</nobr>
+      #if($WEBHOOK_URL && !$WEBHOOK_URL.empty)
+      <nobr>https://hooks.slack.com/services/********/********/************************</nobr>
+      #end
     </td>
   </tr>
   <tr>

Modified: manifoldcf/trunk/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/Configuration_Server.html
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/Configuration_Server.html?rev=1784249&r1=1784248&r2=1784249&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/Configuration_Server.html (original)
+++ manifoldcf/trunk/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/Configuration_Server.html Fri Feb 24 09:14:37 2017
@@ -24,7 +24,7 @@ limitations under the License.
       <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.WebHookUrlColon'))</nobr>
     </td>
     <td class="value">
-      <input id="webHookUrl" name="webHookUrl" type="text" size="80" value="$Encoder.attributeEscape($WEBHOOK_URL)"/>
+      <input id="webHookUrl" name="webHookUrl" type="password" size="80" value="$Encoder.attributeEscape($WEBHOOK_URL)"/>
     </td>
   </tr>
   <tr>