Skip to content

Commit

Permalink
[Horusec-manager] - Insecure dependencies (#381)
Browse files Browse the repository at this point in the history
* Manager dependencies: Resolving insecure dependencies for the horusec/manager

Signed-off-by: lucas.bruno <[email protected]>

* Dependencies: Add dependencie to run build on github-action

Signed-off-by: lucas.bruno <[email protected]>

* Github Workflow: Add preinstall on cypress step on manager workflow

Signed-off-by: lucas.bruno <[email protected]>

* Github Workflow: Add preinstall on manager workflow

Signed-off-by: lucas.bruno <[email protected]>

* Workflow: Fixing command to preinsntall manager

Signed-off-by: lucas.bruno <[email protected]>

* Manager: Add new comand to install dependencies with resolutions

Signed-off-by: lucas.bruno <[email protected]>

* Manager packages: Change the npm to yarn on default

Signed-off-by: lucas.bruno <[email protected]>

* fix: removing unecessary yarn.lock file

Signed-off-by: lucas.bruno <[email protected]>
  • Loading branch information
lucasbrunozup authored Oct 20, 2021
1 parent 890f9ef commit cb16a6f
Show file tree
Hide file tree
Showing 10 changed files with 13,590 additions and 20,324 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/manager-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ jobs:
id: node
- uses: actions/checkout@v2
- name: Install dependencies
run: npm install
run: yarn
- name: Lint
run: npm run lint
run: yarn lint
- name: Test
uses: cypress-io/github-action@v2
with:
working-directory: manager
browser: chrome
build: npm run build
install-command: yarn
build: yarn build
start: npx serve -s build -l 3000
wait-on: 'http://localhost:3000'
- name: Upload cypress videos
Expand Down
4 changes: 2 additions & 2 deletions deployments/dockerfiles/all-in-one/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ WORKDIR /usr/src/app

ADD . .

RUN cd manager && npm install
RUN cd manager && npm run build
RUN cd manager && yarn
RUN cd manager && yarn build

FROM docker:dind

Expand Down
1 change: 0 additions & 1 deletion manager/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": [
"react-app",
"plugin:jsx-a11y/strict",
"eslint:recommended",
"plugin:react/recommended",
Expand Down
1 change: 1 addition & 0 deletions manager/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
6 changes: 3 additions & 3 deletions manager/deployments/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ WORKDIR /manager

ENV NO_PROXY=localhost
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
RUN npm config set registry http://registry.npmjs.org
RUN yarn config set registry http://registry.yarnpkg.com

RUN npm install
RUN npm run build
RUN yarn
RUN yarn build

FROM nginx:1.21.3-alpine

Expand Down
20,303 changes: 0 additions & 20,303 deletions manager/package-lock.json

This file was deleted.

29 changes: 22 additions & 7 deletions manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
"keycloak-js": "15.0.2",
"lodash": "4.17.21",
"material-ui-popup-state": "1.9.3",
"node-releases": "^2.0.0",
"query-string": "7.0.1",
"react": "17.0.2",
"react-apexcharts": "1.3.9",
"react-app-rewired": "2.1.8",
"react-datepicker": "4.2.1",
"react-dom": "17.0.2",
"react-hook-form": "7.17.3",
"react-datepicker": "4.2.1",
"react-i18next": "11.12.0",
"react-linkify": "1.0.0-alpha",
"react-router-dom": "5.3.0",
Expand All @@ -53,9 +54,10 @@
},
"devDependencies": {
"@axe-core/react": "4.3.1",
"@testing-library/react-hooks": "7.0.2",
"@testing-library/react": "12.1.2",
"@cypress/react": "5.10.1",
"@testing-library/jest-dom": "5.14.1",
"@testing-library/react": "12.1.2",
"@testing-library/react-hooks": "7.0.2",
"@testing-library/user-event": "13.3.0",
"@types/axios": "0.14.0",
"@types/cypress": "1.1.3",
Expand All @@ -65,9 +67,9 @@
"@types/keycloak-js": "3.4.1",
"@types/lodash": "4.14.175",
"@types/node": "14.17.21",
"@types/react": "17.0.27",
"@types/react-datepicker": "4.1.7",
"@types/react-dom": "17.0.9",
"@types/react": "17.0.27",
"@types/react-linkify": "1.0.1",
"@types/react-router-dom": "5.3.1",
"@types/single-spa-react": "3.0.1",
Expand All @@ -76,7 +78,6 @@
"@typescript-eslint/parser": "4.33.0",
"chokidar": "3.5.2",
"cypress": "8.5.0",
"cypress-react-unit-test": "4.17.2",
"eslint": "7.32.0",
"eslint-config-prettier": "6.15.0",
"eslint-config-react": "1.1.7",
Expand All @@ -91,15 +92,29 @@
"prettier": "2.4.1",
"typescript": "4.4.3"
},
"resolutions": {
"immer": "9.0.6",
"ansi-html": "https://registry.yarnpkg.com/ansi-html-community/-/ansi-html-community-0.0.8.tgz#69fbc4d6ccbe383f9736934ae34c3f8290f1bf41",
"ansi-regex": "5.0.1",
"glob-parent": "5.1.2",
"nth-check": "2.0.1",
"browserslist": "4.16.5",
"highlight.js": "10.4.1",
"set-value": "4.0.1"
},
"scripts": {
"start": "npx react-scripts start",
"build": "npx react-scripts build ---production",
"start": "npx react-scripts start --yarn",
"build": "npx react-scripts build --yarn",
"lint:fix": "eslint './src/**/*.{ts,tsx}' --fix",
"lint": "eslint './src/**/*.{ts,tsx}'",
"eject": "react-scripts eject",
"cypress": "cypress run",
"cypress:open": "cypress open"
},
"engines": {
"npm": "please-use-yarn",
"yarn": ">=1.10.0"
},
"jest": {
"coverageThreshold": {
"global": {
Expand Down
12 changes: 8 additions & 4 deletions manager/src/helpers/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { random } from 'lodash';

const generateRandomColor = (): string => {
const x = Math.floor(Math.random() * 256);
const y = Math.floor(Math.random() * 256);
const z = Math.floor(Math.random() * 256);
return `rgba(${x}, ${y}, ${z}, 0.55)`;
const X = random(0, 250, false);
const Y = random(0, 250, false);
const Z = random(0, 250, false);

const opacity = 0.55;

return `rgba(${X}, ${Y}, ${Z}, ${opacity})`;
};

export { generateRandomColor };
2 changes: 1 addition & 1 deletion manager/src/pages/Overview/Dashboard/Filters/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const Filters: React.FC<FilterProps> = ({ type, onApply }) => {

useEffect(() => {
onApply(initialValues);
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line
}, []);

return (
Expand Down
Loading

0 comments on commit cb16a6f

Please sign in to comment.