Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

After a breach traced to an unprotected JAX-RS admin endpoint that was added without the security filter, the board asks how you will prevent this class of failure. What do you change at company level?

I would change the platform so that this class of failure cannot pass silently: deny by default, so an endpoint without an explicit access rule fails at startup or in CI; an automated inventory of every exposed endpoint compared against gateway and auth rules; pipeline security tests that call every endpoint without credentials and expect 401 or 403; and admin interfaces moved to internal networks or ports with stronger authentication. Leadership gets regular metrics, exceptions have owners and expiry dates, and a blameless review explains how the gap passed review.

Why this question is asked

A board asking how we will prevent a class of failure is asking a different question from how we fix one endpoint. Fixing the endpoint took an afternoon; the breach happened because the system allowed a developer to add an endpoint that nobody protected and nobody noticed. Interviewers ask this leadership question to see whether we move from blame to mechanisms. In this answer, we will understand why the failure happened, then go through the changes: deny by default, an endpoint inventory, security tests in the pipeline, separating admin interfaces, and how we report and learn at company level.

1Why the Failure Happened

In this incident, the security filter was opt-in. The service used a name-bound authentication filter, and the new admin endpoint, added in a hurry for an operations task, did not carry the annotation. Nothing failed: the build passed, the tests for the endpoint's logic passed, and code review focused on the logic. The endpoint was reachable from the internet because the gateway forwarded the whole /api prefix.

The lesson is that four independent safeguards could each have caught it, and none of them existed as a mechanism: the framework allowed unprotected endpoints, nothing listed what was exposed, no test called endpoints without credentials, and admin functions shared the public network path. Telling engineers to be more careful does not fix any of those. The board needs to hear what will be different in the system.

2Deny by Default

The most effective change is to invert the default. Instead of endpoints being open unless protected, they are closed unless an explicit access rule exists. In JAX-RS, that means a global authentication filter rather than a name-bound one, plus a check that every resource method has an access annotation. The check can run at startup, where a DynamicFeature sees every resource method, or in CI with an ArchUnit test.

Java
@Provider
public class RequireAccessRule implements DynamicFeature {
@Override
public void configure(ResourceInfo info, FeatureContext ctx) {
Method m = info.getResourceMethod();
Class<?> c = info.getResourceClass();
boolean declared = hasAny(m) || hasAny(c); // @RolesAllowed, @PermitAll or @DenyAll
if (!declared) {
throw new IllegalStateException("No access rule on " + c.getSimpleName() + "." + m.getName());
}
}
private static boolean hasAny(AnnotatedElement e) {
return e.isAnnotationPresent(RolesAllowed.class) || e.isAnnotationPresent(PermitAll.class)
|| e.isAnnotationPresent(DenyAll.class);
}
}
// Deploy with an unannotated admin method:
// IllegalStateException: No access rule on AdminResource.resetPasswords -> the service does not start

Notice that @PermitAll is allowed; public endpoints exist. The point is that being public becomes a visible decision in code review rather than an accident. The platform team ships this as part of the paved-road template, so new services get it without asking.

3An Inventory of Every Exposed Endpoint

We cannot protect what we do not know about. Each service publishes its endpoints, from its OpenAPI document or from runtime registration, and a central job collects them into an inventory: service, method, path, declared access rule, and whether the gateway exposes it to the internet. The job compares that inventory with the gateway routes and the authentication rules and flags mismatches, such as an internet-exposed path with @PermitAll that is not on the approved public list, or a route on the gateway that no service declares.

This also catches endpoints that no annotation check would see, for example a servlet or an actuator-style management endpoint registered outside JAX-RS.

4Security Tests in the Pipeline

The third layer tests behaviour instead of declarations. In every pipeline, after deployment to a test environment, an automated job reads the service's OpenAPI document and calls every operation without credentials, then with a token that has no roles. Anything that returns 2xx for an operation not on the approved public list fails the deployment. It is a cheap test, a few seconds per service, and it would have caught the admin endpoint on the day it was added.

