application-scanner-task

This commit is contained in:
David Adewole 2021-06-25 21:40:24 +01:00
parent 6fdfd4398d
commit 39f128cffc
8 changed files with 68 additions and 27 deletions

View File

@ -4,6 +4,6 @@ STRIPE_PUBLIC_KEY=pk_test_UynUDrFmbBmFVgJXd9EZCvBj00QAVpdwPv
AMPLITUDE_PUBLIC_KEY=cb70632f45c1ca7fe6180812c0d6494a
SKIP_PREFLIGHT_CHECK=true
PUBLIC_URL=/accounts
REACT_APP_IS_SAAS_SERVICE=true
IS_SAAS_SERVICE=true
#REACT_APP_IS_SAAS_SERVICE=true
#IS_SAAS_SERVICE=true
#REACT_APP_DISABLE_SIGNUP=true

View File

@ -175,7 +175,7 @@ export const Validate = {
return false;
},
isValidBusinessEmail() {
isValidBusinessEmail(email) {
// return emaildomains.test(email);
return true;
},

View File

@ -7,29 +7,11 @@ FROM node:16
#SET ENV Variables
ENV PRODUCTION=true
#ENV CHROME_PATH=/usr/bin/google-chrome
# Install Chrome.
# RUN \
# wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
# echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
# apt-get update && \
# apt-get install -y google-chrome-stable && \
# rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install trivy for container scanning
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b /usr/local/bin
# Install kubectl for kubernetes monitor scanning
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin/kubectl && \
chown root: /usr/local/bin/kubectl
# Install app dependencies
COPY package*.json /usr/src/app/
RUN npm ci --only=production
@ -39,7 +21,7 @@ COPY . /usr/src/app
# Expose ports.
# - 3004: Application Scanner
EXPOSE 3004
EXPOSE 3005
#Run the app
CMD [ "npm", "start"]

View File

@ -0,0 +1,26 @@
#
# Fyipe-backend Dockerfile
#
# Pull base image nodejs image.
FROM node:16
WORKDIR /usr/src/app
# Install app dependencies
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
RUN npm ci
# Expose ports.
# - 3004: Application Scanner
EXPOSE 3005
#Run the app
CMD [ "npm", "run", "dev"]

View File

@ -35,7 +35,7 @@ const config = require('./utils/config');
const cronApplicationSecurityStartTime = Math.floor(Math.random() * 50);
app.use(cors());
app.set('port', process.env.PORT || 3004);
app.set('port', process.env.PORT || 3005);
http.listen(app.get('port'), function() {
// eslint-disable-next-line
@ -66,7 +66,7 @@ app.get(['/application/version', '/version'], function(req, res) {
});
// Run this cron at 3 AM once a day.
cron.schedule('*/2 * * * *', () => {
cron.schedule('0 3 * * *', () => {
setTimeout(() => {
Main.runApplicationScan();
}, cronApplicationSecurityStartTime * 1000);

View File

@ -10,9 +10,9 @@ MONGO_URL=mongodb://localhost:27017/fyipedb
REDIS_HOST=localhost
CLUSTER_KEY=f414c23b4cdf4e84a6a66ecfd528eff2
TEST_TWILIO_NUMBER=+919910568840
IS_SAAS_SERVICE=true
#IS_SAAS_SERVICE=true
ENCRYPTION_KEY=01234567890123456789012345678901
IS_TESTING=true
#IS_TESTING=true
PUSHNOTIFICATION_PRIVATE_KEY=8aXTsH48-cegK-xBApLxxOezCOZIjaWpg81Dny2zbio
PUSHNOTIFICATION_PUBLIC_KEY=BFAPbOTTU14VbTe_dnoYlVnOPLKUNm8GYmC50n3i4Ps64sk1Xqx8e894Clrscn1L2PsQ8-l4SsJVw7NRg4cx69Y
PUSHNOTIFICATION_URL=mailto:support@fyipe.com

View File

@ -261,6 +261,25 @@ services:
# Use node modules of the container and not host system.
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/node_modules/
application-scanner:
ports:
- '3005:3005'
- '9240:9229' # Debugging port.
build:
context: ./application-scanner
dockerfile: ./Dockerfile.dev
env_file:
- ./application-scanner/.env
environment:
- PORT=3005
- SERVER_URL=http://backend:3002
- APPLICATION_SCANNER_NAME=US
- APPPLICATION_SCANNER_KEY=test-key
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
volumes:
- ./application-scanner:/usr/src/app
# Use node modules of the container and not host system.
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/node_modules/
volumes:
mongodata:

View File

@ -180,6 +180,20 @@ services:
build: ./script-runner
environment:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
application-scanner:
ports:
- '3005:3005'
build: ./application-scanner
env_file:
- ./application-scanner/.env
environment:
- PORT=3005
- SERVER_URL=http://backend:3002
- APPLICATION_SCANNER_NAME=US
- APPLICATION_SCANNER_KEY=test-key
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
depends_on:
- backend
volumes:
mongodata: