Local service security checklist · Updated 2026-07-05

Local Service Security Checklist: localhost Binding, Authentication, CORS, Origin Policy, WebSockets, Ports, Lifecycle, and Incident Logging

A practical security checklist for desktop apps, agent tools, self-hosted utilities, and container-backed local APIs that expose HTTP or WebSocket services on a developer machine.

Local services are often trusted too much because they run on a developer machine. That assumption is unsafe. A browser tab, malicious extension, compromised desktop renderer, another local process, container, LAN peer, or misconfigured port publication can reach a local HTTP or WebSocket endpoint depending on binding, authentication, browser policy, and network configuration.

This checklist connects RepoDaily coverage of Docker Desktop, Podman, Colima, Apple container, Tauri, Electron, and DeerFlow into one local-service threat model: bind narrowly, authenticate privileged operations, validate browser origins, protect WebSocket handshakes and messages, inventory published ports, separate discovery from authorization, limit container and host access, clean up service state, and retain enough incident evidence to reconstruct abuse.

RepoDaily verdict

Do not treat loopback as authentication and do not treat CORS as authorization. A production-quality local service should have an explicit bind policy, per-client or per-session authentication where privilege exists, strict origin validation for browser-facing flows, separate WebSocket controls, narrow APIs, bounded payloads and rate limits, deterministic startup/shutdown behavior, port and endpoint inventory, container publication review, and incident logs that avoid leaking secrets.

Quick matrix

SurfaceBaseline ruleFailure signalEvidence to keep
Bind addressBind only to the interfaces the use case needs0.0.0.0 or [::] used by default for a local-only serviceConfigured address, actual listening sockets, owner
AuthenticationAuthenticate privileged API calls even on localhostPossession of local network reachability is enough to actAuth method, token scope, rotation path
CORSUse an exact origin allowlist for browser clientsWildcard origin or reflected Origin with credentialsAllowed origin list and negative tests
Origin validationValidate full scheme/host/port for browser and WebSocket handshakesSubstring matching or no Origin checkOrigin policy and rejection logs
WebSocketsAuthenticate handshake/session and validate every messageOpen socket after page load with no message authorizationHandshake checks, message schema, max payload
Port publicationPublish only required ports and bind them narrowlyContainer port unintentionally reachable from LANPort inventory and network scan result
Port discoveryDiscovery reveals location, not authorityAnyone who finds the port can control the serviceDiscovery mechanism and auth boundary
API surfaceExpose narrow task operationsGeneric shell, filesystem, SQL, proxy, or arbitrary fetch endpointsEndpoint inventory and denied-action tests
LifecycleStart on demand, stop predictably, clean credentials and temp stateZombie service or stale token survives app exitPID/session owner, shutdown test, cleanup proof
LoggingRecord security-relevant events with redactionNo trace of auth failures or logs contain tokens and payload secretsEvent schema, retention, redaction test
ContainersReview published ports, mounts, sockets and container network reachabilityBroad host mount or daemon socket reachable from local APICompose/runtime config and privilege review

Local service readiness scorecard

Score the service before exposing it to a desktop UI, browser flow, agent runtime, or container-backed app.

Control0 points1 point2 pointsOwner question
Network exposureAll interfacesLoopback configuredLoopback or explicit interface plus verified socket/scan evidenceWho can reach the service from host and LAN?
AuthenticationNoneShared static tokenScoped session/client auth with rotation and expiryWhat proves a caller is authorized?
Browser origin policyAny originManual allowlistExact allowlist with tests and separate credential policyWhich websites can invoke the service?
WebSocket securityNo checksHandshake auth onlyOrigin + auth + per-message authorization + limitsWhat happens after a socket is established?
API least privilegeGeneric powerful APISome wrappersNarrow typed operations with validation and denied testsWhat is the smallest operation the client actually needs?
Container boundaryBroad mounts/socketSome restrictionsExplicit ports, mounts, networks, non-root where practical, no unnecessary daemon socketCan service compromise become host compromise?
LifecycleAlways on/zombie riskManual cleanupOwned startup, health, shutdown, token invalidation and temp cleanupWho stops and resets the service?
Incident evidenceNo useful logsRequest logs onlyAuth/origin/admin events, correlation IDs, redaction and retentionCan we reconstruct an unauthorized action?

