diff --git a/backend/Dockerfile b/backend/Dockerfile index 6985ced6..6164f1da 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,41 +1,11 @@ -# Stage 1: Build -FROM node:18-alpine AS builder - -# Set working directory +FROM node:24 AS builder WORKDIR /app - -# Install dependencies COPY package.json package-lock.json ./ -RUN npm ci --only=production - -# Copy source code -COPY . . +RUN npm ci --omit=dev +COPY . ./ -# Stage 2: Production -FROM node:18-alpine - -# Set working directory +FROM gcr.io/distroless/nodejs24-debian12 AS production WORKDIR /app - -# Create a non-root user -RUN addgroup -S appgroup && adduser -S appuser -G appgroup - -# Copy dependencies from builder -COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app ./ - -# Set environment variables -ENV NODE_ENV=production - -# Expose port EXPOSE 5001 - -# Switch to non-root user -USER appuser - -# Start the server -CMD ["npm", "start"] - -# Health check -HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ - CMD curl -f http://localhost:5001/health || exit 1 \ No newline at end of file +CMD ["src/index.js"] diff --git a/backend/trivy-report.txt b/backend/trivy-report.txt new file mode 100644 index 00000000..28c88e4b --- /dev/null +++ b/backend/trivy-report.txt @@ -0,0 +1,391 @@ + +Report Summary + +┌────────────────────────────────────────────────────────────────────┬──────────┬─────────────────┬─────────┐ +│ Target │ Type │ Vulnerabilities │ Secrets │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ full-stack_chatapp-backend (debian 12.11) │ debian │ 14 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/@mongodb-js/saslprep/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/@socket.io/component-emitter/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/@types/cookie/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/@types/cors/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/@types/node/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/@types/webidl-conversions/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/@types/whatwg-url/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/accepts/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/anymatch/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/array-flatten/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/balanced-match/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/base64id/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/bcryptjs/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/binary-extensions/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/body-parser/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/brace-expansion/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/braces/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/bson/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/bson/vendor/base64/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/bson/vendor/text-encoding/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/buffer-equal-constant-time/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/bytes/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/call-bind/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/chokidar/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/cloudinary/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/concat-map/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/content-disposition/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/content-type/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/cookie-parser/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/cookie-signature/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/cookie/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/cors/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/debug/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/define-data-property/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/depd/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/destroy/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/dotenv/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/ecdsa-sig-formatter/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/ee-first/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/encodeurl/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/engine.io-parser/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/engine.io/node_modules/debug/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/engine.io/node_modules/ms/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/engine.io/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/es-define-property/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/es-errors/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/escape-html/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/etag/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/express/node_modules/cookie/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/express/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/fill-range/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/finalhandler/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/forwarded/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/fresh/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/function-bind/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/get-intrinsic/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/glob-parent/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/gopd/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/has-flag/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/has-property-descriptors/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/has-proto/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/has-symbols/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/hasown/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/http-errors/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/iconv-lite/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/ignore-by-default/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/inherits/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/ipaddr.js/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/is-binary-path/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/is-extglob/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/is-glob/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/is-number/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/jsonwebtoken/node_modules/ms/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/jsonwebtoken/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/jwa/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/jws/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/kareem/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/lodash.includes/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/lodash.isboolean/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/lodash.isinteger/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/lodash.isnumber/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/lodash.isplainobject/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/lodash.isstring/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/lodash.once/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/lodash/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/media-typer/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/memory-pager/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/merge-descriptors/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/methods/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mime-db/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mime-types/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mime/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/minimatch/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mongodb-connection-string-url/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mongodb/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mongoose/node_modules/ms/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mongoose/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mpath/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mquery/node_modules/debug/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mquery/node_modules/ms/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/mquery/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/ms/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/negotiator/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/nodemon/node_modules/debug/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/nodemon/node_modules/ms/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/nodemon/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/normalize-path/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/object-assign/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/object-inspect/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/on-finished/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/parseurl/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/path-to-regexp/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/picomatch/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/proxy-addr/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/pstree.remy/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/punycode/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/q/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/qs/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/range-parser/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/raw-body/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/readdirp/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/safe-buffer/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/safer-buffer/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/semver/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/send/node_modules/encodeurl/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/send/node_modules/ms/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/send/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/serve-static/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/set-function-length/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/setprototypeof/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/side-channel/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/sift/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/simple-update-notifier/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/socket.io-adapter/node_modules/debug/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/socket.io-adapter/node_modules/ms/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/socket.io-adapter/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/socket.io-parser/node_modules/debug/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/socket.io-parser/node_modules/ms/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/socket.io-parser/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/socket.io/node_modules/debug/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/socket.io/node_modules/ms/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/socket.io/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/sparse-bitfield/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/statuses/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/supports-color/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/to-regex-range/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/toidentifier/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/touch/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/tr46/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/type-is/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/undefsafe/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/undici-types/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/unpipe/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/utils-merge/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/vary/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/webidl-conversions/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/whatwg-url/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/node_modules/ws/package.json │ node-pkg │ 0 │ - │ +├────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤ +│ app/package.json │ node-pkg │ 0 │ - │ +└────────────────────────────────────────────────────────────────────┴──────────┴─────────────────┴─────────┘ +Legend: +- '-': Not scanned +- '0': Clean (no security findings detected) + + +full-stack_chatapp-backend (debian 12.11) +========================================= +Total: 14 (UNKNOWN: 0, LOW: 12, MEDIUM: 1, HIGH: 1, CRITICAL: 0) + +┌─────────────┬──────────────────┬──────────┬──────────┬───────────────────┬───────────────┬─────────────────────────────────────────────────────────────┐ +│ Library │ Vulnerability │ Severity │ Status │ Installed Version │ Fixed Version │ Title │ +├─────────────┼──────────────────┼──────────┼──────────┼───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤ +│ gcc-12-base │ CVE-2022-27943 │ LOW │ affected │ 12.2.0-14+deb12u1 │ │ binutils: libiberty/rust-demangle.c in GNU GCC 11.2 allows │ +│ │ │ │ │ │ │ stack exhaustion in demangle_const │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2022-27943 │ +├─────────────┼──────────────────┼──────────┤ ├───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤ +│ libc6 │ CVE-2025-4802 │ HIGH │ │ 2.36-9+deb12u10 │ │ glibc: static setuid binary dlopen may incorrectly search │ +│ │ │ │ │ │ │ LD_LIBRARY_PATH │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2025-4802 │ +│ ├──────────────────┼──────────┤ │ ├───────────────┼─────────────────────────────────────────────────────────────┤ +│ │ CVE-2025-8058 │ MEDIUM │ │ │ │ glibc: Double free in glibc │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2025-8058 │ +│ ├──────────────────┼──────────┤ │ ├───────────────┼─────────────────────────────────────────────────────────────┤ +│ │ CVE-2010-4756 │ LOW │ │ │ │ glibc: glob implementation can cause excessive CPU and │ +│ │ │ │ │ │ │ memory consumption due to... │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2010-4756 │ +│ ├──────────────────┤ │ │ ├───────────────┼─────────────────────────────────────────────────────────────┤ +│ │ CVE-2018-20796 │ │ │ │ │ glibc: uncontrolled recursion in function │ +│ │ │ │ │ │ │ check_dst_limits_calc_pos_1 in posix/regexec.c │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-20796 │ +│ ├──────────────────┤ │ │ ├───────────────┼─────────────────────────────────────────────────────────────┤ +│ │ CVE-2019-1010022 │ │ │ │ │ glibc: stack guard protection bypass │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-1010022 │ +│ ├──────────────────┤ │ │ ├───────────────┼─────────────────────────────────────────────────────────────┤ +│ │ CVE-2019-1010023 │ │ │ │ │ glibc: running ldd on malicious ELF leads to code execution │ +│ │ │ │ │ │ │ because of... │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-1010023 │ +│ ├──────────────────┤ │ │ ├───────────────┼─────────────────────────────────────────────────────────────┤ +│ │ CVE-2019-1010024 │ │ │ │ │ glibc: ASLR bypass using cache of thread stack and heap │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-1010024 │ +│ ├──────────────────┤ │ │ ├───────────────┼─────────────────────────────────────────────────────────────┤ +│ │ CVE-2019-1010025 │ │ │ │ │ glibc: information disclosure of heap addresses of │ +│ │ │ │ │ │ │ pthread_created thread │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-1010025 │ +│ ├──────────────────┤ │ │ ├───────────────┼─────────────────────────────────────────────────────────────┤ +│ │ CVE-2019-9192 │ │ │ │ │ glibc: uncontrolled recursion in function │ +│ │ │ │ │ │ │ check_dst_limits_calc_pos_1 in posix/regexec.c │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-9192 │ +├─────────────┼──────────────────┤ │ ├───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤ +│ libgcc-s1 │ CVE-2022-27943 │ │ │ 12.2.0-14+deb12u1 │ │ binutils: libiberty/rust-demangle.c in GNU GCC 11.2 allows │ +│ │ │ │ │ │ │ stack exhaustion in demangle_const │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2022-27943 │ +├─────────────┤ │ │ │ ├───────────────┤ │ +│ libgomp1 │ │ │ │ │ │ │ +│ │ │ │ │ │ │ │ +│ │ │ │ │ │ │ │ +├─────────────┼──────────────────┤ │ ├───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤ +│ libssl3 │ CVE-2025-27587 │ │ │ 3.0.17-1~deb12u1 │ │ OpenSSL 3.0.0 through 3.3.2 on the PowerPC architecture is │ +│ │ │ │ │ │ │ vulnerable ...... │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2025-27587 │ +├─────────────┼──────────────────┤ │ ├───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤ +│ libstdc++6 │ CVE-2022-27943 │ │ │ 12.2.0-14+deb12u1 │ │ binutils: libiberty/rust-demangle.c in GNU GCC 11.2 allows │ +│ │ │ │ │ │ │ stack exhaustion in demangle_const │ +│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2022-27943 │ +└─────────────┴──────────────────┴──────────┴──────────┴───────────────────┴───────────────┴─────────────────────────────────────────────────────────────┘ diff --git a/docker-compose.yml b/docker-compose.yml index aad2ca27..4e93547a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,56 +3,70 @@ services: build: context: ./frontend dockerfile: Dockerfile + container_name: frontend ports: - - "8080:80" - depends_on: - - backend + - "80:80" networks: - - chat-network - environment: - - BACKEND_URL=http://backend:5001 + - public_subnet + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:80/"] + interval: 30s + timeout: 8s + retries: 3 + start_period: 20s + depends_on: + backend: + condition: service_healthy restart: unless-stopped backend: + container_name: backend build: context: ./backend dockerfile: Dockerfile - ports: - - "5001:5001" - depends_on: - - mongo + expose: + - "5001" + networks: + - public_subnet + - private_subnet env_file: - .env - networks: - - chat-network + healthcheck: + test: ["CMD", "/nodejs/bin/node", "/app/src/routes/health.route.js"] + interval: 30s + timeout: 8s + retries: 3 + start_period: 20s + depends_on: + mongo: + condition: service_healthy restart: unless-stopped mongo: + container_name: mongodb image: mongo:latest - ports: - - "27017:27017" + expose: + - "27017" + networks: + - private_subnet + volumes: + - fullstack_data:/data/db environment: - MONGO_INITDB_ROOT_USERNAME=root - MONGO_INITDB_ROOT_PASSWORD=admin - volumes: - - mongodb_data:/data/db - networks: - - chat-network - restart: unless-stopped - -networks: - chat-network: - driver: bridge + - MONGODB_URI=${MONGODB_URI} + healthcheck: + test: ["CMD-SHELL", 'mongosh "${MONGODB_URI}" --quiet --eval "db.adminCommand({ ping: 1 }).ok" | grep -q 1'] + interval: 30s + timeout: 8s + retries: 3 + start_period: 20s volumes: - mongodb_data: - - - - - - - - - + fullstack_data: +networks: + private_subnet: + driver: bridge + public_subnet: + driver: bridge diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 228c6bd4..b6ce0d55 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,24 +1,13 @@ -# Build stage -FROM node:18-alpine as build +FROM node:18 as build WORKDIR /app -COPY package*.json ./ -RUN npm install -COPY . . +COPY package.json package-lock.json ./ +RUN npm ci +COPY . ./ RUN npm run build -# Production stage -FROM nginx:alpine - -# Create necessary directories and set permissions -RUN mkdir -p /var/cache/nginx /var/run /var/log/nginx && \ - chown -R nginx:nginx /var/cache/nginx /var/run /var/log/nginx - -# Copy built files and configuration +FROM nginx:stable-alpine as production COPY --from=build /app/dist /usr/share/nginx/html +RUN chown nginx:nginx /usr/share/nginx/html/* COPY nginx.conf /etc/nginx/conf.d/default.conf - -# Set proper ownership for web files -RUN chown -R nginx:nginx /usr/share/nginx/html - EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"] diff --git a/frontend/trivy-report.txt b/frontend/trivy-report.txt new file mode 100644 index 00000000..4099dbc0 --- /dev/null +++ b/frontend/trivy-report.txt @@ -0,0 +1,12 @@ + +Report Summary + +┌─────────────────────────────────────────────┬────────┬─────────────────┬─────────┐ +│ Target │ Type │ Vulnerabilities │ Secrets │ +├─────────────────────────────────────────────┼────────┼─────────────────┼─────────┤ +│ full-stack_chatapp-frontend (alpine 3.21.4) │ alpine │ 0 │ - │ +└─────────────────────────────────────────────┴────────┴─────────────────┴─────────┘ +Legend: +- '-': Not scanned +- '0': Clean (no security findings detected) +