Sipar Firewall

A web application firewall in the gateway, for every application in the cluster.

Sipar Firewall checks each request in Sipar Gateway before it reaches the cache or the application. Every firewall policy includes OWASP Top 10 (2021) rules by default, and the firewall uses Subashi Pro’s rule format, with each value given its type, so a rule written for Kipchak Enterprise moves to the gateway with little change.

SIPAR APPROVED Every feature on this page is an approved design, not yet available.

OWASP Top 10 (2021) rules
Fourteen rules in every policy by default
Any application
Any language or framework behind the gateway
No outside call
Country and network data is held in the cluster
Per team
Each namespace keeps its own rules and counters

Preconfigured protection

OWASP Top 10 (2021) rules, included in every policy.

The OWASP Top 10 (2021) is the reference list of the most serious risks to web applications. Sipar Firewall ships with rules for the OWASP Top 10 (2021) categories that a request filter can detect. They are the rules that Subashi Pro provides as a sample configuration for developers to copy, tested against the same set of requests. In Sipar they are built in and included by default.

A new policy starts in log-only mode, so a team sees what the rules would block on its own traffic before they block anything. Some patterns can match ordinary requests on a particular application, so each rule can be run in log-only mode, turned off, or replaced by name. The documentation lists the known cases and the setting for each.

Some risks in the list, such as weak cryptography or insecure design, lie in the application rather than in the request. A firewall cannot detect them, and Sipar does not claim to.

OWASP Top 10 (2021) categoryRules included
A01 Broken access controlPath traversal. The gateway normalises each path before the firewall sees it, which stops most of these attacks before the rule is reached.
A03 InjectionSQL injection in the path and in the query string; command, LDAP and XPath injection; cross-site scripting in the path and in the query string
A05 Security misconfigurationRequests for sensitive files, answered as not found
A06 Vulnerable and outdated componentsKnown vulnerability scanners
A08 Software and data integrity failuresNull byte injection
A09 Security logging and monitoring failuresLog forging
A10 Server-side request forgeryForged internal addresses in the path and in the query string

How a request is checked

Three lists, in a fixed order.

The firewall runs after TLS and access checks, and before the cache. A request that the firewall blocks is never answered from the cache and never reaches the application.

  1. 01Allow list

    The rule that matches first lets the request through, past every other check. Used for trusted monitoring and partner addresses.

  2. 02Block list

    The rule that matches first blocks the request with that rule’s status and message. The OWASP Top 10 (2021) rules are here.

  3. 03Rate limits

    Every matching limit is applied. A request over a limit is answered 429 with the time to wait.

  4. 04Cache, then the application

    Only a request that passes all three continues.

Your own rules

Rules written as Kubernetes resources.

A team writes its rules in a policy in its own namespace and attaches it to its own routes. A rule matches when all of its conditions match. Rules are checked when they are applied, and again when the gateway loads them. A rule set that fails is reported with the reason, and the previous one stays in force.

Conditions
Path, method, header, query string, query parameter, client address, a field of a JSON body, country and network.
Comparisons
Equals, contains, in a list and exists, each with its opposite; regular expression; and greater or less than, with or without equality.
# Block two countries, and limit each address
apiVersion: gateway.sipar.mamluk.net/v1alpha1
kind: SiparWAFPolicy
metadata:
  name: shop
  namespace: shop
spec:
  targetRefs:
    - group: gateway.networking.k8s.io
      kind: HTTPRoute
      name: shop
  mode: LogOnly          # or Enforce
  failurePolicy: Open    # or Closed (503)
  rules:
    blacklist:
      - name: Countries we do not serve
        conditions:
          - type: geo_country
            operator: in_list
            values:
              - { type: string, value: "XX" }
              - { type: string, value: "YY" }
        response_code: 451
        response_message: Unavailable for legal reasons
    rate_limit_rules:
      - name: Per address
        conditions: []
        rate_limit:
          limit: 100
          window: 60
          key_prefix: ip
          key_source: ip
  rateLimiting:
    store:
      valkey: { service: valkey, port: 6379 }
An illustrative example. The exact field names are set by the released policy format.

Country and network blocking

Decided inside the cluster, from data that is kept current.

Local databases
Country and network lookups read databases held in the cluster. No request, address or log is sent to an outside service to decide.
Two sources, in order
Each lookup tries a second source when the primary source has no answer, in the same order as Subashi Pro, so both products reach the same decision.
Rebuilt at least monthly
Each Sipar release carries the newest data, and an operator can move to newer data without upgrading. The data is pinned by digest, so its content is verified, and an alarm is raised if it is more than 45 days old.

Safe to operate

A rule change never removes protection by accident.

Log-only before blocking
A policy can record what it would block before it is allowed to block, so its effect is known before customers feel it.
The last accepted rules stay in force
If an update cannot be applied, the route keeps its previous rules and an alarm is raised.
A stated failure policy
If the firewall cannot be reached, routes keep serving by default and an alarm is raised. Where a regulator requires it, a route can instead refuse requests with 503 until the firewall returns.
A record of every block
Each block is counted and logged with the rule name, address, method and path. The request body is never recorded.
Separate teams
One team’s invalid policy is refused without affecting others. Rate-limit counters live in each team’s own store and never meet.
Clear answers
Blocked requests receive the rule’s status and message, 403 by default. Limited requests receive 429 with the time to wait.

For Kipchak Enterprise customers

From Subashi Pro to the gateway, with the same rules.

Subashi Pro protects one Kipchak application from inside it. Sipar Firewall applies the same rules at the gateway, in front of every application in the cluster. The firewall reads Subashi Pro’s rule format, with each value given its type, and both products are tested against one shared set of requests. A converter turns existing rules into a firewall policy. The conditions, comparisons, allow and block lists and rate limits carry over. Each policy names its own store for rate-limit counts, and a setting that would otherwise be silently ignored is refused.

Stated differences

  • Regular expressions follow the RE2 syntax. A pattern that RE2 cannot run, such as one with a back-reference, is reported when the gateway loads the policy, and the previous version stays in force.
  • The path is matched after the gateway normalises it. This closes bypasses that rely on encoded characters, and means a rule that looks for encoded input in the path does not match.
  • Rule values carry explicit types, and a misspelt condition type or operator is refused rather than ignored.
  • A failed update keeps the whole previous rule set in force, rather than skipping the one condition that failed.
  • Built-in rule names and IDs are frozen. A built-in rule added or changed after the initial release starts in log-only mode for one minor release.
  • Subashi Pro’s diagnostics endpoint is not offered at the gateway, because a shared gateway must not show one team’s configuration to another.

Licensing and support

Included with every BKE licence.

On the Bahriya Kubernetes Engine

From 2.7.0 onwards, included with every licence at no extra price, and installed and upgraded with the cluster.

On other Kubernetes distributions

Part of the Bahriya Tersane licence, installed from the Tersane catalogue, with ticketed support from within the GCC.

Sipar is a product of Mamluk. Envoy, Istio and cert-manager are projects of the Cloud Native Computing Foundation. OWASP is a trademark of the OWASP Foundation, which does not endorse Sipar.

Sipar, pronounced si-par, is the Persian word for a shield.