{"action":"created","comment":{"url":"https://api.github.com/repos/codice/ddf/pulls/comments/129367651","pull_request_review_id":52130142,"id":129367651,"diff_hunk":"@@ -0,0 +1,103 @@\n+/**\n+ * Copyright (c) Codice Foundation\n+ * <p>\n+ * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser\n+ * General Public License as published by the Free Software Foundation, either version 3 of the\n+ * License, or any later version.\n+ * <p>\n+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\n+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ * Lesser General Public License for more details. A copy of the GNU Lesser General Public License\n+ * is distributed along with this program and can be found at\n+ * <http://www.gnu.org/licenses/lgpl.html>.\n+ */\n+package org.codice.ddf.admin.core.impl;\n+\n+import java.net.InetAddress;\n+import java.net.UnknownHostException;\n+import java.util.ArrayList;\n+import java.util.Collections;\n+import java.util.HashMap;\n+import java.util.List;\n+import java.util.Map;\n+\n+import javax.management.NotCompliantMBeanException;\n+\n+import org.apache.commons.lang.StringUtils;\n+import org.apache.shiro.SecurityUtils;\n+import org.codice.ddf.admin.core.api.jmx.AdminAlertMBean;\n+import org.codice.ddf.persistence.PersistenceException;\n+import org.codice.ddf.persistence.PersistentItem;\n+import org.codice.ddf.persistence.PersistentStore;\n+import org.codice.ddf.system.alerts.Alert;\n+import org.codice.ddf.system.alerts.SystemNotice;\n+import org.osgi.service.event.Event;\n+import org.osgi.service.event.EventAdmin;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import ddf.security.SubjectUtils;\n+\n+public class AdminAlertImpl extends BasicMBean implements AdminAlertMBean {\n+\n+    private static final Logger LOGGER = LoggerFactory.getLogger(AdminAlertImpl.class);\n+\n+    private final String activeAlertQuery;\n+\n+    private PersistentStore persistentStore;\n+\n+    private EventAdmin eventAdmin;\n+\n+    public AdminAlertImpl(PersistentStore persistentStore, EventAdmin eventAdmin)\n+            throws NotCompliantMBeanException, UnknownHostException {\n+        super(AdminAlertMBean.class, AdminAlertMBean.OBJECT_NAME);\n+        this.persistentStore = persistentStore;\n+        this.eventAdmin = eventAdmin;\n+        activeAlertQuery = String.format(\"status='%s' AND hostName='%s'\",\n+                Alert.ALERT_ACTIVE_STATUS,\n+                InetAddress.getLocalHost()\n+                        .getHostName());\n+    }\n+\n+    @Override\n+    public List<Map<String, Object>> getAlerts() {\n+        List<Map<String, Object>> alerts = new ArrayList<>();\n+        try {\n+            List<Map<String, Object>> results = persistentStore.get(\"alerts\", activeAlertQuery);","path":"platform/admin/core/admin-core-impl/src/main/java/org/codice/ddf/admin/core/impl/AdminAlertImpl.java","position":66,"original_position":66,"commit_id":"764b11c5b63ccb99d1bbc4ef8256c69ea5bdb2c0","original_commit_id":"764b11c5b63ccb99d1bbc4ef8256c69ea5bdb2c0","user":{"login":"stustison","id":4391679,"avatar_url":"https://avatars0.githubusercontent.com/u/4391679?v=4","gravatar_id":"","url":"https://api.github.com/users/stustison","html_url":"https://github.com/stustison","followers_url":"https://api.github.com/users/stustison/followers","following_url":"https://api.github.com/users/stustison/following{/other_user}","gists_url":"https://api.github.com/users/stustison/gists{/gist_id}","starred_url":"https://api.github.com/users/stustison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stustison/subscriptions","organizations_url":"https://api.github.com/users/stustison/orgs","repos_url":"https://api.github.com/users/stustison/repos","events_url":"https://api.github.com/users/stustison/events{/privacy}","received_events_url":"https://api.github.com/users/stustison/received_events","type":"User","site_admin":false},"body":"If any of these results contain data that was obtained from a user on the system, it would be possible to execute a XSS attack against an administrator user. We need to escape or encode these results to avoid executing any scripts that they might contain since we are pushing them up to a handlebars template that uses the {{{}}} braces and doesn't automatically escape HTML for us.","created_at":"2017-07-25T17:13:15Z","updated_at":"2017-07-25T17:13:51Z","html_url":"https://github.com/codice/ddf/pull/2141#discussion_r129367651","pull_request_url":"https://api.github.com/repos/codice/ddf/pulls/2141","_links":{"self":{"href":"https://api.github.com/repos/codice/ddf/pulls/comments/129367651"},"html":{"href":"https://github.com/codice/ddf/pull/2141#discussion_r129367651"},"pull_request":{"href":"https://api.github.com/repos/codice/ddf/pulls/2141"}}},"pull_request":{"url":"https://api.github.com/repos/codice/ddf/pulls/2141","id":130475993,"html_url":"https://github.com/codice/ddf/pull/2141","diff_url":"https://github.com/codice/ddf/pull/2141.diff","patch_url":"https://github.com/codice/ddf/pull/2141.patch","issue_url":"https://api.github.com/repos/codice/ddf/issues/2141","number":2141,"state":"open","locked":false,"title":"DDF 3143 Update alerting in the admin UI","user":{"login":"clockard","id":5248090,"avatar_url":"https://avatars1.githubusercontent.com/u/5248090?v=4","gravatar_id":"","url":"https://api.github.com/users/clockard","html_url":"https://github.com/clockard","followers_url":"https://api.github.com/users/clockard/followers","following_url":"https://api.github.com/users/clockard/following{/other_user}","gists_url":"https://api.github.com/users/clockard/gists{/gist_id}","starred_url":"https://api.github.com/users/clockard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clockard/subscriptions","organizations_url":"https://api.github.com/users/clockard/orgs","repos_url":"https://api.github.com/users/clockard/repos","events_url":"https://api.github.com/users/clockard/events{/privacy}","received_events_url":"https://api.github.com/users/clockard/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\nUpdates the admin ui alerting mechanism to use the new alerting methodology in https://github.com/codice/ddf/pull/2130 \r\nThis cannot be merged or tested before  DDF-3128 is merged.\r\nThe UI portion is primarily pulled from the DDF 2.10.x branch\r\n#### Who is reviewing it? \r\n@emmberk @mcalcote @vinamartin \r\n\r\n#### Choose 2 committers to review/merge the PR. \r\n(please choose ONLY two committers from below, delete the rest)\r\n@figliold \r\n@coyotesqrl \r\n\r\n#### How should this be tested? (List steps with links to updated documentation)\r\nVerify you can add, view and dismiss events. An example is\r\nEvents can be added from the DDF console `event:send decanter/alert/test title='System reboot at 5pm EST' source=admin-notice priority=2 details=\"System restart tonight to upgrade hardware\"`\r\n#### Any background context you want to provide?\r\n#### What are the relevant tickets?\r\n[DDF-3143](https://codice.atlassian.net/browse/DDF-3143)\r\n#### Screenshots (if appropriate)\r\n![screen shot 2017-07-13 at 10 16 23 am](https://user-images.githubusercontent.com/5248090/28189324-5d90ca08-67da-11e7-964a-351681e5c450.png)\r\n\r\n#### Checklist:\r\n- [ ] Documentation Updated\r\n- [X] Update / Add Unit Tests\r\n- [ ] Update / Add Integration Tests\r\n#### Review Comment Legend:\r\n- ✏️ (Pencil) This comment is a nitpick or style suggestion, no action required for approval. This comment should provide a suggestion either as an in line code snippet or a gist. \r\n- ❓ (Question Mark) This comment is to gain a clearer understanding of design or code choices, clarification is required but action may not be necessary for approval.\r\n- ❗ (Exclamation Mark) This comment is critical and requires clarification or action before approval.\r\n","created_at":"2017-07-13T21:54:09Z","updated_at":"2017-07-25T17:13:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8061537b3fa6995b26d50fb2b3500150b0f30297","assignee":{"login":"coyotesqrl","id":1469860,"avatar_url":"https://avatars2.githubusercontent.com/u/1469860?v=4","gravatar_id":"","url":"https://api.github.com/users/coyotesqrl","html_url":"https://github.com/coyotesqrl","followers_url":"https://api.github.com/users/coyotesqrl/followers","following_url":"https://api.github.com/users/coyotesqrl/following{/other_user}","gists_url":"https://api.github.com/users/coyotesqrl/gists{/gist_id}","starred_url":"https://api.github.com/users/coyotesqrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coyotesqrl/subscriptions","organizations_url":"https://api.github.com/users/coyotesqrl/orgs","repos_url":"https://api.github.com/users/coyotesqrl/repos","events_url":"https://api.github.com/users/coyotesqrl/events{/privacy}","received_events_url":"https://api.github.com/users/coyotesqrl/received_events","type":"User","site_admin":false},"assignees":[{"login":"coyotesqrl","id":1469860,"avatar_url":"https://avatars2.githubusercontent.com/u/1469860?v=4","gravatar_id":"","url":"https://api.github.com/users/coyotesqrl","html_url":"https://github.com/coyotesqrl","followers_url":"https://api.github.com/users/coyotesqrl/followers","following_url":"https://api.github.com/users/coyotesqrl/following{/other_user}","gists_url":"https://api.github.com/users/coyotesqrl/gists{/gist_id}","starred_url":"https://api.github.com/users/coyotesqrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coyotesqrl/subscriptions","organizations_url":"https://api.github.com/users/coyotesqrl/orgs","repos_url":"https://api.github.com/users/coyotesqrl/repos","events_url":"https://api.github.com/users/coyotesqrl/events{/privacy}","received_events_url":"https://api.github.com/users/coyotesqrl/received_events","type":"User","site_admin":false},{"login":"figliold","id":4838043,"avatar_url":"https://avatars3.githubusercontent.com/u/4838043?v=4","gravatar_id":"","url":"https://api.github.com/users/figliold","html_url":"https://github.com/figliold","followers_url":"https://api.github.com/users/figliold/followers","following_url":"https://api.github.com/users/figliold/following{/other_user}","gists_url":"https://api.github.com/users/figliold/gists{/gist_id}","starred_url":"https://api.github.com/users/figliold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/figliold/subscriptions","organizations_url":"https://api.github.com/users/figliold/orgs","repos_url":"https://api.github.com/users/figliold/repos","events_url":"https://api.github.com/users/figliold/events{/privacy}","received_events_url":"https://api.github.com/users/figliold/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/codice/ddf/pulls/2141/commits","review_comments_url":"https://api.github.com/repos/codice/ddf/pulls/2141/comments","review_comment_url":"https://api.github.com/repos/codice/ddf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codice/ddf/issues/2141/comments","statuses_url":"https://api.github.com/repos/codice/ddf/statuses/764b11c5b63ccb99d1bbc4ef8256c69ea5bdb2c0","head":{"label":"clockard:DDF-3143","ref":"DDF-3143","sha":"764b11c5b63ccb99d1bbc4ef8256c69ea5bdb2c0","user":{"login":"clockard","id":5248090,"avatar_url":"https://avatars1.githubusercontent.com/u/5248090?v=4","gravatar_id":"","url":"https://api.github.com/users/clockard","html_url":"https://github.com/clockard","followers_url":"https://api.github.com/users/clockard/followers","following_url":"https://api.github.com/users/clockard/following{/other_user}","gists_url":"https://api.github.com/users/clockard/gists{/gist_id}","starred_url":"https://api.github.com/users/clockard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clockard/subscriptions","organizations_url":"https://api.github.com/users/clockard/orgs","repos_url":"https://api.github.com/users/clockard/repos","events_url":"https://api.github.com/users/clockard/events{/privacy}","received_events_url":"https://api.github.com/users/clockard/received_events","type":"User","site_admin":false},"repo":{"id":33900871,"name":"ddf","full_name":"clockard/ddf","owner":{"login":"clockard","id":5248090,"avatar_url":"https://avatars1.githubusercontent.com/u/5248090?v=4","gravatar_id":"","url":"https://api.github.com/users/clockard","html_url":"https://github.com/clockard","followers_url":"https://api.github.com/users/clockard/followers","following_url":"https://api.github.com/users/clockard/following{/other_user}","gists_url":"https://api.github.com/users/clockard/gists{/gist_id}","starred_url":"https://api.github.com/users/clockard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clockard/subscriptions","organizations_url":"https://api.github.com/users/clockard/orgs","repos_url":"https://api.github.com/users/clockard/repos","events_url":"https://api.github.com/users/clockard/events{/privacy}","received_events_url":"https://api.github.com/users/clockard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/clockard/ddf","description":"The Distributed Data Framework - Distribution, SDK, and Test","fork":true,"url":"https://api.github.com/repos/clockard/ddf","forks_url":"https://api.github.com/repos/clockard/ddf/forks","keys_url":"https://api.github.com/repos/clockard/ddf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clockard/ddf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clockard/ddf/teams","hooks_url":"https://api.github.com/repos/clockard/ddf/hooks","issue_events_url":"https://api.github.com/repos/clockard/ddf/issues/events{/number}","events_url":"https://api.github.com/repos/clockard/ddf/events","assignees_url":"https://api.github.com/repos/clockard/ddf/assignees{/user}","branches_url":"https://api.github.com/repos/clockard/ddf/branches{/branch}","tags_url":"https://api.github.com/repos/clockard/ddf/tags","blobs_url":"https://api.github.com/repos/clockard/ddf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clockard/ddf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clockard/ddf/git/refs{/sha}","trees_url":"https://api.github.com/repos/clockard/ddf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clockard/ddf/statuses/{sha}","languages_url":"https://api.github.com/repos/clockard/ddf/languages","stargazers_url":"https://api.github.com/repos/clockard/ddf/stargazers","contributors_url":"https://api.github.com/repos/clockard/ddf/contributors","subscribers_url":"https://api.github.com/repos/clockard/ddf/subscribers","subscription_url":"https://api.github.com/repos/clockard/ddf/subscription","commits_url":"https://api.github.com/repos/clockard/ddf/commits{/sha}","git_commits_url":"https://api.github.com/repos/clockard/ddf/git/commits{/sha}","comments_url":"https://api.github.com/repos/clockard/ddf/comments{/number}","issue_comment_url":"https://api.github.com/repos/clockard/ddf/issues/comments{/number}","contents_url":"https://api.github.com/repos/clockard/ddf/contents/{+path}","compare_url":"https://api.github.com/repos/clockard/ddf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clockard/ddf/merges","archive_url":"https://api.github.com/repos/clockard/ddf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clockard/ddf/downloads","issues_url":"https://api.github.com/repos/clockard/ddf/issues{/number}","pulls_url":"https://api.github.com/repos/clockard/ddf/pulls{/number}","milestones_url":"https://api.github.com/repos/clockard/ddf/milestones{/number}","notifications_url":"https://api.github.com/repos/clockard/ddf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clockard/ddf/labels{/name}","releases_url":"https://api.github.com/repos/clockard/ddf/releases{/id}","deployments_url":"https://api.github.com/repos/clockard/ddf/deployments","created_at":"2015-04-14T00:06:27Z","updated_at":"2016-01-14T17:17:40Z","pushed_at":"2017-07-25T05:07:10Z","git_url":"git://github.com/clockard/ddf.git","ssh_url":"git@github.com:clockard/ddf.git","clone_url":"https://github.com/clockard/ddf.git","svn_url":"https://github.com/clockard/ddf","homepage":"","size":168103,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"codice:master","ref":"master","sha":"2f5effb3202652018767180724dd66ce1f22cbe0","user":{"login":"codice","id":2386734,"avatar_url":"https://avatars2.githubusercontent.com/u/2386734?v=4","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"repo":{"id":15173563,"name":"ddf","full_name":"codice/ddf","owner":{"login":"codice","id":2386734,"avatar_url":"https://avatars2.githubusercontent.com/u/2386734?v=4","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codice/ddf","description":"Distributed Data Framework - an open source, modular integration framework.","fork":false,"url":"https://api.github.com/repos/codice/ddf","forks_url":"https://api.github.com/repos/codice/ddf/forks","keys_url":"https://api.github.com/repos/codice/ddf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codice/ddf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codice/ddf/teams","hooks_url":"https://api.github.com/repos/codice/ddf/hooks","issue_events_url":"https://api.github.com/repos/codice/ddf/issues/events{/number}","events_url":"https://api.github.com/repos/codice/ddf/events","assignees_url":"https://api.github.com/repos/codice/ddf/assignees{/user}","branches_url":"https://api.github.com/repos/codice/ddf/branches{/branch}","tags_url":"https://api.github.com/repos/codice/ddf/tags","blobs_url":"https://api.github.com/repos/codice/ddf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codice/ddf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codice/ddf/git/refs{/sha}","trees_url":"https://api.github.com/repos/codice/ddf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codice/ddf/statuses/{sha}","languages_url":"https://api.github.com/repos/codice/ddf/languages","stargazers_url":"https://api.github.com/repos/codice/ddf/stargazers","contributors_url":"https://api.github.com/repos/codice/ddf/contributors","subscribers_url":"https://api.github.com/repos/codice/ddf/subscribers","subscription_url":"https://api.github.com/repos/codice/ddf/subscription","commits_url":"https://api.github.com/repos/codice/ddf/commits{/sha}","git_commits_url":"https://api.github.com/repos/codice/ddf/git/commits{/sha}","comments_url":"https://api.github.com/repos/codice/ddf/comments{/number}","issue_comment_url":"https://api.github.com/repos/codice/ddf/issues/comments{/number}","contents_url":"https://api.github.com/repos/codice/ddf/contents/{+path}","compare_url":"https://api.github.com/repos/codice/ddf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codice/ddf/merges","archive_url":"https://api.github.com/repos/codice/ddf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codice/ddf/downloads","issues_url":"https://api.github.com/repos/codice/ddf/issues{/number}","pulls_url":"https://api.github.com/repos/codice/ddf/pulls{/number}","milestones_url":"https://api.github.com/repos/codice/ddf/milestones{/number}","notifications_url":"https://api.github.com/repos/codice/ddf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codice/ddf/labels{/name}","releases_url":"https://api.github.com/repos/codice/ddf/releases{/id}","deployments_url":"https://api.github.com/repos/codice/ddf/deployments","created_at":"2013-12-13T20:38:28Z","updated_at":"2017-07-18T02:43:49Z","pushed_at":"2017-07-25T16:39:02Z","git_url":"git://github.com/codice/ddf.git","ssh_url":"git@github.com:codice/ddf.git","clone_url":"https://github.com/codice/ddf.git","svn_url":"https://github.com/codice/ddf","homepage":"http://ddf.codice.org","size":327438,"stargazers_count":60,"watchers_count":60,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":113,"mirror_url":null,"open_issues_count":29,"forks":113,"open_issues":29,"watchers":60,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codice/ddf/pulls/2141"},"html":{"href":"https://github.com/codice/ddf/pull/2141"},"issue":{"href":"https://api.github.com/repos/codice/ddf/issues/2141"},"comments":{"href":"https://api.github.com/repos/codice/ddf/issues/2141/comments"},"review_comments":{"href":"https://api.github.com/repos/codice/ddf/pulls/2141/comments"},"review_comment":{"href":"https://api.github.com/repos/codice/ddf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codice/ddf/pulls/2141/commits"},"statuses":{"href":"https://api.github.com/repos/codice/ddf/statuses/764b11c5b63ccb99d1bbc4ef8256c69ea5bdb2c0"}}}}
{"actor":{"display_login":"stustison"}}