Skip to content

Java 17#2637

Merged
simonredfern merged 6 commits intoOpenBankProject:developfrom
constantine2nd:develop
Nov 28, 2025
Merged

Java 17#2637
simonredfern merged 6 commits intoOpenBankProject:developfrom
constantine2nd:develop

Conversation

@constantine2nd
Copy link
Copy Markdown
Contributor

No description provided.

… the container.

SonarQube security warning by:

## Summary of Changes

### 1. **Selective File Copying in Dockerfile**
Instead of using `COPY . .` which copies everything recursively, I've updated the Dockerfile to explicitly copy only the necessary files and directories:

- **Maven configuration**: `pom.xml`, `build.sbt`
- **Source code directories**: `obp-api/`, `obp-commons/`, `project/`
- **Required build files**: `jitpack.yml`, `web-app_2_3.dtd`

### 2. **Enhanced .dockerignore**
I've significantly expanded the `.dockerignore` file to exclude:

- **IDE files**: `.idea/`, `.vscode/`, `.metals/`, etc.
- **Build artifacts**: `target/`, `cache/`, Maven local repository
- **Sensitive files**: Environment files, keys, certificates, passwords
- **OS files**: `.DS_Store`, thumbnails, etc.
- **Documentation**: Most markdown files (keeping license files)
- **Development files**: `ideas/`, `resourcedoc/`

## Security Benefits

1. **Reduced attack surface**: Only necessary files are included in the Docker image
2. **No accidental secrets**: Explicit exclusion of common sensitive file patterns
3. **Smaller image size**: Excluding unnecessary files reduces image size
4. **Better maintainability**: Clear understanding of what goes into the container

## Build Compatibility

The changes maintain full Maven build compatibility by ensuring all necessary files for the build process are still copied:
- Maven POM files for dependency management
- Source code directories
- Build configuration files
- The entrypoint script (specifically allowed in .dockerignore)

This approach follows Docker security best practices and addresses the SonarQube warning while maintaining the functionality of your build process.
openjdk version "17.0.11" 2024-04-16
OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9)
OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode, sharing)
openjdk version "17.0.11" 2024-04-16
OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9)
OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode, sharing)
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarQube Cloud

@simonredfern simonredfern merged commit 73396e4 into OpenBankProject:develop Nov 28, 2025
0 of 2 checks passed
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.

2 participants