All articles

Nov 11, 2026 · 4 min read

Shifting Security Left: The Security and Quality Gates I Built Into Our GitLab Pipeline

Every push to our healthcare platform now runs through dependency scanning, static security analysis, code quality checks, automatic issue creation, a security gate and safe deploys. Here is what the pipeline does, and the three lessons I learned getting it to a point where people actually read the results.

Shaheer Tariq

Founder & CEO, Dotsnc Technologies

Last month was a flood of vulnerability advisories, version bumps and security patches. Keeping up by hand was not working, so this week I moved the checks into the place where they cannot be skipped: the pipeline.

I work on a healthcare platform. Here, a vulnerability is not just a bug. It is a risk to patient data. That changes the question from "should we scan?" to "how do we make sure findings are seen, owned and fixed before anything ships?"

This is the breakdown: what every push now goes through, how the pipeline is wired, and the three lessons that mattered most.

The pipeline at a glance

Every push now runs 14 jobs across six stages:

  • verify: architecture checks, Checkstyle, CPD, PMD, a query-count check and the test suite run in parallel.
  • build: the application JAR is built once.
  • smoke: the JAR is started and smoke tested before anything else trusts it.
  • security: Semgrep, SpotBugs and Trivy run in parallel.
  • gate: a single job decides whether the findings are serious enough to stop the release.
  • .post: a findings report collects everything and turns it into tracked issues.

The amber jobs in my pipeline view are not failures. They are quality checks running in report-only mode on purpose, which is lesson two below.

1. Dependency and secret scanning

Trivy scans dependencies for known CVEs and the repository for secrets committed by mistake. After a month like the last one, this is the job that pays for itself first: a vulnerable transitive dependency or a leaked token is caught before it ships, not after an advisory lands.

Why it matters: most of the risk in a modern Java service lives in code you did not write. You cannot patch what you do not know you are running.

2. Static security analysis

Semgrep and SpotBugs with the FindSecBugs plugin look at our own code. They flag injection, unsafe input handling and risky patterns at merge request time, while the author still has the context to fix them in minutes.

Why it matters: a finding raised on the MR is a conversation. The same finding raised after release is an incident.

3. Code quality checks

Checkstyle, PMD and CPD (copy-paste detection) make technical debt visible before it builds up. These are not security tools, but messy, duplicated code is where security bugs hide and where fixes get applied in one copy and missed in another.

4. Automatic issue creation

A report nobody opens does nothing. Every finding now becomes a GitLab issue, sorted by severity and never duplicated across runs. Each one gets an owner instead of sitting in a job artifact that expires.

Why it matters: de-duplication is the part that makes this usable. Without it, every pipeline run would open the same issues again and the tracker would turn into noise within a day.

5. A security gate

One job reads the results of all three security scanners. Critical and High findings can block the deploy. Everything below that is reported and tracked, but does not stop the release.

Why it matters: a single gate keeps the policy in one place. Changing what blocks a release is a one-line change, not an edit to every scanner job.

6. Safe deploys

The last line of defense is the deploy itself: health checks, smoke tests and automatic rollback. If a release fails, the live site stays on the previous version instead of going down.

Three lessons I learned

Noise is the enemy of security

The first run produced dozens of findings, many of them duplicates or style hints. When people see 50 warnings, they read none. After tuning the rules, Java bug findings dropped from 47 to 9, and I checked that none of the real Critical or High issues were hidden along the way.

Tuning is not about making the number look good. It is about making every remaining finding worth someone's time.

Start in report-only mode

A gate that blocks every build on day one gets switched off by day two. I started with the quality checks in report-only mode, measured the baseline, and only then decided what should actually enforce. That is why some jobs show as warnings today: they are visible, tracked and not yet blocking.

Verify, don't just apply

Even good advice, from a scanner, a blog post or an AI assistant, has to be checked against the actual code. Some suggested fixes needed adjusting once we looked at the real findings. A rule that is right in general can still be wrong for a specific call site.

What's next

The next step is turning this into shared, versioned pipeline templates for Java, Angular, Node.js and Flutter. Every team will get the same standard from a single include:, and updating the standard becomes a version bump instead of a copy-paste across repositories.

It is the same discipline as my post on dev tools as the attack surface: pin versions, verify what you run, and give every tool the least access it needs. A pipeline is just that discipline, automated.

The takeaway

Security should not be a phase at the end. It should be part of every push, quiet when things are fine and loud only when it matters.

What is the one check you would add to your pipeline first, and what is stopping you from turning it on today?

Tool names and versions change quickly. Check each tool's own documentation for current configuration before copying any setup.

#security#devsecops#ci-cd#gitlab#java