๐Ÿ”’

Authorization at Netflix

Jul 29, 2024

Authorization at Netflix

Presenters

  • Manish Mehta: Security Engineer at Netflix, specializes in secure bootstrapping, PKI, secrets management, authentication, and authorization.
  • Torinn Sandal: Tech lead of the Open Policy Agent (OPA) project, contributing to Kubernetes and Istio.

Key Concepts

Definitions

  • Authentication (AuthN): Verifying the identity of the requester. Example: A bank verifying who is requesting a $1,000 transfer.
  • Authorization (AuthZ): Verifying if the authenticated identity has permission to perform a requested action.

Decoupling AuthN and AuthZ

  • These two processes do not need to be tied together within one system to maintain flexibility.

Netflix Architecture Overview

  • High-Level View: Simplified architecture with customers, backend, cloud providers (like AWS), and CDN.
  • Focus: The backend controls applications such as API gateways, personalization, account management, etc.

Challenges of Service Interaction

  • Applications within the control plane (e.g., REST, gRPC services) must effectively communicate with each other.
  • Important considerations include:
    • Network Reachability vs. Authorization: Network reachability does not equal authorization. Need more granular control over REST endpoints.
    • Diverse Protocols: Varying protocols (REST, gRPC, custom protocols) require flexible solutions.

Problem Definition

  • Need a unified approach to define and enforce rules based on combinations of:
    • I: Identity
    • O: Operation
    • R: Resource
  • Avoid multiple solutions causing a lack of visibility and control.

Key Requirements for Solution

  1. Company Culture Alignment: Must enable freedom and responsibility (self-service) for engineers and teams.
  2. Resource Type Support: Must accommodate various resource types, including non-API resources (e.g., SSH).
  3. Diverse Identities: Support user roles including employees, contractors, and software services.
  4. Protocol Independence: Ability to cater to multiple underlying protocols (e.g., HTTP, gRPC).
  5. Flexibility of Rules: Capable of adapting to new use cases and formats.
  6. Performance (Latency): Decisions must be made in sub-millisecond time frame, preferably without network round trips.
  7. Capture of Intent: Ensure users donโ€™t mistakenly write policies that diverge from their intent.

Architecture Overview for Authorization

  • Components:
    • Policy Portal: UI where engineers write policies, manage versions, and override rules when necessary.
    • Aggregator: Gathers data from various sources (e.g., ownership databases) to inform policies.
    • Distributor: Distributes policies to agents, ensuring information is kept fresh in memory without introducing latency.
  • Authorization Agents: Located next to applications for fast decision-making (hot path) and asynchronously updating from distributors (slow path).

Example: Payroll System

  • REST API with endpoints get salary and update salary:
    • Policies for reading salaries based on employee-manager relationships and job roles.

Open Policy Agent (OPA)

  • General-purpose policy engine: Implementation in Go, lightweight, designed for runtime integration without dependencies.
  • Rego Language: Declarative language for writing policies, focusing on data and logic.
  • Performance Metrics: Latency remains stable even as data sets grow.

Additional Features of OPA

  • Policy composition allows reusing logic across different rules, aiding maintainability.
  • Resource agnostic, meaning it's not specific to any single domain or technology.
  • Community and Ecosystem: OPA offers pre-built integrations for platforms like Kubernetes and has strong community support.

Self-Service UI and Testing

  • Developed a UI to simplify policy creation, ensuring engineers don't write overly complex rules, thus capturing their intent effectively.
  • Built-in Unit Testing: Tests run against policies before deployment, preserving original intentions and preventing errors after updates occur.

Conclusion

  • Authorization is a critical security challenge, with cloud environments changing the dynamics.
  • Aim for a cohesive solution rather than multiple fragmented systems to ensure visibility and control.
  • Community Engagement: Look into open-source projects like OPA, and consider collaborating with others facing similar challenges.