From ae2cb150556e1399f5e8264c9db65c405768d082 Mon Sep 17 00:00:00 2001 From: Vijay Date: Tue, 6 May 2025 22:44:51 +0530 Subject: [PATCH] fix: sonar security hotspot (permission issue - non-root user in Dockerfile) (#5411) Co-authored-by: Matthias Nannt --- apps/web/Dockerfile | 4 +++- .../environments/[environmentId]/actions/loading.tsx | 2 +- .../[environmentId]/components/MainNavigation.tsx | 2 +- .../settings/(organization)/enterprise/page.tsx | 2 +- .../responses/components/ResponseTableCell.tsx | 2 +- .../(analysis)/summary/components/ConsentSummary.tsx | 2 +- .../summary/components/FileUploadSummary.tsx | 2 +- .../summary/components/MatrixQuestionSummary.tsx | 4 ++-- .../summary/components/MultipleChoiceSummary.tsx | 2 +- .../(analysis)/summary/components/NPSSummary.tsx | 6 +++--- .../summary/components/PictureChoiceSummary.tsx | 2 +- .../(analysis)/summary/components/RatingSummary.tsx | 2 +- .../[surveyId]/components/QuestionFilterComboBox.tsx | 4 ++-- .../[surveyId]/components/QuestionsComboBox.tsx | 2 +- .../ee/contacts/segments/components/segment-filter.tsx | 6 +++--- .../components/team-settings/team-settings-modal.tsx | 2 +- .../modules/organization/settings/api-keys/loading.tsx | 2 +- .../modules/survey/components/template-list/index.tsx | 2 +- .../survey/editor/components/animated-survey-bg.tsx | 2 +- .../survey/editor/components/edit-welcome-card.tsx | 2 +- .../editor/components/file-upload-question-form.tsx | 4 ++-- .../survey/editor/components/hidden-fields-card.tsx | 4 ++-- .../survey/editor/components/how-to-send-card.tsx | 2 +- .../modules/survey/editor/components/question-card.tsx | 2 +- .../editor/components/recontact-options-card.tsx | 4 ++-- .../survey/editor/components/response-options-card.tsx | 10 +++++----- .../survey/editor/components/saved-actions-tab.tsx | 2 +- .../survey/editor/components/survey-menu-bar.tsx | 2 +- .../survey/editor/components/survey-placement-card.tsx | 2 +- .../survey/editor/components/survey-variables-card.tsx | 4 ++-- .../survey/editor/components/targeting-locked-card.tsx | 2 +- .../survey/editor/components/unsplash-images.tsx | 4 ++-- .../components/follow-up-action-multi-email-input.tsx | 2 +- .../survey/list/components/copy-survey-form.tsx | 8 ++++---- .../list/components/tests/copy-survey-form.test.tsx | 2 +- .../survey/templates/components/template-container.tsx | 2 +- apps/web/modules/ui/components/card/index.tsx | 2 +- apps/web/modules/ui/components/modal/index.tsx | 8 ++++---- .../web/modules/ui/components/preview-survey/index.tsx | 8 ++++---- apps/web/package.json | 1 + packages/database/package.json | 1 + 41 files changed, 67 insertions(+), 63 deletions(-) diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 410bdc2d5a..447f012845 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -20,6 +20,7 @@ FROM base AS installer # Enable corepack and prepare pnpm RUN npm install -g corepack@latest RUN corepack enable +RUN corepack prepare pnpm@9.15.0 --activate # Install necessary build tools and compilers RUN apk update && apk add --no-cache cmake g++ gcc jq make openssl-dev python3 @@ -77,6 +78,7 @@ FROM base AS runner RUN npm install -g corepack@latest RUN corepack enable +RUN corepack prepare pnpm@9.15.0 --activate RUN apk add --no-cache curl \ && apk add --no-cache supercronic \ @@ -146,7 +148,7 @@ RUN npm install -g tsx typescript prisma pino-pretty EXPOSE 3000 ENV HOSTNAME "0.0.0.0" ENV NODE_ENV="production" -# USER nextjs +USER nextjs # Prepare volume for uploads RUN mkdir -p /home/nextjs/apps/web/uploads/ diff --git a/apps/web/app/(app)/environments/[environmentId]/actions/loading.tsx b/apps/web/app/(app)/environments/[environmentId]/actions/loading.tsx index b3cc1c9e45..ead337d5e3 100644 --- a/apps/web/app/(app)/environments/[environmentId]/actions/loading.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/actions/loading.tsx @@ -33,7 +33,7 @@ const Loading = () => { -
+
diff --git a/apps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsx b/apps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsx index ba884367df..a1ae639a63 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsx @@ -264,7 +264,7 @@ export const MainNavigation = ({ size="icon" onClick={toggleSidebar} className={cn( - "rounded-xl bg-slate-50 p-1 text-slate-600 transition-all hover:bg-slate-100 focus:ring-0 focus:ring-transparent focus:outline-none" + "rounded-xl bg-slate-50 p-1 text-slate-600 transition-all hover:bg-slate-100 focus:outline-none focus:ring-0 focus:ring-transparent" )}> {isCollapsed ? ( diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.tsx index b9699d14b1..526bd7d96d 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.tsx @@ -118,7 +118,7 @@ const Page = async (props) => {
-
+
{summaryItems.map((summaryItem) => { return (