Skip to content

Commit

Permalink
Fixed masking of password
Browse files Browse the repository at this point in the history
The JIRA password was not masked in the stream configuration.
  • Loading branch information
Gerd Naschenweng committed Mar 9, 2016
1 parent 21e5999 commit 11a82ae
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 11 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Graylog Plugin for JIRA with templating

An alarm callback plugin that integrates [Graylog](https://www.graylog.org/) into [JIRA](https://www.atlassian.com/software/jira/).
A Graylog alarm callback plugin that integrates [Graylog](https://www.graylog.org/) into [JIRA](https://www.atlassian.com/software/jira/).

## Main features
* Templating in JIRA issue title and JIRA message via place holders
* Embed a MD5 hash into the JIRA issue to prevent duplicate JIRA issues

# Pre-requisites for Java exception logging
-------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/bidorbuy/graylog/jira/JiraClient.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Gerd Naschenweng
* Copyright (c) 2016 Gerd Naschenweng / bidorbuy.co.za
*
* Original idea from https://github.com/tjackiw/graylog-plugin-jira
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/bidorbuy/graylog/jira/JiraIssue.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Gerd Naschenweng
* Copyright (c) 2016 Gerd Naschenweng / bidorbuy.co.za
*
* Original idea from https://github.com/tjackiw/graylog-plugin-jira
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/bidorbuy/graylog/jira/JiraPlugin.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Gerd Naschenweng
* Copyright (c) 2016 Gerd Naschenweng / bidorbuy.co.za
*
* Original idea from https://github.com/tjackiw/graylog-plugin-jira
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/bidorbuy/graylog/jira/JiraPluginBase.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Gerd Naschenweng
* Copyright (c) 2016 Gerd Naschenweng / bidorbuy.co.za
*
* Original idea from https://github.com/tjackiw/graylog-plugin-jira
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -63,7 +65,7 @@ public class JiraPluginBase {
public static final String CK_TITLE_TEMPLATE = "title_template";
public static final String CK_MESSAGE_REGEX = "message_regex";

// The default template for Jira messages
// The default template for JIRA messages
private static final String CONST_JIRA_MESSAGE_TEMPLATE = "*Stream title:* \n [STREAM_TITLE]\n\n"
+ " *Stream URL:* \n [STREAM_URL]\n\n"
+ " *Stream rules:* \n [STREAM_RULES]\n\n"
Expand All @@ -90,7 +92,7 @@ public static ConfigurationRequest configuration () {

configurationRequest.addField (new TextField (
CK_PASSWORD, "Password", "", "Password to login to JIRA.",
ConfigurationField.Optional.NOT_OPTIONAL));
ConfigurationField.Optional.NOT_OPTIONAL, TextField.Attribute.IS_PASSWORD));

configurationRequest.addField (new TextField (
CK_PROJECT_KEY, "Project Key", "", "Project under which the issue will be created.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Thiago Jackiw
* Copyright (c) 2016 Gerd Naschenweng / bidorbuy.co.za
*
* Original idea from https://github.com/tjackiw/graylog-plugin-jira
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/com/bidorbuy/graylog/jira/JiraPluginModule.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Gerd Naschenweng / bidorbuy.co.za
*
* Original idea from https://github.com/tjackiw/graylog-plugin-jira
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

package com.bidorbuy.graylog.jira;

import org.graylog2.plugin.PluginConfigBean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Gerd Naschenweng
* Copyright (c) 2016 Gerd Naschenweng / bidorbuy.co.za
*
* Original idea from https://github.com/tjackiw/graylog-plugin-jira
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,6 +28,7 @@
package com.bidorbuy.graylog.jira.callback;

import com.google.common.collect.Maps;
import com.google.common.collect.ImmutableList;
import com.bidorbuy.graylog.jira.*;
import org.graylog2.plugin.alarms.AlertCondition;
import org.graylog2.plugin.alarms.callbacks.AlarmCallback;
Expand All @@ -36,10 +39,13 @@
import org.graylog2.plugin.configuration.ConfigurationRequest;
import org.graylog2.plugin.streams.Stream;

import java.util.List;
import java.util.Map;

public class JiraAlarmCallback extends JiraPluginBase implements AlarmCallback {
private Configuration configuration;

private static final List<String> SENSITIVE_CONFIGURATION_KEYS = ImmutableList.of(CK_PASSWORD);

@Override
public void initialize(final Configuration config) throws AlarmCallbackConfigurationException {
Expand Down Expand Up @@ -83,14 +89,17 @@ public Map<String, Object> getAttributes() {
return Maps.transformEntries(configuration.getSource(), new Maps.EntryTransformer<String, Object, Object>() {
@Override
public Object transformEntry(String key, Object value) {
if (CK_PASSWORD.equals(key)) {
if (SENSITIVE_CONFIGURATION_KEYS.contains(key)) {
return "****";
}
return value;
}
});
}




@Override
// Never actually called by graylog-server
public void checkConfiguration() throws ConfigurationException {
Expand Down
2 changes: 2 additions & 0 deletions target/classes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/META-INF/
/com/
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
#Wed Mar 09 07:27:33 SAST 2016
#Wed Mar 09 08:18:17 SAST 2016
version=1.0.0
groupId=com.bidorbuy.graylog
m2e.projectName=Graylog Jira Callback
Expand Down
Binary file not shown.
Binary file modified target/classes/com/bidorbuy/graylog/jira/JiraClient.class
Binary file not shown.
Binary file modified target/classes/com/bidorbuy/graylog/jira/JiraIssue.class
Binary file not shown.
Binary file modified target/classes/com/bidorbuy/graylog/jira/JiraPlugin.class
Binary file not shown.
Binary file modified target/classes/com/bidorbuy/graylog/jira/JiraPluginBase.class
Binary file not shown.
Binary file not shown.
Binary file modified target/classes/com/bidorbuy/graylog/jira/JiraPluginModule.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified target/graylog-plugin-jira-1.0.0.jar
Binary file not shown.
Binary file modified target/original-graylog-plugin-jira-1.0.0.jar
Binary file not shown.

0 comments on commit 11a82ae

Please sign in to comment.