How Cal.com Rebuilt AppSec After Going Closed Source
How Cal.com consolidated noisy security tooling into one continuous, context-aware pull request security program with Gecko.
Gecko Security

Your gRPC service's auth logic probably looks fine in isolation. The interceptor is there, the metadata check runs, the proto schema is typed. What static analysis tools keep missing is that the interceptor lives in a different file from the methods it guards, the schema enforces types but not semantics, and Scala's functional abstractions break the linear dataflow assumptions most SAST engines rely on. That structural gap is what this post is about.
TLDR:
Scala and Java gRPC services carry a security profile that differs from standard REST APIs in ways that matter for static analysis. The binary encoding of Protobuf means HTTP-layer scanners see opaque payloads instead of readable JSON fields, so input validation flaws that would appear in web application firewalls or request logs stay invisible until someone explicitly models the schema. Scala's type system and JVM interop add another layer: mixed Scala/Java codebases frequently call across language boundaries, and a static code analysis tool that parses only one language misses taint paths that cross from Akka gRPC stubs into Java service implementations.
In REST services, the endpoint contract lives in code or OpenAPI specs that static tools parse directly. In gRPC, the contract lives in .proto files, and the generated stub code sits between those definitions and the business logic. Security analysis that skips .proto parsing loses visibility into which fields are user-controlled, which services are externally reachable, and which RPCs skip authentication via interceptor configuration. For Scala services using ScalaPB or grpc-java, the generated code is syntactically regular but semantically opaque without the original schema context.
Java SAST tools designed before Scala adoption became common often fail on Scala's implicit conversions, higher-kinded types, and macro-generated code. A field deserialized in a Scala case class might flow into a Java DAO without any explicit cast the analyzer can follow. This is a structural gap: the call chain exists at the bytecode level but the source-level analysis never sees it.
Scala and Java applications running gRPC services share a common set of vulnerability classes, and understanding where they appear shapes how you approach static analysis.
Protobuf handles serialization for gRPC, but applications frequently mix Protobuf with Java's native serialization or third-party libraries like Kryo and Jackson. When deserialized data from an untrusted source reaches object construction without type validation, attackers can trigger gadget chains. Java's ObjectInputStream is the classic entry point, but the same pattern appears in Scala when implicit conversions silently coerce incoming message fields into complex types.
gRPC supports channel credentials, call credentials, and interceptors for auth enforcement. The failure mode is consistent: interceptors are registered but not applied uniformly across all service methods, or metadata-based tokens are read but never verified against a trust boundary. In Scala, interceptors composed through functional middleware can drop auth context if the composition order is wrong.
String fields in Protobuf messages carry no schema-level sanitization. When those fields flow into SQL queries, shell commands, or LDAP filters without validation, the attack surface is identical to any other user input. Java SAST tools frequently miss this because the taint source is a generated getter method on a Protobuf class, not a servlet request parameter.
Some gRPC framework configurations default to plaintext when TLS is not explicitly configured. Services deployed on internal networks often skip TLS under the assumption that the network perimeter is sufficient. That assumption fails in multi-tenant environments or when lateral movement is in play.
Most Java SAST tools were built with Java in mind. Scala runs on the JVM and interoperates with Java libraries, so teams frequently assume their existing Java tooling carries over. It largely does not.
Scala's type system, implicits, and functional abstractions produce bytecode that looks structurally similar to Java at the bytecode level but diverges sharply at the source level. Tools that parse Java source directly cannot read Scala. Tools that operate on bytecode miss the semantic relationships that matter for security analysis: where data enters, how it flows through functional transformations, and where it exits into a sink.
The mismatch becomes concrete in a few recurring patterns:
map, flatMap, and fold carry data across boundaries that rule-based scanners treat as opaque. Taint does not stop at a lambda boundary in practice, but many tools behave as if it does.Future and ZIO abstractions wrap effectful operations in ways that break linear dataflow assumptions baked into most SAST engines.The result is a high false-negative rate on Scala codebases analyzed with Java tooling, not because the tools are poorly implemented, but because static analysis struggles with business logic when the semantic model does not match the source language.
gRPC services expose several attack vectors that differ meaningfully from REST APIs, and static analysis tools that treat all endpoints the same will miss them.
gRPC server reflection allows clients to query available services and method signatures at runtime. When left active in production, it hands attackers a full schema of your service without any prior knowledge of the .proto files. A scanner that checks only for authentication annotations on individual methods will not flag an exposed reflection endpoint, as seen in CVE-2025-51481 where a Dagster gRPC server endpoint went undetected by conventional tools.
gRPC metadata headers carry authentication tokens, trace IDs, and routing information. Untrusted metadata values that flow into log statements, downstream service calls, or database queries without validation create injection paths that look structurally identical to HTTP header injection but operate in a different serialization layer. Taint analysis needs to track metadata extraction calls as untrusted sources, alongside HTTP request parameters.
Proto service definitions list every callable method. Access control is typically enforced in interceptors instead of at the method definition level, which creates a mismatch: the method exists and is reachable, but the interceptor chain may have gaps for specific method patterns or streaming call types.
| Attack Vector | Detection Requirement |
|---|---|
| Reflection API active in prod | Config-aware analysis, beyond code scanning |
| Metadata header injection | Metadata sources in taint tracking |
| Missing interceptor coverage | Cross-file interceptor-to-method mapping |
| Streaming method auth gaps | Call-type-aware access control analysis |
Each of these requires cross-file reasoning. The interceptor lives in one file; the method definition lives in another; the missing coverage only appears when both are read together.
Protobuf schemas define the contract between services in a gRPC system. Every field has a type, a field number, and an optional label. That structure looks rigorous on the surface, but it carries several trust assumptions that static analysis tools frequently miss.
Field presence is one of the first places things break down. In proto3, all fields are optional by default. A missing field silently deserves its zero value: 0 for integers, "" for strings, false for booleans. If your service logic treats a zero value as a valid authenticated state or an empty string as an acceptable access token, the schema itself will never reject that input. The bug lives in the gap between what the schema permits and what the service expects.
Protobuf enforces types, not semantics. A field typed as string accepts any string. A field typed as int64 accepts any 64-bit integer. Nothing in the schema prevents a caller from sending a negative account ID, a user ID belonging to someone else, or an empty authorization field.
This matters for Java and Scala SAST analysis because the schema file and the service implementation live in separate compilation units. A tool doing file-level analysis sees the handler method receiving a deserialized message object. It does not see whether the field it reads was marked required, what the valid range is, or whether the caller was authorized to populate it. The trust boundary sits between the wire and the handler, and that gap is structurally invisible to pattern-based scanners.
Three schema-level risks appear consistently across gRPC services:
oneof fields create implicit control flow: a handler checking hasField() on the wrong case passes silently without any type error from the runtime.Service mesh deployments running gRPC introduce authorization failure patterns that differ meaningfully from REST-based architectures. In HTTP/1.1 APIs, authorization checks typically happen at a clear request boundary. In gRPC service meshes, that boundary fragments across interceptors, middleware chains, and sidecar proxies, and static analysis tools frequently lose track of which check applies to which RPC method.
Three failure patterns recur most often in gRPC mesh environments:
Java SAST tools that parse interceptor configurations as isolated call chains miss these patterns because the vulnerability only exists across the full mesh topology, not within any single file or service boundary.
Input data checks and field validation at the protobuf schema level stop an entire class of malformed message attacks before they reach business logic. For Scala services using ScalaPB or Java services using the standard protobuf runtime, define field constraints through proto options and validate server-side before any processing begins.
Authentication in gRPC services requires interceptors. A server-side interceptor that reads and validates the metadata context on every call gives you a single enforcement point instead of scattered per-method checks that are easy to miss during refactoring.
All gRPC channels in production should use TLS. Plaintext channels are acceptable only for loopback communication between services on the same host, and even then, mutual TLS is worth the setup cost for any service handling sensitive data.
gRPC status codes carry more information than HTTP status codes in practice, because many clients log the full status detail string. Returning internal error messages, stack traces, or database error text in status details exposes implementation internals to callers. Map internal exceptions to generic status codes at the interceptor layer and log detail server-side only.
Key practices to apply across both Scala and Java gRPC services:
Static analysis for gRPC and Protobuf services in Scala and Java requires tools that understand both the generated code layer and the hand-written service logic sitting on top of it. Most SAST tools parse Java or Scala syntax without recognizing that a StreamObserver<ResponseT> callback or a ServerInterceptor implementation carries different trust semantics than a standard method call.
The structural problem is that Protobuf code generation creates an indirection layer between the schema definition and the runtime behavior. A .proto file defines message fields and service contracts, but the generated Java or Scala stubs are what SAST tools actually read. This creates three gaps that file-level scanners cannot close:
getFieldName() or hasFieldName() carry no taint metadata in the tool's model, so untrusted proto message content flows into business logic without the scanner flagging it as user-controlled input.ServerInterceptor implementations exist in a separate compilation unit from the service handlers they are meant to guard. A scanner reading one file at a time cannot confirm that a given RPC method is covered by an interceptor that actually runs in the call chain.Analyzing these endpoints correctly requires inter-procedural taint tracking that treats generated proto accessors as taint sources and follows data across service boundaries into handler logic. For Scala codebases, the analysis must handle implicit conversions and higher-kinded types that appear in libraries like ScalaPB, where generated case classes wrap proto fields behind Scala-idiomatic accessors that look nothing like their Java counterparts.
Call chain reconstruction matters here more than in typical REST analysis. A gRPC request passes through the channel, a potential interceptor stack, and then the handler. Whether an authorization check fires depends on interceptor registration order at server construction time, which lives in configuration code, not in the handler file. Effective java SAST for gRPC needs to trace that registration path to confirm coverage.
Gecko's analysis of gRPC and Protobuf endpoints goes beyond surface-level schema inspection. Because gRPC services expose methods instead of REST routes, traditional SAST tools miss entire categories of authorization failures that only appear when you trace call chains from the generated stub code through service implementation layers.
Gecko identifies interceptor coverage gaps and data-flow risks across Scala and Java gRPC codebases by building a compiler-accurate semantic graph of the full codebase, including generated Protobuf classes, and tracing data flow across service boundaries. That analysis surfaces when a gRPC method handler skips an authorization interceptor, when a streaming RPC leaks data across tenant boundaries, or when a Protobuf field marked as internal gets exposed through a public service method without sanitization.
For Scala codebases in particular, Gecko resolves implicit conversions and typeclass instances that pattern-matching tools treat as opaque, which is where authorization logic frequently lives in idiomatic Scala gRPC implementations. A representative pattern:
implicit def authContextFromMetadata(md: Metadata): AuthContext =
AuthContext(md.get(Keys.JWT_KEY))
def handleRequest(req: GetAccountRequest)(implicit auth: AuthContext): Future[GetAccountResponse] = {
// auth derived via implicit - no explicit assignment visible to a pattern-matching scanner
if (!auth.isAdmin) Future.failed(Status.PERMISSION_DENIED.asException())
else accountService.get(req.accountId)
}A pattern-matching tool sees the implicit def as an opaque call and never connects the Metadata input to the auth.isAdmin check downstream. Gecko's compiler-accurate semantic graph resolves the implicit at the call site and traces the full path from the gRPC metadata source through the resolved AuthContext to the authorization decision, flagging any gap where that conversion is absent or bypassed.
The core problem is visibility: your .proto files define what fields are user-controlled, your interceptors define what gets authorized, and your Scala implicits define how data moves between layers. A tool that reads only one of those three inputs gives you a partial result at best. Getting accurate findings requires analysis that connects all three, and that means understanding both the gRPC call model and the JVM polyglot layer sitting beneath it. Reach out to the Gecko team to see how this kind of analysis works across a real Scala and Java gRPC service.
Existing Java SAST tools cover only part of this problem. They fail on Scala's implicit conversions, higher-kinded types, and macro-generated code, which means taint paths that cross from Akka gRPC stubs into Java service implementations stay invisible: the call chain exists at the bytecode level, but source-level analysis never sees it.
Authorization coverage requires inter-procedural analysis that maps interceptor registration at server construction time to the specific RPC methods each interceptor guards. Because the interceptor lives in a separate file from the service handler, file-level scanners cannot confirm coverage. You need a tool that traces the full registration call chain and flags methods where the interceptor chain has gaps for specific handler patterns or streaming call types.
Semgrep's single-file AST analysis cannot trace the interceptor-to-method relationships or cross-service call chains that gRPC authorization failures depend on, so it will miss a missing auth check when validation happens at the gateway but ownership is never re-verified at the data service. Gecko builds a compiler-accurate semantic graph across the full codebase, including generated Protobuf classes, and traces data flow across service boundaries, which is what's required to confirm interceptor coverage and detect streaming RPC auth gaps.
In proto3, every field is optional by default and defaults to its zero value when absent: 0 for integers, "" for strings, false for booleans. If service logic treats a zero integer as a valid authenticated state or an empty string as an acceptable token, no schema-level rejection occurs, and pattern-based Java SAST tools cannot flag it because they see a syntactically valid handler receiving a deserialized message object with no visible trust boundary violation.
Trace interceptor registration from server construction code through to each registered service method statically, then cross-reference the full set of RPC methods in the proto service definition. Any method reachable on the wire that the registration path does not cover is a gap. In Scala codebases using ScalaPB, this requires resolving implicit conversions and typeclass instances that pattern-matching tools treat as opaque, and that is precisely where authorization logic frequently lives in idiomatic Scala gRPC implementations.
Jeevan Jutla
Co-founder & CEO
JJ joined GCHQ as a teenager, working on security research and exploit development, and scored the highest mark on its reverse engineering and binary exploitation aptitude test ever recorded. The record still stands. He went on to lead security tool development for Binance’s eight-person red team and led the recovery of $500K stolen by North Korean state hackers, the largest recovery of stolen funds at the time.
The latest news, technologies, and resources from our team.
How Cal.com consolidated noisy security tooling into one continuous, context-aware pull request security program with Gecko.
Gecko Security
See what actually changed in the OWASP Top 10 for 2026, from merged SSRF and XXE categories to new supply chain risks and scanner coverage gaps.
Jeevan Jutla
Gecko Security uncovered CVE-2026-21894 in August 2026, an n8n authorization bypass with CVSS 8.8. See why static tools missed it and how to remediate it.
Jeevan Jutla
Security misconfiguration is OWASP A05 for a reason. Learn how deployment context determines exploitability and how to fix gaps in August 2026.
Jeevan Jutla
How do modern AppSec vendors actually compare? This July 2026 capability map covers SAST, DAST, SCA, business logic flaws, and cross-service
Gecko Security
Break down your AppSec stack: what SAST, DAST, SCA, IAST, and pen testing each see — and what they miss. Updated July 2026 by Gecko Security.
Gecko Security
Occasional updates, new content, and insights. No spam; unsubscribe anytime.