Skip to content

Security: tighten Docker build contexts and .dockerignore rules#280

Merged
NickLetts2 merged 2 commits into
mainfrom
copilot/tighten-docker-build-contexts
May 15, 2026
Merged

Security: tighten Docker build contexts and .dockerignore rules#280
NickLetts2 merged 2 commits into
mainfrom
copilot/tighten-docker-build-contexts

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

SonarCloud flagged docker:S6470 hotspots in the marketing-site and core-api Dockerfiles where glob patterns and broad COPY . . instructions could pull secrets, keys, test artefacts, or .git metadata into intermediate build layers.

Changes

apps/marketing-site/Dockerfile

  • Replace COPY package.json package-lock.json* ./COPY package.json package-lock.json ./ (explicit, no glob; npm ci requires the lockfile anyway)

apps/marketing-site/.dockerignore

Reorganised with section comments; added missing exclusions:

  • Secrets/keys: .env, .env.*, *.pem, *.key, *.p12, *.pfx, *.crt, *.csr, *.agekey, secrets/, .sops.yaml
  • VCS: .git/, .gitignore
  • Test tooling: tests/, playwright.config.ts, vitest.config.ts, eslint.config.js, .prettierrc, .trivyignore, nginx.conf
  • Build outputs: build/, coverage/
  • OS artefacts: .DS_Store, *.suo, *.user, Thumbs.db

services/core-api/.dockerignore

Expanded from 2 entries (**/bin/, **/obj/) to full coverage:

  • Secrets/keys: same set as above
  • VCS: .git/, .gitignore
  • Test projects and results: tests/, **/TestResults/, **/coverage/
  • Metadata: *.md, *.slnx
  • OS/editor artefacts: .DS_Store, *.suo, *.user, *.DotSettings.user, Thumbs.db

Both .dockerignore files are at their effective build context roots (./apps/marketing-site and ./services/core-api respectively, as defined in docker-compose.yml).

- Fix apps/marketing-site/Dockerfile line 6: replace glob
  `COPY package.json package-lock.json* ./` with explicit
  `COPY package.json package-lock.json ./` (resolves docker:S6470)

- Expand apps/marketing-site/.dockerignore to exclude secrets,
  private keys, .sops.yaml, .git, test tooling, dev config files,
  and OS artefacts. Existing entries reorganised with comments.

- Expand services/core-api/.dockerignore to exclude secrets,
  private keys, .sops.yaml, .git, test projects, test results,
  coverage outputs, solution metadata, and OS artefacts.

Build contexts confirmed from docker-compose.yml:
  marketing-site → ./apps/marketing-site
  core-api       → ./services/core-api

Both .dockerignore files sit at their effective build context roots.

Agent-Logs-Url: https://github.com/NickLetts2/Curvit/sessions/b1673847-1861-4418-8ff7-da30504ff961

Co-authored-by: NickLetts2 <90337962+NickLetts2@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix security hotspots in Docker build contexts and .dockerignore rules Security: tighten Docker build contexts and .dockerignore rules May 15, 2026
Copilot AI requested a review from NickLetts2 May 15, 2026 20:09
@NickLetts2 NickLetts2 marked this pull request as ready for review May 15, 2026 20:38
Copilot AI review requested due to automatic review settings May 15, 2026 20:38
@NickLetts2 NickLetts2 merged commit aa5b6e3 into main May 15, 2026
6 of 7 checks passed
Copilot AI review requested due to automatic review settings May 15, 2026 21:02
NickLetts2 added a commit that referenced this pull request Jun 1, 2026
…contexts

Security: tighten Docker build contexts and .dockerignore rules
@NickLetts2 NickLetts2 deleted the copilot/tighten-docker-build-contexts branch June 2, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security Hotspots: Tighten Docker build contexts and .dockerignore rules

2 participants