
# The security checks that run on every version

Automated analyses protect the code and the image you deploy, on every push.

## Automated analyses

What a tool finds by itself is checked at every push, not discovered by an audit. Each analysis **fails in the log** of the PR; those that can produce a SARIF also publish it in the repository's *Security* tab, where an alert is triaged (fixed, false positive, accepted risk) with its reason.

| Analysis | Where | What it sees | Its exceptions |
| --- | --- | --- | --- |
| Trivy, dependencies | `securite.yml`, job `dependances` | Fixable HIGH/CRITICAL CVEs of `pom.xml` and `package-lock.json` | `.trivyignore` |
| Dependency review | `securite.yml`, job `revue-dependances` (PRs only) | What a PR **adds**: vulnerable dependency (HIGH and above, development included), non-free licence | in the job |
| Semgrep OSS | `securite.yml`, job `code` | Java, TypeScript, OWASP, Dockerfile, workflow and agent-configuration patterns | `nosemgrep` site by site, see below |
| actionlint, zizmor | `securite.yml`, job `workflows` | Workflow validity; their security: template injection, credentials left by checkout, a cache that can be poisoned, permissions | `.github/zizmor.yml`, each rule with its reason |
| hadolint | `securite.yml`, job `workflows` | The `Dockerfile` and the shell of its `RUN`s | `# hadolint ignore=…` on the line, reason above |
| Trivy, image | `docker-ghcr.yml` before signing; `securite.yml`, job `image`, weekly | System packages of the image: Ubuntu layer, JRE, `postgresql-client` | `.trivyignore` |
| CodeQL | the repository settings' "default" configuration | Data flows from one class to another (Java, TypeScript, Python, workflows) | in the *Security* tab |
| OpenSSF Scorecard | `scorecard.yml` | The repository's supply-chain practices, public score (README badge) | in the *Security* tab |
| OWASP ZAP *baseline* | `analyse-dynamique.yml`, nightly on `main` | The running application seen without an account: headers, cookies, errors | `.github/zap-baseline.tsv` |
| GitGuardian | GitHub application | Pushed secrets | `.gitguardian.yaml` |

The image scan in `docker-ghcr.yml` **blocks publication**: an image carrying a fixable HIGH or CRITICAL CVE gets neither signature, nor `:main`, nor version number, and stays under its `sha-…` alone for diagnosis. The ordinary case is fixed by rebuilding: the `Dockerfile` applies the day's Ubuntu fixes (`apt-get upgrade`), but that layer stays cached as long as the `eclipse-temurin` base image does not change, so `docker-ghcr.yml` rebuilds `:main` **without cache every Sunday** (3:00 UTC, the day before the weekly scan), as on a manual run. `:latest` and the versions do not benefit (a release tag is never rebuilt): a CVE fixed after a version is fixed by a patch version. What comes from no package (`pebble`, a Go binary the base image installs next to `apt` and the application never runs) is removed by the `Dockerfile`. A release version is built **with no cache at all** (layers and `.m2`): a GitHub cache can be written from other jobs of the repository, and a signed version must inherit nothing from it.

**Adding an entry to `.trivyignore`** (the file does not exist until one is needed): the CVE id and, above it as a comment, the date, the reason (code path not reached, no fix published for the image package) and the condition that will allow removing it. An entry with no date is never reread.

Two protections are **repository settings**, not files, to check in *Settings → Advanced Security*: *secret scanning* with *push protection* (which refuses a `git push` carrying a secret, where GitGuardian sees it only once pushed) and the dependency graph, which the dependency review reads. CodeQL lives there too, in "default" configuration: GitHub picks the languages and runs the analysis on every PR with no workflow in the repository, and an "advanced" CodeQL workflow cannot coexist with it (GitHub refuses its results).

## Static analysis: suppressions and their justification

The `code` job (Semgrep OSS) fails CI on any rule that finds something, whatever its severity. One rule reaches nine places in the code, all for the same reason and all annotated `nosemgrep` **site by site** rather than disabled wholesale: a new, unannotated SQL concatenation therefore still turns CI red.

`java.lang.security.audit.formatted-sql-string` flags any query built by concatenation. Here what is concatenated is **always an identifier** (table or column name), which SQL does not let you bind as a parameter (`SELECT * FROM ?` does not exist). These identifiers come without exception from literals of the calling code or constant lists (`DatabaseDumpService.TABLES`), never from user input (the dump import checks its own against `ALLOWED_TABLES`). The **values** all travel as bound parameters.

**Before adding a `nosemgrep`**, check the callers: if an identifier can come from an HTTP request, it is a SQL injection and not a false positive.
