Last updated: 2026-06-16 Service: Spring Boot 3.4.2 microservice — master data management (Competencies, Roles, Activities) Stack: Java 21 · PostgreSQL · OpenSearch · Maven
- All REST API endpoints exposed by this service (
/v1/entity/**,/v1/entity-mapping/**) - File upload processing (CSV / XLSX sheet parsing)
- PostgreSQL data access layer (JPA models, repositories, schema changes)
- OpenSearch indexing and search operations
- All runtime dependencies declared in
pom.xml - Application configuration and secrets handling (
application.properties, env vars) - Logging output — what is logged and at what level
- OpenSearch cluster infrastructure (managed separately by infra team)
- PostgreSQL server configuration and OS-level hardening
- Network perimeter, load balancers, API gateway — not owned by this service
- Authentication and authorisation — not implemented in this service; assumed to be handled upstream by a gateway or auth service
- Other microservices consuming or producing data alongside this service
| Environment | Notes |
|---|---|
| Production | Primary target — all rules in this document apply strictly |
| Staging | Apply same rules as production |
| Development / Local | Relaxed — ddl-auto=update and debug logging acceptable locally only |
- Tool: OWASP Dependency-Check Maven plugin — must be added to
pom.xml(see Pending Work inCLAUDE.md) - Policy: Build must fail on any dependency with CVSS score ≥ 7.0 (High or Critical)
- Cadence: Run on every PR that touches
pom.xml; run weekly onmainregardless - Suppressions: False positives must be documented in
owasp-suppressions.xmlwith a justification comment — no silent suppression - Tomcat: CVE override
<tomcat.version>10.1.36</tomcat.version>is active inpom.xml— do not remove or downgrade without checkingtomcat.apache.org/security-10.htmlfor the patched version
- No credentials, API keys, or connection strings in source code or
application.propertiesdefaults - All sensitive values must be injected via environment variables:
DATABASE_URL,DATABASE_USERNAME,DATABASE_PASSWORD,OPENSEARCH_USERNAME,OPENSEARCH_PASSWORD - Default values in
application.properties(e.g.postgres:postgres) are for local development only — production deployments must override all of them - Never commit
.envfiles or files containing real credentials
- All request body fields validated with
jakarta.validationannotations (@NotBlank,@NotNull, etc.) on DTO classes @Validon every@RequestBodyparameter in controllers — violations caught byMethodArgumentNotValidExceptionhandler@Validatedat service level for@RequestParamvalidation — violations caught byHandlerMethodValidationExceptionhandler- File uploads: validate content type and sheet headers before processing; reject files that fail header validation via
HeaderMissingException - Do not trust sheet cell values — always parse defensively; missing or malformed cells must produce a
SheetDataMissingException, not a NullPointerException
spring.jpa.hibernate.ddl-autodefaults toupdatewhenJPA_DDL_AUTOis not set — this must be overridden tovalidateornonein all non-local environments- Schema changes must go through explicit SQL migration scripts — never rely on Hibernate auto-DDL to alter production schema
- Do not use
AttributeConverter<Map, String>for PostgreSQLjsoncolumns — causes silent type mismatch (character varyingvsjson); use@JdbcTypeCode(SqlTypes.JSON)instead - Unique constraint
(code, language_code)is enforced at DB level via@UniqueConstraint— do not remove this constraint - Raw SQL queries (native queries in repositories) must use parameterised binding — no string concatenation into query strings
- Never log PII (personally identifiable information) — user names, email addresses, IDs that map to individuals
- Never log credentials, tokens, or connection strings at any level
- OpenSearch log level defaults to
WARNin production via${OPENSEARCH_LOG_LEVEL:WARN}— do not hardcodeDEBUGinapplication.properties EntityMappingServiceImplhasDEBUGlogging enabled permanently (logging.level.com.aastrika.entity.service.impl.EntityMappingServiceImpl=DEBUG) — review before production deployment; consider guarding behind an env var- SQL logging (
spring.jpa.show-sql) defaults tofalse— must remainfalsein production
- All exceptions must be caught by
ApplicationExceptionHandler— never let raw stack traces reach the API response - Error responses use
AppResponse.error(apiId, message, httpStatus)— message must not include internal file paths, SQL, or stack traces DataIntegrityViolationExceptionis caught and returns a sanitised conflict message — the root cause message from PostgreSQL may leak internal column names; review before exposing
- OpenSearch credentials (
OPENSEARCH_USERNAME,OPENSEARCH_PASSWORD) must be set in production even if the cluster allows unauthenticated access today — treat unauthenticated access as a misconfiguration to fix - Do not log OpenSearch queries at
DEBUGlevel in production — queries may contain user-supplied search terms
All issues — security and non-security — are tracked in docs/TRIAGE.md as the single source of truth.
Security-relevant items are tagged [security] there. Status, fixes, and completion are updated in docs/TRIAGE.md only.
Current security items in TRIAGE.md:
| TRIAGE ID | Severity | Summary |
|---|---|---|
| T-003 | High | ddl-auto defaults to update — auto-alters schema on startup |
| T-005 | High | additional_properties DB column not dropped — dead data in master_entities |
| T-008 | Medium | ES debug logging — now guarded, completed 2026-06-16 |
| T-013 | Low | OpenSearch allows empty credentials — silent unauthenticated access |
| T-014 | Low | DataIntegrityViolationException exposes raw PostgreSQL error message in API response |
Append a new entry here each time a security item is resolved or introduced.
- Fixed: Tomcat CVEs patched —
<tomcat.version>10.1.36</tomcat.version>active inpom.xml(CVE-2025-24813, CVE-2025-31651, CVE-2025-55754) - Fixed: OpenSearch migration completed — replaced Elasticsearch 7.x client (which had known ES 8.x incompatibility risk) with
spring-data-opensearch-starter 1.6.0 - Fixed: Spring Boot restored to 3.4.2 — recovers Tomcat 10.x security baseline and all Spring Security 6.x patches
- Identified: S-001 through S-005 documented above — none are newly introduced; all pre-existed
- Added: This
SECURITY.mdas the authoritative security policy document for this service