Step throughWhat a new endpoint must pass
  1. Access annotation present?checked at startup and in CI
    YesContinueNoBuild fails
  2. Unauthenticated call returns 401 or 403?pipeline test from OpenAPI
    YesContinueNoDeployment fails
  3. Exposure matches the inventory and gateway?nightly comparison
    YesEndpoint is liveNoAlert to owning team
  4. Admin path?
    YesInternal network only, stronger authNoNormal public rules

4 steps in order. Play them, or step through them one at a time.

5Separating Admin Interfaces

Admin and operational functions should not share the public path at all. We move them to a separate port or a separate application that the public load balancer does not route to, reachable only from the internal network or a VPN, and require stronger authentication there, such as SSO with multi-factor authentication and a narrow admin role. In JAX-RS this can be a second Application with its own @ApplicationPath, bound to a management port by the container. Defence in depth means that even if an admin endpoint lost its annotation, it would not be reachable from the internet.

6Reporting to Leadership and Learning From It

The board should see a small, honest set of metrics every quarter: the percentage of services on the deny-by-default template, the number of internet-exposed endpoints and how many are approved public ones, pipeline security test coverage, and open exceptions. Exceptions will exist, for example a legacy service that cannot adopt the template before its rewrite, and each one has an owner, a compensating control, and an expiry date reviewed by the security lead.

Finally, the incident review is blameless: its goal is to understand why the system allowed the gap, why review did not catch it, why the change was rushed, and what signals were missing, rather than to find someone to punish. People share what really happened only when they are not afraid, and the mechanisms above came from that understanding. Punishing the developer would have taught everyone to hide mistakes.

7Follow-up questions

Will deny by default slow teams down?

A little at first, because every endpoint needs an explicit rule. In practice it is one annotation, and the template makes the common case easy. The cost is far smaller than one breach, and the failure is loud and immediate, which is the cheapest time to fix it.

How do you handle legacy services that cannot change quickly?

We put compensating controls in front of them: gateway rules that only expose a reviewed list of paths, and the external unauthenticated scan against their public surface. They get an exception with an owner and a date, and they move up the migration list.

What would you tell the board in one sentence?

That we are changing the platform so that an unprotected endpoint cannot be deployed or exposed without an explicit, reviewed decision, and that we will report the coverage of those controls every quarter.

8Conclusion

In this answer, we moved from the single unprotected endpoint to the mechanisms that let it through. We made deny by default the platform behaviour, so endpoints without an access rule fail at startup or in CI; built an inventory of exposed endpoints from OpenAPI and runtime registration and compared it with gateway and auth rules; added pipeline tests that call every endpoint without credentials and expect 401 or 403; moved admin interfaces to internal networks with stronger authentication; and reported coverage metrics to leadership, with owned, expiring exceptions and a blameless review of how the gap passed review.

What to say in the interviewAbout 80 seconds aloud

Open with

I would tell the board that the root cause was not one developer's mistake but a platform that allowed an endpoint to be unprotected by default, and that we are changing that.

Then, if they want more

First, deny by default: a global authentication filter instead of an opt-in one, and a startup or CI check that fails if any resource method has no explicit access rule like RolesAllowed or PermitAll, so being public is a visible decision.

Second, an automated inventory of every exposed endpoint, built from each service's OpenAPI or runtime registration and compared nightly with the gateway routes and auth rules, so we know our real attack surface.

Third, security tests in every pipeline that call every operation without credentials and with a role-less token and fail the deployment if anything not on the approved public list returns success. Fourth, admin interfaces move off the public path, onto internal networks or a management port, with SSO and MFA.

Then I would report coverage quarterly: share of services on the template, exposed endpoints, test coverage, and exceptions, each with an owner and an expiry date. And I would run a blameless review to understand how the gap passed review, because people only tell us what really happened when they are not afraid.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Jakarta EE specifications
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "After a breach traced to an unprotected JAX-RS admin endpoint that was added without the...": https://scrivio-interview-library.netlify.app/java/jax-rs/e9ac3f1bed/