← back to writing
// securityNov 16, 20266 min read

Logging in is the easy part

Most Jenkins security plugins stop at the login page, but signing in was never the hard part. Who can do what, for how long, who approved it, and how you get back in when it breaks: that is the half I had to build.

jenkinssecurityiamaccesssso

Every Jenkins I have ever inherited has the same ghost in it. A permission matrix the size of a bedsheet, every box checked, and a quiet shared agreement that nobody is allowed to touch it. Because the last person who did locked themselves out, and getting back in took an afternoon and a very awkward message to whoever still had SSH to the box.

Jenkins is where your pipelines live, which means it is where access to everything else quietly collects. Deploy keys, cloud credentials, the button that ships to production. And the way most teams secure it is to put a good login page in front of it. SSO, maybe MFA, a tidy OAuth plugin. Then they stop.

That is the thing I kept running into. Signing in is the easy part. It is solved. There are a dozen plugins that will connect Jenkins to your identity provider and log a user in cleanly. The hard part is everything after the login page, and almost nothing covers it.

The part after the login page

Here is what nobody sells you a plugin for. Someone logs in. Now what?

In most Jenkins setups the answer is: they are whatever they were last time, forever. You made someone an admin for a migration eighteen months ago and they are still an admin, because revoking it means finding the right checkbox in the bedsheet and being sure it will not break their actual job. Standing privilege is the default, and it only ever grows.

Then your security review comes around, or an auditor, or just your own conscience, and asks the questions that actually matter. Who could deploy to production in March? Who approved that access? When does it expire? Who looked at this list last and said it was still correct?

For a plain Jenkins the honest answers are: everyone, nobody, never, and never. That is not a gap you patch with a nicer login page. It is the entire second half of access control, and it was missing.

I run Jenkins for a multi-tenant platform, and I am also the person who has to answer those audit questions. So “everyone, nobody, never, never” was never going to hold. I needed least privilege that was genuinely the default, access that expired on its own, and a log I could hand to someone without flinching. The plugins stopped at the door. So I wrote the thing that handles the room.

That is OmniAuth.

Right-sized access, not no access

The foundation here is not exotic. It is a permission matrix, the same model Jenkins already uses, just grouped, labeled, and far easier to live in than the raw checkbox wall. Roles that should be standing stay standing. The team that runs Jenkins keeps its admin, because that is the job, and pretending otherwise would be theater. The goal was never to make everyone beg for access each morning. It was to make access fit: the people who run the platform hold what they need for as long as they run it, and everyone else holds exactly what their work touches, scoped to the jobs and folders they actually use, and nothing past that.

What keeps that from decaying back into a bedsheet is the layer on top. A grant can carry an expiry, so the access you hand out for a migration takes itself away when the migration is done, instead of becoming one more box nobody remembers checking. When someone genuinely needs more for a while, there is just-in-time elevation: they request it, an approver signs off, it expires on its own, no standing admin handed out “just in case.” And on a schedule, access reviews drop the whole list in front of you as a plain keep-or-revoke queue, with a weekly digest, so drift gets caught on a Tuesday instead of during an audit.

Over all of it sits the audit log: every state-changing, security-relevant action, recorded and kept as long as you configure. The “who approved what in March” question finally has a boring, filterable answer, and for a compliance conversation, boring is the whole point.

It is configuration as code, too, because a governance layer that only lives in a UI is one that quietly drifts. The descriptors expose JCasC symbols, so the posture is a file in a repo:

jenkins:
  securityRealm:
    omniAuth: { }              # native accounts, SSO optional on top
  authorizationStrategy:
    omniAuthAuthorization: { } # the matrix, grants and JIT, as code

Your access model becomes reviewable in a pull request like everything else, instead of something one person clicked once that nobody can reconstruct.

And here is what makes it a governance layer rather than just another login plugin: native Jenkins logins keep working. Username and password, API tokens, the CLI, all of it, inherited straight from Jenkins core. The plugin is native-first, so the whole governance layer runs on those native accounts alone, with no identity provider required. SSO, Microsoft Entra today, hardened with PKCE and nonce validation, is a toggle you add on top when you want it, not a wall you climb before anything works.

The part everyone is quietly afraid of

Here is the real reason people leave that permission matrix alone: lockout. Every Jenkins admin carries the same low-grade fear. One wrong save, or your SSO provider has a bad morning, and suddenly nobody is an admin and the system that deploys your company is a login page you cannot get past.

Anyone who has run a shared Jenkins long enough has been close to this, and some of us have been all the way in. So the recovery path got as much care as everything else, probably more.

There are two ways back in, for two different disasters. Break Glass is for when you are already signed in and about to do something sensitive: a TOTP step-up that opens a short fifteen-minute window, enrolled on up to three devices so you are never trusting a single phone. SOS Mode is for the real nightmare, when no admin can sign in at all because SSO is down or the authorization strategy itself broke. It is deliberately awkward to reach. Someone with host access drops a trigger file, which arms a thirty-minute recovery window, and a single-use recovery code (stored only as a salted hash, never in the clear) signs you back in and restores admin.

The awkwardness is the security. If lockout recovery were easy to reach, it would just be a backdoor with extra steps. Requiring host access to arm it means the way back in is only open to someone who already holds the keys to the building, so an idle install cannot be levered open from its own login page.

It is not all locks and ledgers, either: the sign-in page is yours to brand, down to a pick of Jenkins butler mascots, because a security console people enjoy opening is one they actually keep an eye on.

Not one checkbox more

The rule underneath is simple, and it is the one I bring to access anywhere: the right people hold the right access, for only as long as they actually need it, and not one checkbox more. Standing where standing is earned, scoped and time-boxed everywhere else, and a record of who decided what.

The login page was never the hard part. It is the visible part, the part you can demo, which is why most of the effort goes there. The hard part is quiet: access that fits, access that expires when it should, a review loop that catches drift, a log that answers the awkward questions, and a way back in that is not a backdoor.

That quiet second half is the entire reason OmniAuth exists.

MP
Mayank Purohit
DevOps Lead & Data Security Officer