diff --git a/backend/src/enums.ts b/backend/src/enums.ts deleted file mode 100644 index 4b44a80a..00000000 --- a/backend/src/enums.ts +++ /dev/null @@ -1,43 +0,0 @@ -export enum RestMethod { - GET = "GET", - HEAD = "HEAD", - POST = "POST", - PUT = "PUT", - PATCH = "PATCH", - DELETE = "DELETE", - CONNECT = "CONNECT", - OPTIONS = "OPTIONS", - TRACE = "TRACE", -} - -export enum DataClass { - EMAIL = "Email", - CREDIT_CARD = "Credit Card Number", - SSN = "Social Security Number", - PHONE_NUMBER = "Phone Number", - IP_ADDRESS = "IP Address", - COORDINATE = "Geographic Coordinates", - VIN = "Vehicle Identification Number", - ADDRESS = "Address", - DOB = "Date of Birth", - DL_NUMBER = "Driver License Number", -} - -export enum RiskScore { - NONE = "none", - LOW = "low", - MEDIUM = "medium", - HIGH = "high", -} - -export enum SpecExtension { - JSON = "json", - YAML = "yaml", -} - -export enum AlertType { - NEW_ENDPOINT = "New Endpoint Detected", - PII_DATA_DETECTED = "PII Data Detected", - OPEN_API_SPEC_DIFF = "Open API Spec Diff", - UNDOCUMENTED_ENDPOINT = "Undocumented Endpoint", -} diff --git a/backend/src/types.ts b/backend/src/types.ts deleted file mode 100644 index 93923b21..00000000 --- a/backend/src/types.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { ApiEndpoint } from "models"; -import { AlertType, RestMethod, RiskScore } from "@common/enums"; - -export interface Meta { - incoming: boolean; - source: string; - sourcePort: string; - destination: string; - destinationPort: string; -} - -export interface PairObject { - name: string; - value: string; -} - -export interface Url { - host: string; - path: string; - parameters: PairObject[]; -} - -export interface Request { - url: Url; - headers: PairObject[]; - body: string; - method: RestMethod; -} - -export interface Response { - status: number; - headers: PairObject[]; - body: string; -} - -export interface TraceParams { - request: Request; - response: Response; - meta: Meta; -} - -export interface GetEndpointParams { - hosts?: string[]; - riskScores?: RiskScore[]; - offset?: number; - limit?: number; -} - -export interface GetAlertParams { - riskScores?: RiskScore[]; - resolved?: boolean; - alertTypes?: AlertType[]; - offset?: number; - limit?: number; -} - -export interface UpdatePIIFieldParams { - isRisk: boolean; -} - -export interface AlertResponse { - uuid: string; - type: AlertType; - riskScore: RiskScore; - apiEndpointUuid: string; - apiEndpoint: ApiEndpoint; - description: string; - createdAt: Date; - updatedAt: Date; - resolved: boolean; - resolutionMessage: string; -} - -export interface SummaryResponse { - highRiskAlerts: number; - newAlerts: number; - endpointsTracked: number; - piiDataFields: number; -} - -export interface IsRiskParams { - isRisk: boolean; -} - -export type JSONValue = - | string - | number - | boolean - | { [x: string]: JSONValue } - | Array; diff --git a/deploy/backend/Dockerfile b/deploy/backend/Dockerfile index b6996b1d..df89a222 100644 --- a/deploy/backend/Dockerfile +++ b/deploy/backend/Dockerfile @@ -2,13 +2,16 @@ FROM node:alpine WORKDIR /usr/src/app -ADD ../../../backend . +ADD ../../../backend backend +ADD ../../../common common -WORKDIR /usr/src/app/backend +WORKDIR /usr/src/app/common +RUN yarn +RUN yarn build +WORKDIR /usr/src/app/backend RUN yarn EXPOSE 8080 - RUN yarn build CMD [ "yarn", "start" ]