30-minute local service security test

Use this before connecting a browser, desktop renderer, agent, or container workflow to a local service.

0–5 min: map listeners

List IPv4/IPv6 sockets, protocols, bind addresses, published container ports, intended clients, and owners.

Success checkEvery listener has an explicit purpose and expected reachability.

5–10 min: test network reachability

Probe from the host, another local process context, and a LAN peer where applicable.

Success checkActual exposure matches the documented bind policy.

10–15 min: attack browser boundaries

Use an unapproved origin to test HTTP requests, credentialed requests, preflight behavior, and WebSocket handshake rejection.

Success checkUnauthorized origins cannot perform privileged actions or establish trusted sockets.

15–20 min: test auth and message scope

Try missing, expired, wrong-scope, replayed, and malformed credentials plus unauthorized endpoint/message actions.

Success checkThe service rejects calls before side effects and logs useful evidence.

20–25 min: inspect containers and powerful bridges

Review mounts, sockets, published ports, arbitrary URL fetches, shell, filesystem and container-control methods.

Success checkNo unnecessary path from local API compromise to broad host privilege exists.

25–30 min: exercise shutdown and evidence

Exit the UI, crash the service, restart it, invalidate tokens, check stale sockets, temp state and security logs.

Success checkThe service returns to a known state and incident evidence is useful without leaking secrets.

Local service security review flow

  1. Classify the service: desktop companion API, agent gateway, local model endpoint, browser automation bridge, container-backed database/API, self-hosted dashboard, or device-control service.
  2. Map every caller: packaged renderer, normal browser tab, extension, CLI, mobile device, LAN peer, container, VM, and other local process. Do not assume only the intended UI can connect.
  3. Record actual bind addresses and published ports for IPv4 and IPv6. Verify from the host and another LAN machine rather than trusting configuration text alone.
  4. Separate reachability from authorization. Loopback binding, random ports, process ownership, and service discovery may reduce exposure but do not replace authentication for privileged operations.
  5. For browser clients, define exact allowed origins and credential behavior. Treat CORS as browser policy, not API authorization, and validate WebSocket Origin separately.
  6. Inventory endpoints and messages. Replace generic shell, filesystem, arbitrary URL fetch, SQL, proxy, and container-control methods with narrow operations and validated schemas.
  7. Review rate limits, payload limits, timeouts, connection caps, CSRF-like browser flows, DNS rebinding assumptions, redirects, and protocol upgrade paths.
  8. For container-backed services, inspect published ports, bridge networks, host mounts, runtime sockets, credentials, and whether sibling containers can reach sensitive endpoints.
  9. Test startup, crash, restart, app exit, machine sleep/wake, token expiry, stale sockets, port reuse, and cleanup of temp files, caches, sessions, and logs.
  10. Define incident evidence: auth failures, origin rejects, privileged actions, configuration changes, service lifecycle events, correlation IDs, and redaction/retention policy.

Scenario table

ScenarioRequired controlsStop condition
Desktop app companion APILoopback bind, per-session auth, exact renderer origin policy, narrow methods, app-owned lifecycleAny local webpage or process can call privileged methods unauthenticated
Browser-to-localhost developer toolExplicit origin allowlist, CSRF-resistant auth, no wildcard credentials, strict endpoint scopeArbitrary website can trigger local state changes
Local WebSocket agent gatewayOrigin validation, authenticated handshake, per-message authorization, payload and connection limitsAny origin can connect or authenticated socket can invoke unrestricted messages
Container-backed local APIExplicit loopback publication, no unnecessary LAN bind, scoped credentials, mount/socket reviewPublished port or daemon socket exposes host-level privilege
Self-hosted dashboard on LANExplicit LAN bind, real user auth, TLS where appropriate, session controls, rate limits, audit eventsLAN reachability is treated as identity
Local model endpointClient authentication for sensitive prompts/data, request limits, retention policy, no broad file/tool proxyingAny local process can exfiltrate private context or invoke tools
Temporary test serverRandom or reserved port, loopback, short lifetime, no production secrets, deterministic cleanupServer remains after test or binds all interfaces
Agent controlling containersNarrow broker API, explicit allowed actions, no general daemon socket exposure, action logsCompromised client can create privileged containers or mount arbitrary host paths

