SKY-DEP001 · Deployment and infrastructure
Internet-facing route is missing the auth guard your deployment requires
Your Kubernetes manifest can declare which guard functions must protect a service's sensitive routes, with the annotation skylos.dev/required-guards. SKY-DEP001 follows the internet-facing Ingress to the Python app it serves and reports an admin, internal, debug or metrics route that lacks one of those guards.
- Languages
- Python (FastAPI, Flask), Kubernetes YAML
- Quality gate
- counted toward the gate limits (full and diff scans). Reported under security (
danger). It counts towardmax_highandmax_security. - Finding type
- review
- Catalog name
- Externally deployed route is missing a required auth guard
Why it matters
An admin endpoint without its auth check is open to anyone who finds the URL, and /admin paths are the first thing scanners try. Linters cannot see this, because whether a route is reachable from the internet is decided in the deployment files, not in the code.
What Skylos flags
from fastapi import Depends, FastAPI from app.auth import require_admin app = FastAPI() @app.get("/health")def health(): return {"ok": True} @app.get("/admin/users")def list_admin_users(): return {"users": []}from fastapi import Header, HTTPException def require_admin(x_role: str = Header(default="")): if x_role != "admin": raise HTTPException(status_code=403) return x_roleapiVersion: apps/v1kind: Deploymentmetadata: name: api namespace: prodspec: selector: matchLabels: app: api template: metadata: labels: app: api annotations: skylos.dev/source-file: app/main.py skylos.dev/required-guards: require_admin spec: containers: - name: api image: ghcr.io/acme/api:1.4.0 command: ["uvicorn"] args: ["app.main:app", "--host", "0.0.0.0", "--port", "8000"] ports: - name: http containerPort: 8000---apiVersion: v1kind: Servicemetadata: name: api namespace: prodspec: selector: app: api ports: - name: http port: 80 targetPort: http---apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: api namespace: prod annotations: skylos.dev/network-scope: external skylos.dev/backend-protocol: httpspec: rules: - host: api.example.com http: paths: - path: / pathType: Prefix backend: service: name: api port: name: httpWhat Skylos leaves alone
from fastapi import Depends, FastAPI from app.auth import require_admin app = FastAPI() @app.get("/health")def health(): return {"ok": True} @app.get("/admin/users")def list_admin_users(user=Depends(require_admin)): return {"users": []}Why Skylos leaves it alone
The same deployment and the same route, now with Depends(require_admin), the guard the manifest requires. /health has no guard either, but it is not a sensitive path.
How Skylos decides
- Runs with
--danger(or-a). Reads Kubernetes YAML in the repository and only works when anIngressopts in with the annotationsskylos.dev/network-scope: external(orinternet,public) andskylos.dev/backend-protocol: http. - Follows one chain inside one YAML file: Ingress path, to the
Serviceand port it names, to the one workload the Service selects, to the one container whose port the Service targets. The server must be started with a literalcommandandargs(uvicorn,gunicorn,flask run, orpython -mone of them) bound to0.0.0.0or::on that port. - Any missing, dynamic or ambiguous link (two matching workloads, a Helm template value, HTTPS or gRPC backends, rewrite or snippet annotations) makes it report nothing rather than guess.
- The workload's pod template must also carry
skylos.dev/source-file(the Python file the server'smodule:apptarget names) andskylos.dev/required-guards(a comma-separated list of guard names). - In that file it reads the top-level FastAPI or Flask routes of the app object. A route counts as sensitive when its path, as reached through the Ingress, has a segment such as
admin,internal,debug,manage,metricsorpprof. - A guard counts only under its exact name: in the app's or the route's
dependencies, as aDepends(...)parameter, or as a decorator on the handler. A check inside the function body does not count. - Reports HIGH on the route's decorator line, naming the missing guards.
How to fix it
Add the required guard to the route, as a dependency or a decorator, so the contract in the manifest holds.
from fastapi import Depends, FastAPI from app.auth import require_admin app = FastAPI() @app.get("/health")def health(): return {"ok": True} @app.get("/admin/users")Removed: def list_admin_users():Added: def list_admin_users(user=Depends(require_admin)): return {"users": []}When it can be wrong
- Routes added through nested routers (
include_router, blueprints) or factory functions are not checked. - It checks that the guard is wired in, not what the guard does.
- Without the two Ingress annotations the rule never runs. Keep them in a protected place: removing them silences the rule.
- Resources split across several YAML files, Helm charts and Kustomize overlays are not joined or rendered. Scan rendered manifests.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Put the marker on the reported decorator line.
Python @app.get("/admin/users") # skylos: ignore[SKY-DEP001] VPN only[tool.skylos] ignore = ["SKY-DEP001"]turns the rule off for the project.A baseline (
skylos baseline ., then--baseline) accepts the findings that exist today and reports new ones.