diff --git a/apps/dashboard/web/polaris_web/package-lock.json b/apps/dashboard/web/polaris_web/package-lock.json index bdd2ab2a1a..55a290f930 100644 --- a/apps/dashboard/web/polaris_web/package-lock.json +++ b/apps/dashboard/web/polaris_web/package-lock.json @@ -14,8 +14,6 @@ "@fortawesome/react-fontawesome": "^0.2.0", "@mui/material": "^5.9.2", "@mui/x-date-pickers": "^5.0.0", - "@sentry/cli": "^2.25.0", - "@sentry/react": "^7.93.0", "@shopify/polaris": "^11.2.1", "@stigg/react-sdk": "^4.8.0", "@testing-library/jest-dom": "^5.16.5", @@ -4719,142 +4717,6 @@ "node": ">=8" } }, - "node_modules/@sentry/cli": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-2.31.0.tgz", - "integrity": "sha512-nCESoXAG3kRUO5n3QbDYAqX6RU3z1ORjnd7a3sqijYsCGHfOpcjGdS7JYLVg5if+tXMEF5529BPXFe5Kg/J9tw==", - "hasInstallScript": true, - "dependencies": { - "https-proxy-agent": "^5.0.0", - "node-fetch": "^2.6.7", - "progress": "^2.0.3", - "proxy-from-env": "^1.1.0", - "which": "^2.0.2" - }, - "bin": { - "sentry-cli": "bin/sentry-cli" - }, - "engines": { - "node": ">= 10" - }, - "optionalDependencies": { - "@sentry/cli-darwin": "2.31.0", - "@sentry/cli-linux-arm": "2.31.0", - "@sentry/cli-linux-arm64": "2.31.0", - "@sentry/cli-linux-i686": "2.31.0", - "@sentry/cli-linux-x64": "2.31.0", - "@sentry/cli-win32-i686": "2.31.0", - "@sentry/cli-win32-x64": "2.31.0" - } - }, - "node_modules/@sentry/cli-darwin": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-darwin/-/cli-darwin-2.31.0.tgz", - "integrity": "sha512-VM5liyxMnm4K2g0WsrRPXRCMLhaT09C7gK5Fz/CxKYh9sbMZB7KA4hV/3klkyuyw1+ECF1J66cefhNkFZepUig==", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@sentry/cli-linux-arm": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm/-/cli-linux-arm-2.31.0.tgz", - "integrity": "sha512-AZoCN3waXEfXGCd3YSrikcX/y63oQe0Tiyapkeoifq/0QhI+2MOOrAQb60gthsXwb0UDK/XeFi3PaxyUCphzxA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux", - "freebsd" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@sentry/cli-linux-arm64": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.31.0.tgz", - "integrity": "sha512-eENJTmXoFX3uNr8xRW7Bua2Sw3V1tylQfdtS85pNjZPdbm3U8wYQSWu2VoZkK2ASOoC+17YC8jTQxq62KWnSeQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux", - "freebsd" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@sentry/cli-linux-i686": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-linux-i686/-/cli-linux-i686-2.31.0.tgz", - "integrity": "sha512-cQUFb3brhLaNSIoNzjU/YASnTM1I3TDJP9XXzH0eLK9sSopCcDcc6OrYEYvdjJXZKzFv5sbc9UNMsIDbh4+rYg==", - "cpu": [ - "x86", - "ia32" - ], - "optional": true, - "os": [ - "linux", - "freebsd" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@sentry/cli-linux-x64": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-linux-x64/-/cli-linux-x64-2.31.0.tgz", - "integrity": "sha512-z1zTNg91nZJRdcGHC/bCU1KwIaifV0MLJteip9KrFDprzhJk1HtMxFOS0+OZ5/UH21CjAFmg9Pj6IAGqm3BYjA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux", - "freebsd" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@sentry/cli-win32-i686": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-win32-i686/-/cli-win32-i686-2.31.0.tgz", - "integrity": "sha512-+K7fdk57aUd4CmYrQfDGYPzVyxsTnVro6IPb5QSSLpP03dL7ko5208epu4m2SyN/MkFvscy9Di3n3DTvIfDU2w==", - "cpu": [ - "x86", - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@sentry/cli-win32-x64": { - "version": "2.31.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-win32-x64/-/cli-win32-x64-2.31.0.tgz", - "integrity": "sha512-w5cvpZ6VVlhlyleY8TYHmrP7g48vKHnoVt5xFccfxT+HqQI/AxodvzgVvBTM2kB/sh/kHwexp6bJGWCdkGftww==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=10" - } - }, "node_modules/@sentry/core": { "version": "7.109.0", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.109.0.tgz", @@ -4867,24 +4729,6 @@ "node": ">=8" } }, - "node_modules/@sentry/react": { - "version": "7.109.0", - "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.109.0.tgz", - "integrity": "sha512-KqXoDh6LVhNO+FLdM5LiTGpuorFvjoBPQ4nPGIVbjeMY/KZIau3kFxR142EvCApxmD69yvS5EhMnEqlNdaQPGw==", - "dependencies": { - "@sentry/browser": "7.109.0", - "@sentry/core": "7.109.0", - "@sentry/types": "7.109.0", - "@sentry/utils": "7.109.0", - "hoist-non-react-statics": "^3.3.2" - }, - "engines": { - "node": ">=8" - }, - "peerDependencies": { - "react": "15.x || 16.x || 17.x || 18.x" - } - }, "node_modules/@sentry/replay": { "version": "7.109.0", "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.109.0.tgz", @@ -19758,14 +19602,6 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/promise": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/promise/-/promise-8.3.0.tgz", diff --git a/apps/dashboard/web/polaris_web/package.json b/apps/dashboard/web/polaris_web/package.json index 93490852e2..1caa76c332 100644 --- a/apps/dashboard/web/polaris_web/package.json +++ b/apps/dashboard/web/polaris_web/package.json @@ -9,8 +9,6 @@ "@fortawesome/react-fontawesome": "^0.2.0", "@mui/material": "^5.9.2", "@mui/x-date-pickers": "^5.0.0", - "@sentry/cli": "^2.25.0", - "@sentry/react": "^7.93.0", "@shopify/polaris": "^11.2.1", "@stigg/react-sdk": "^4.8.0", "@testing-library/jest-dom": "^5.16.5", diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRoleSettings/TestRoleSettings.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRoleSettings/TestRoleSettings.jsx index 5ca3d62793..463e976a2a 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRoleSettings/TestRoleSettings.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRoleSettings/TestRoleSettings.jsx @@ -48,7 +48,7 @@ function TestRoleSettings() { const [searchParams] = useSearchParams(); const systemRole = searchParams.get("system") - const isDataInState = location?.state != undefined && Object.keys(location?.state).length > 0 + const isDataInState = location.state && location?.state !== undefined && Object.keys(location?.state).length > 0 const isDataInSearch = searchParams.get("name") const isNew = !isDataInState && !isDataInSearch const pageTitle = isNew ? "Add test role" : "Configure test role" @@ -82,9 +82,7 @@ function TestRoleSettings() { } useEffect(() => { if (!isNew) { - let newItems = initialItems - if (isDataInState) { newItems = location.state setInitialItems(location.state); @@ -127,7 +125,6 @@ function TestRoleSettings() { } const saveAction = async (updatedAuth=false, authWithCondLists = null) => { - setRefresh(!refresh) let andConditions = transform.filterContainsConditions(conditions, 'AND') let orConditions = transform.filterContainsConditions(conditions, 'OR') if (!(andConditions || orConditions) || roleName.length == 0) { @@ -158,6 +155,9 @@ function TestRoleSettings() { } } } + setTimeout(() => { + setRefresh(!refresh) + },200) } const handleTextChange = (val) => { diff --git a/apps/dashboard/web/polaris_web/web/src/apps/main/index.js b/apps/dashboard/web/polaris_web/web/src/apps/main/index.js index f43a8ed437..6ff22e4e0d 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/main/index.js +++ b/apps/dashboard/web/polaris_web/web/src/apps/main/index.js @@ -7,26 +7,6 @@ import en from "@shopify/polaris/locales/en.json"; import { StiggProvider } from '@stigg/react-sdk'; import "@shopify/polaris/build/esm/styles.css"; import ExpiredApp from "./ExpiredApp" -import * as Sentry from "@sentry/react"; - -Sentry.init({ - dsn: "https://ddf19fb1a875f83cfa3baa1a8efe35d0@o4506573945438208.ingest.sentry.io/4506574714306560", - integrations: [ - new Sentry.BrowserTracing({ - // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled - tracePropagationTargets: ["*"], - }), - new Sentry.Replay({ - maskAllText: false, - blockAllMedia: false, - }), - ], - // Performance Monitoring - tracesSampleRate: 1.0, // Capture 100% of the transactions - // Session Replay - replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production. - replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur. -}); const container = document.getElementById("root"); const root = createRoot(container); diff --git a/apps/testing/src/main/java/com/akto/testing/Main.java b/apps/testing/src/main/java/com/akto/testing/Main.java index f34059bb62..51ffeaf33a 100644 --- a/apps/testing/src/main/java/com/akto/testing/Main.java +++ b/apps/testing/src/main/java/com/akto/testing/Main.java @@ -40,6 +40,7 @@ import com.akto.util.DashboardMode; import com.akto.util.EmailAccountName; import com.akto.util.enums.GlobalEnums; +import com.akto.util.enums.GlobalEnums.Severity; import com.mongodb.BasicDBObject; import com.mongodb.ConnectionString; import com.mongodb.client.model.*; @@ -70,6 +71,14 @@ public class Main { public static boolean SKIP_SSRF_CHECK = ("true".equalsIgnoreCase(System.getenv("SKIP_SSRF_CHECK")) || !DashboardMode.isSaasDeployment()); public static final boolean IS_SAAS = "true".equalsIgnoreCase(System.getenv("IS_SAAS")); + private static Map emptyCountIssuesMap = new HashMap<>(); + + static { + emptyCountIssuesMap.put(Severity.HIGH.toString(), 0); + emptyCountIssuesMap.put(Severity.MEDIUM.toString(), 0); + emptyCountIssuesMap.put(Severity.LOW.toString(), 0); + } + private static TestingRunResultSummary createTRRSummaryIfAbsent(TestingRun testingRun, int start){ ObjectId testingRunId = new ObjectId(testingRun.getHexId()); @@ -80,7 +89,9 @@ private static TestingRunResultSummary createTRRSummaryIfAbsent(TestingRun testi ), Updates.combine( Updates.set(TestingRunResultSummary.STATE, TestingRun.State.RUNNING), - Updates.setOnInsert(TestingRunResultSummary.START_TIMESTAMP, start) + Updates.setOnInsert(TestingRunResultSummary.START_TIMESTAMP, start), + Updates.set(TestingRunResultSummary.TEST_RESULTS_COUNT, 0), + Updates.set(TestingRunResultSummary.COUNT_ISSUES, emptyCountIssuesMap) ), new FindOneAndUpdateOptions().upsert(true).returnDocument(ReturnDocument.AFTER) ); @@ -371,6 +382,8 @@ public void run() { trrs.setId(new ObjectId()); trrs.setStartTimestamp(start); trrs.setState(State.RUNNING); + trrs.setTestResultsCount(0); + trrs.setCountIssues(emptyCountIssuesMap); TestingRunResultSummariesDao.instance.insertOne(trrs); summaryId = trrs.getId(); } else {