Local service risk checklist

Loopback equals trust

Other local processes and browser-mediated attacks may still reach localhost. Loopback narrows network exposure but does not authenticate the caller.

CORS as access control

CORS controls browser read access and request behavior; non-browser clients ignore it, and permissive configurations can expose privileged local APIs.

WebSocket origin gap

A service may protect HTTP endpoints yet accept WebSocket handshakes from arbitrary origins, creating a cross-site request channel.

Published port surprise

Container port publication can make a local service reachable from interfaces beyond localhost when the host IP is not specified narrowly.

Random port security myth

An unpredictable port can reduce accidental discovery but cannot replace authentication because malware, browser behavior, logs, process inspection, or port scans can reveal it.

Generic local admin API

Endpoints for arbitrary shell commands, filesystem paths, URLs, SQL, container operations, or proxying turn a small local service into a broad privilege bridge.

Zombie service and stale token

Background processes, crash recovery, sleep/wake, and failed shutdown can leave reachable services or valid credentials after the UI exits.

Sensitive incident logs

Debug logs that capture Authorization headers, session tokens, prompts, file contents, or WebSocket payloads can create a second data-exposure channel.

Local service implementation patterns

Loopback plus authentication

Use loopback binding to reduce network reachability and a separate authentication mechanism to prove client authority.

Exact origin allowlist

Compare complete normalized origins including scheme, host, and port; reject substring and suffix tricks.

Session-scoped capability token

Issue short-lived tokens tied to a service instance, client, or capability instead of one permanent machine-wide secret.

Narrow broker API

Expose startTask, openProject, renderPreview, or runApprovedJob rather than exec, readAnyFile, proxyUrl, or raw container-daemon operations.

Port inventory as build artifact

Generate or maintain a machine-readable list of listeners, protocols, bind addresses, auth requirements, owners, and intended clients.

Lifecycle owner

Make one parent process or service manager responsible for startup, health, shutdown, token invalidation, and cleanup.

Security event log

Record authentication failures, origin rejects, privileged actions, config changes, restarts, and abnormal disconnects with correlation IDs and redaction.

FAQ

Short answers for teams operating localhost and LAN services.

Is binding to 127.0.0.1 enough?

No. It is an important network boundary, but privileged operations still need an authorization model because other local processes and browser-mediated attack paths may reach localhost.

Does CORS secure a local API?

Not by itself. CORS is enforced by browsers and does not authenticate callers. Use strict origins for browser flows plus real authentication and authorization for privileged APIs.

Do WebSockets need separate security review?

Yes. Validate Origin during the handshake, authenticate the connection, authorize message actions, validate schemas, bound payloads and rate, and log security-relevant events.

Is a random local port a security control?

It can reduce collisions and casual discovery, but it should not be the main authorization boundary. Ports can be discovered through scans, logs, process inspection, browser behavior, or compromised local software.

Why review container port publication?

A service intended only for the host can become reachable from the LAN or other networks depending on publication settings and host configuration. Verify actual bind scope rather than assuming container isolation.

What should local-service logs contain?

Record authentication failures, rejected origins, privileged operations, configuration changes, lifecycle events, errors and correlation IDs, while redacting tokens, secrets and sensitive payload contents.

Related radar

Infrastructure & Runtime Radar

Related RepoDaily briefs

Sources

  1. MDN Cross-Origin Resource Sharing
  2. MDN Same-origin Policy
  3. MDN Local Network Access
  4. OWASP WebSocket Security Cheat Sheet
  5. OWASP Testing WebSockets
  6. Docker Port Publishing
  7. Docker daemon socket warning
  8. Podman run documentation
  9. RepoDaily Desktop Runtime Security Checklist
  10. RepoDaily Containerized Agent Workspace Blueprint

Feedback

Did this page help you make a decision?

Anonymous feedback helps RepoDaily improve what is actually useful.

Report outdated or missing evidence