From 822ccc0b2da502281b32dddb7ed8d70fe88c4e21 Mon Sep 17 00:00:00 2001 From: frikky Date: Wed, 10 Aug 2022 19:36:04 +0200 Subject: [PATCH] Fixed another python script bug and enabled debugging --- frontend/src/components/OrgHeader.jsx | 42 ++++++++++++++++++++ frontend/src/views/Admin.jsx | 18 +++++++++ frontend/src/views/AppCreator.jsx | 6 ++- functions/extensions/wazuh/custom-shuffle.py | 8 ++-- functions/onprem/orborus/go.mod | 2 +- functions/onprem/orborus/go.sum | 2 + functions/onprem/orborus/orborus.go | 12 ++++++ 7 files changed, 84 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/OrgHeader.jsx b/frontend/src/components/OrgHeader.jsx index 823189ae..881c303b 100644 --- a/frontend/src/components/OrgHeader.jsx +++ b/frontend/src/components/OrgHeader.jsx @@ -97,6 +97,15 @@ const OrgHeader = (props) => { ? "" : selectedOrganization.defaults.notification_workflow ); + + const [documentationReference, setDocumentationReference] = React.useState( + selectedOrganization.defaults === undefined + ? "" + : selectedOrganization.defaults.documentation_reference === undefined || + selectedOrganization.defaults.documentation_reference.length === 0 + ? "" + : selectedOrganization.defaults.documentation_reference + ); const [openidClientId, setOpenidClientId] = React.useState( selectedOrganization.sso_config === undefined ? "" @@ -245,6 +254,7 @@ const OrgHeader = (props) => { workflow_download_repo: workflowDownloadUrl, workflow_download_branch: workflowDownloadBranch, notification_workflow: notificationWorkflow, + documentation_reference: documentationReference, }, { sso_entrypoint: ssoEntrypoint, @@ -449,6 +459,38 @@ const OrgHeader = (props) => { /> + + + Org Documentation reference + { + setDocumentationReference(e.target.value); + }} + InputProps={{ + classes: { + notchedOutline: classes.notchedOutline, + }, + style: { + color: "white", + }, + }} + /> + + {isCloud ? null : OpenID connect diff --git a/frontend/src/views/Admin.jsx b/frontend/src/views/Admin.jsx index 1a089902..5c7d954c 100644 --- a/frontend/src/views/Admin.jsx +++ b/frontend/src/views/Admin.jsx @@ -2744,6 +2744,21 @@ const Admin = (props) => { + {selectedOrganization.defaults !== undefined && selectedOrganization.defaults.documentation_reference !== undefined && selectedOrganization.defaults.documentation_reference !== null && selectedOrganization.defaults.documentation_reference.includes("http") ? + + + + + + + + : null} {selectedOrganization.name.length > 0 ? ( { cloud sync @@ -3423,6 +3439,7 @@ const Admin = (props) => { Add, edit, block or change passwords.{" "} @@ -3799,6 +3816,7 @@ const Admin = (props) => { Files from Workflows.{" "} diff --git a/frontend/src/views/AppCreator.jsx b/frontend/src/views/AppCreator.jsx index bb5dd68b..2f6cc4ab 100644 --- a/frontend/src/views/AppCreator.jsx +++ b/frontend/src/views/AppCreator.jsx @@ -3712,7 +3712,11 @@ const AppCreator = (defaultprops) => { headers += key + "=" + value + "\n"; } - setActionField("headers", headers.trim()); + try { + setActionField("headers", headers.trim()); + } catch (e) { + console.log("Failed to parse header: ", e) + } } if (request.body !== undefined && request.body !== null) { diff --git a/functions/extensions/wazuh/custom-shuffle.py b/functions/extensions/wazuh/custom-shuffle.py index 014c9e8e..92ffa66f 100644 --- a/functions/extensions/wazuh/custom-shuffle.py +++ b/functions/extensions/wazuh/custom-shuffle.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Created by Shuffle, AS. . # Based on the Slack integration using Webhooks @@ -24,7 +24,7 @@ except Exception as e: # Global vars -debug_enabled = False +debug_enabled = True pwd = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) json_alert = {} now = time.strftime("%a %b %d %H:%M:%S %Z %Y") @@ -56,8 +56,8 @@ def main(args): debug("# Processing alert") try: debug(json_alert) - except: - debug("Failed getting json_alert") + except Exception as e: + debug("Failed getting json_alert %s" % e) sys.exit(1) debug("# Generating message") diff --git a/functions/onprem/orborus/go.mod b/functions/onprem/orborus/go.mod index b1766e3d..7beea74e 100644 --- a/functions/onprem/orborus/go.mod +++ b/functions/onprem/orborus/go.mod @@ -8,5 +8,5 @@ require ( github.com/docker/go-connections v0.4.0 // indirect github.com/mackerelio/go-osstat v0.2.1 github.com/satori/go.uuid v1.2.0 - github.com/shuffle/shuffle-shared v0.2.64 + github.com/shuffle/shuffle-shared v0.2.82 ) diff --git a/functions/onprem/orborus/go.sum b/functions/onprem/orborus/go.sum index 73452a10..2bb255e8 100644 --- a/functions/onprem/orborus/go.sum +++ b/functions/onprem/orborus/go.sum @@ -792,6 +792,8 @@ github.com/shuffle/shuffle-shared v0.2.63 h1:IF82o5WS4+6wEIirqAd1qEm/pBCuQMbn2CJ github.com/shuffle/shuffle-shared v0.2.63/go.mod h1:YuMle0RjwXb3hxR5PdaOOD9e+hUyK34OABS0UbrT/Sk= github.com/shuffle/shuffle-shared v0.2.64 h1:WpCKiL5tNt7wTJaHkf1zXhjeUB5ltFap1dXgU6ijKq4= github.com/shuffle/shuffle-shared v0.2.64/go.mod h1:YuMle0RjwXb3hxR5PdaOOD9e+hUyK34OABS0UbrT/Sk= +github.com/shuffle/shuffle-shared v0.2.82 h1:V3bYw7MxHPQgydUuWLGHONpX7NwbRPPAALovKqsdaW0= +github.com/shuffle/shuffle-shared v0.2.82/go.mod h1:YuMle0RjwXb3hxR5PdaOOD9e+hUyK34OABS0UbrT/Sk= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 34eb5afe..1dd959bc 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -834,6 +834,18 @@ func checkSwarmService(ctx context.Context) { // Initial loop etc func main() { + startupDelay := os.Getenv("SHUFFLE_ORBORUS_STARTUP_DELAY") + if len(startupDelay) > 0 { + log.Printf("[DEBUG] Setting startup delay to %#v", startupDelay) + + tmpInt, err := strconv.Atoi(startupDelay) + if err == nil { + time.Sleep(time.Duration(tmpInt) * time.Second) + } else { + log.Printf("[WARNING] Env SHUFFLE_ORBORUS_STARTUP_DELAY must be a number, not %s", startupDelay) + } + } + log.Println("[INFO] Setting up execution environment") //FIXME