İçeriğe atla
Cloudflare Wiki

    gez · aç · Esc kapat

    API Shield

    API'lerini keşfeder, şemaya uyumsuz istekleri tespit eder ve mTLS ile JWT doğrulaması yapar. Ama hiçbirini kendi başına engellemiyor — engelleme her zaman senin yazdığın WAF kuralında.

    • DurumGenel kullanımda
    • FiyatEnterprise sözleşmesi — “Custom Pricing”, yayımlanmış rakam yok
    • Doğrulama

    API Shield nedir?

    API’lerine yönelik saldırıları tespit etmek ve engellemek için bir araç seti: endpoint keşfi, OpenAPI şeması doğrulaması, mTLS, JWT doğrulaması, oturum bazlı hacim tespiti ve BOLA taraması.

    İsim değişikliği

    Ürünün adı API Gateway → API Shield oldu. cloudflare.com/application-services/products/api-gateway/ bugün 301 ile API Shield’a yönleniyor. Ama resmî bir yeniden adlandırma duyurusu yok; aralık 2024-09-12 ile 2024-09-24 arasında.

    Nasıl çalışır?

    API Discovery

    Temel mekanizma path normalization:

    “Cloudflare produces a map of API endpoints by grouping similar request paths together.”

    api.ornek.com.tr/profil/238   ┐
    api.ornek.com.tr/profil/392   ┴→  api.ornek.com.tr/profil/*

    Hostname konsolidasyonu da var: us-api, de-api, fr-api{hostVar1}.ornek.com.tr.

    İki keşif yöntemi: “Your API endpoints are discovered with both session identifier-based discovery and machine-learning-based discovery.” ML tarafı için: “Machine learning-based discovery can identify API traffic regardless of whether your API uses a session identifier.”

    Keşif eşikleri — üçü birden gerekiyor:

    “The request must return a 2xx response code from the Cloudflare edge.”

    “The request must not originate directly from a Cloudflare Worker. Traffic sent through the Cloudflare traffic simulator or other Worker-based test harnesses will not be counted toward Discovery thresholds.”

    “The endpoint must receive at least 500 requests within a continuous 10-day period.”

    Üç operasyon durumu (eski “discovered/saved” ikilisi değil):

    DurumAnlamı
    full“An operation that you selected, added manually, or created from a schema. Used for matching, logging, detections, and rules.”
    candidate“An operation that Cloudflare discovered from traffic. Used for matching, logging, detections, and rules before you manually review them.”
    shadow“Exists in Web Assets but is not used for matching, logging, detections, or rules.”

    Kritik: “You do not need to move every discovered operation to the full state. Candidate operations provide operation context automatically. Profile learning starts only when you select Learn profile.

    Web Assets (eski adıyla Endpoint Management)

    Sayfa rozeti: “Available on all plans”.

    “An operation is Cloudflare’s term for an endpoint identified by HTTP method, hostname pattern, and path pattern.”

    Operation ID deterministik: “For the same method, hostname pattern, and path pattern, Cloudflare generates the same operation UUID.”

    Path değişkenleri: /api/kullanici/{var1}/detay

    Hostname değişkenleri: {hostVar1}.ornek.com.tr ✅ · foo-{hostVar1}.ornek.com.tr ✘ — “Hostname variables must comprise the entire domain field.”

    Eşleşme önceliği: “the more specific operation wins” ve “Operations in the full state always match before operations in the candidate state.”

    Operasyon başına analitik (full durumu gerekiyor): request count · rate limiting recommendation (istek / 10 dakika) · latency · error rate (4xx, 5xx) · response size · labels · authentication status · sequences. Zaman aralığı 24 saat veya 7 gün.

    Silme uyarısı: “When you delete a full operation, Cloudflare stops tracking its associated performance and analytics data. Its previous historical metrics cannot be restored.

    Schema Validation 2.0

    Format: yalnızca OpenAPI v3.0.x, YAML veya JSON. “OAS v3.1 is not supported, and there are no plans to expand support for OpenAPI 2.0.”

    Desteklenmeyen özellikler: “all responses, external references, non-basic path templating, or unique items.” Ayrıca parameter.content (schema kullan), parameter.type object, $ref external veya relative, anyOf parametre şemalarında, uniqueItems, ve servers.url relative.

    Cloudflare’in zorunlu tuttuğu alanlar (OpenAPI’nin zorunlu tutmadığı):

    “Although not strictly required by the OpenAPI specification, Schema validation strictly requires these fields.”

    • schema.type“All schemas require a type to be set. If the specific type is not supported, set the type to string instead.”
    • parameter.schema“a schema is strictly required on all parameters objects.”

    Content type: yalnızca application/json doğrulanıyor.

    Tespit alanları:

    AlanKaynakAnlamı
    cf.schema_validation.learned.violatedöğrenilmiş profil“true when an evaluated request violates the learned profile”
    cf.schema_validation.uploaded.violatedyüklenen şema“true when an evaluated request violates the supplied schema”
    cf.api_gateway.fallthrough_detected“Indicates whether the request matched a saved endpoint”

    İkisi de Boolean — sebep taşımıyor. Sebep yalnızca Profile Analysis’teki örneklenmiş loglarda.

    Profile Analysis üç durum gösteriyor: Conforms · Violates · Not evaluated (“No applicable profile is available, or the profile does not apply”).

    Ve resmî ihtiyat: A non-conforming request is not necessarily malicious. Releases, new clients, and valid edge cases can produce violations.”

    mTLS ve client sertifikaları

    Her planda ücretsiz — iki ayrı güncel sayfadan:

    All Cloudflare plans can set up mTLS with a Cloudflare-managed certificate authority (CA). Enterprise customers can upload up to five non-Cloudflare CAs.”

    “Cloudflare API Security products are available to Enterprise customers only. Anyone can set up Mutual TLS with a Cloudflare-managed certificate authority.

    Beş adımlı akış — üçüncüsü herkesin unuttuğu:

    1. CA seç (varsayılan Cloudflare-managed, hesap seviyesinde)
    2. Client sertifikası oluştur
    3. 🔴 Hostname association — mTLS’i o hostname için
    4. WAF Custom Rule yaz (yoksa hiçbir şey engellenmiyor)
    5. Origin sertifikası hostname’le eşleşmeli — “Origin server wildcard certificates such as *.example.com are not supported

    BYO CA limitleri: Enterprise hesap başına 5 CA, ve bu kota “shared across API Shield, Workers mTLS, and Cloudflare Gateway”. Aşınca hata kodu 1489.

    Workers’ta tip farkı: Rules language’de cert_verified Boolean; Workers’ta request.cf.tlsClientAuth.certVerified bir string ("SUCCESS" / "NONE" / "FAILED:self signed certificate").

    JWT doğrulaması

    “JWT validation has two parts: a token configuration that tells Cloudflare how to find and verify JWTs, and a rule that acts on the validation results.”

    Kritik ve çoğu makalede yanlış olan nokta:

    You do not need a rule or an operation in Endpoint Management for validation. Rules determine how Cloudflare acts on the results.”

    LimitDeğer
    Zone başına token configuration4
    Configuration başına token source4
    RSA anahtar minimum2.048 bit
    HMAC secret minimum32 / 48 / 64 bayt (HS256/384/512)
    title50 karakter
    description500 karakter

    Desteklenen algoritmalar (HMAC 25 Ağustos 2026’da eklendi): RSA (RS256/384/512, PS256/384/512) · EC (ES256, ES384) · HMAC (HS256/384/512).

    “Leading Bearer: strings in request tokens are automatically ignored.”

    Okunabilen claim alanları: aud · iat.sec · iss · jti · nbf.sec · sub (her biri .names / .values varyantlarıyla).

    Custom claim okuma:

    lookup_json_string(http.request.jwt.claims["<TOKEN_CONFIG_ID>"][0], "claim_adi")

    Tek gerçek kısıt: “JWT validation only operates on JWTs sent in client request headers or cookies. If your clients send JWTs in a POST body, contact your account team.”

    CORS tuzağı: Cloudflare’in kendi önerisi “adding or http.request.method eq \"OPTIONS\" to your JWT validation rules” — preflight istekleri kimlik bilgisi taşımıyor.

    Volumetric Abuse Detection

    “Cloudflare Volumetric Abuse Detection generates per-endpoint, per-session rate limit recommendations that adjust automatically as your traffic patterns change.”

    Eşikler: endpoint son 7 günde herhangi bir 24 saatlik pencerede en az 50 farklı oturum almalı ve Discovery kriterlerini karşılamalı. Session identifier tanımladıktan sonra 24 saat bekleniyor.

    Birim: istek / 10 dakika. p50, p90, p99 ve genel öneri veriliyor.

    Cloudflare’in tavsiyesi: “Cloudflare recommends using the overall rate limit recommendation rather than a single percentile value… Choosing a single percentile value may cause false positives due to a high number of outliers.

    Posture management, BOLA ve Vulnerability Scanner

    Risk taramaları 24 saatte bir çalışıyor. Etiketler:

    EtiketTetikleyici
    cf-risk-missing-authtüm başarılı istekler session identifier taşımıyor
    cf-risk-mixed-authbazıları taşıyor bazıları taşımıyor
    cf-risk-sensitiveyanıtlar Sensitive Data Detection kural setiyle eşleşiyor
    cf-risk-error-anomalyson 24 saatte hata artışı
    cf-risk-latency-anomalyson 24 saatte gecikme artışı
    cf-risk-size-anomalyyanıt gövdesi boyutunda sıçrama
    cf-risk-bola-enumerationoturum başına anormal veri noktası sayısı
    cf-risk-bola-pollutionparametre değeri beklenmedik bir konumda tekrarlanıyor
    cf-risk-zombiekaydedilmiş endpoint 32 gündür trafik almıyor

    Vulnerability Scanner (9 Mart 2026, open beta, yalnızca API üzerinden): stateful DAST platformu, BOLA odaklı. İki kimlik seti istiyor — Owner ve Attacker — ve saldırganın sahibin kaynaklarına erişip erişemediğini test ediyor. Kısıt: “The AI model used to build a plan for scanning your API has a 128k token context limit. This approximates to 40 to 60 kB of file size on disk.”

    API Routing ve developer portal

    API Routing open beta, Enterprise + API Shield. Kısıtları, birebir:

    You cannot change the method of a request. For example, a GET Source Endpoint will always send a GET request to the Target Endpoint.”

    “You must use all of the variables in the Target Endpoint that appear in the Source Endpoint.”

    “The Target Endpoint cannot be routed to a Worker if the route is to the same zone.”

    Yayılma süresi: “You may need to wait up to five minutes for Route changes to synchronize.”

    Developer portal ne olduğu konusunda net olmak gerekiyor:

    “This feature currently uses the open source Redoc project from Redocly.”

    Yani Cloudflare Pages üzerine kurulan bir Redoc statik sitesi. API key yönetimi, self-servis onboarding, kullanım kotası veya faturalama yok.

    Ne zaman kullanılır, ne zaman kullanılmaz

    Kullanılır

    • Envanterinde ne olduğunu bilmiyorsan. API Discovery, gölge API’leri bulmanın en hızlı yolu.
    • mTLS ile makine-makine trafiği koruyorsan. Her planda ücretsiz ve Cloudflare CA yeterli.
    • JWT doğrulamasını edge’e taşımak istiyorsan. Origin’e ulaşmadan geçersiz token’ları eleyebiliyorsun.
    • OpenAPI şeman varsa ve pozitif güvenlik modeli istiyorsan. Yüklenen şema, öğrenilmiş profilden çok daha sıkı.
    • BOLA riskini proaktif taramak istiyorsan. Vulnerability Scanner bu boşluğu dolduruyor.

    Kullanılmaz

    Gerçek bir API gateway arıyorsan. Dokümantasyonun tamamında (323 KB) şu kelimeler sıfır kez geçiyor: monetization, versioning, request transformation, response transformation, mediation, caching, canary, circuit break, aggregation. Şunlardan herhangi biri gerekiyorsa Kong, Apigee veya AWS API Gateway doğru cevap:

    • Request/response gövde dönüşümü (JSON↔XML, alan yeniden adlandırma)
    • API versiyonlama ve deprecation yaşam döngüsü
    • Monetizasyon, plan bazlı kota, aşım faturalandırması
    • API key üretimi, rotasyonu ve consumer yaşam döngüsü
    • Karmaşık routing: metot değişimi, weighted/canary, circuit breaking, retry politikaları, response aggregation
    • Protokol mediasyonu (REST↔SOAP, REST↔gRPC)
    • Gateway seviyesinde cache politikaları
    • East-west trafik — API Shield yalnızca Cloudflare’den geçen proxy’li HTTP trafiğini görüyor. VPC içi servis-servis çağrılarını hiç görmüyor.
    • Self-hosted veya air-gapped zorunluluğu

    OpenAPI 3.1 kullanıyorsan. Desteklenmiyor ve destekleme planı da yok.

    XML, multipart veya gRPC gövde doğrulaması gerekiyorsa. Yalnızca application/json.

    JWT’yi POST body’de gönderiyorsan.

    Gerçekten büyük body’lerin varsa. Enterprise’da bile 128 KB’de kesiliyor ve üstü sessizce geçiyor.

    Free, Pro veya Business planındaysan ve tespit-sonra-engelle akışını uygulamak istiyorsan. WAF custom rules’ta Log aksiyonu yok — “önce logla, sonra blokla” adımını atlayamıyorsun, doğrudan Block’a geçmen gerekiyor.

    Fiyat öngörülebilirliği arıyorsan. Değerli özelliklerin neredeyse tamamı Enterprise ve fiyat yayımlanmıyor.

    Somut örnekler

    Şema yükleme (henüz aktif değil)

    SRC=$(python3 -c 'import json;print(json.dumps(open("api.yaml").read()))')
    curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/schema_validation/schemas" \
      --request POST --header "Authorization: Bearer $CF_API_TOKEN" \
      --json "{\"kind\":\"openapi_v3\",\"name\":\"demo_sema\",\"source\":$SRC,\"validation_enabled\":false}"

    “By default, uploaded schema evaluation is inactive.”

    Operasyonları envantere ekleme (atlarsan hiçbir şey değerlendirilmiyor)

    yanit="$(curl -sS --fail-with-body \
      ".../zones/$ZONE_ID/api_gateway/user_schemas/$SCHEMA_ID/operations?feature=schema_info&page=1&per_page=20&operation_status=new" \
      -H "Authorization: Bearer $CF_API_TOKEN")"
    ops="$(printf '%s' "$yanit" | jq --exit-status '.result')"
    
    if [ "$(printf '%s' "$ops" | jq 'length')" -eq 0 ]; then
      echo "Yeni operasyon yok."
    else
      curl -sS ".../zones/$ZONE_ID/api_gateway/operations" \
        -H "Authorization: Bearer $CF_API_TOKEN" -H "Content-Type: application/json" --data "$ops"
    fi

    Çağrı başına en fazla 20 operasyon kabul ediyor ve jq gerektiriyor.

    “Uploading through the dashboard adds schema operations automatically. When using the API or Terraform, add schema operations separately.

    Şemayı aktive etme

    curl ".../zones/$ZONE_ID/api_gateway/user_schemas/$SCHEMA_ID" --request PATCH \
      -H "Authorization: Bearer $CF_API_TOKEN" --json '{"validation_enabled": true}'

    “Activation makes uploaded profile evaluation available for configured operations. It does not configure mitigation.

    Engelleme kuralı

    RULESET_ID=$(curl -sS \
      ".../zones/$ZONE_ID/rulesets/phases/http_request_firewall_custom/entrypoint" \
      -H "Authorization: Bearer $CF_API_TOKEN" | jq -r '.result.id')
    
    curl ".../zones/$ZONE_ID/rulesets/$RULESET_ID/rules" --request POST \
      -H "Authorization: Bearer $CF_API_TOKEN" \
      --json '{
        "description": "Sema ihlalleri — POST /v1/siparisler",
        "expression": "cf.schema_validation.uploaded.violated and http.request.method eq \"POST\" and http.host eq \"api.ornek.com.tr\" and http.request.uri.path eq \"/v1/siparisler\"",
        "action": "block",
        "action_parameters": { "response": {
            "status_code": 400,
            "content": "{\"hata\":\"istek API şemasına uymuyor\"}",
            "content_type": "application/json" } }
      }'

    Sinyal birleştirme (resmî örnekler)

    cf.schema_validation.uploaded.violated and cf.bot_management.score lt 10
    cf.schema_validation.learned.violated  and cf.waf.score lt 20

    Bilinmeyen endpoint’leri yakalama

    cf.api_gateway.fallthrough_detected and http.host eq "api.ornek.com.tr"

    Panelde hazır şablonu var: Security rules > Templates > "Mitigate API requests to unidentified endpoints".

    Doğru mTLS kuralı

    http.host eq "api.ornek.com.tr" and
    not (cf.tls_client_auth.cert_verified and
         cf.tls_client_auth.cert_issuer_ski eq "A5AC554235DBA6D963B9CDE0185CFAD6E3F55E9F")

    SKI hash’ini çıkarmak:

    openssl x509 -noout -ext authorityKeyIdentifier -in mtls.crt | tail -n1 | tr -d ': '

    Demo 1: Tespit-sonra-engelle akışını uçtan uca kanıtlamak

    Bu demo, 2026 öncesi her öğreticiyi geçersiz kılan akışı gösteriyor. Resmî sıra:

    “1. Upload a schema. 2. Add the schema operations to the Web Assets inventory. 3. Activate the schema. 4. Send representative traffic. 5. Analyze cf.schema_validation.uploaded.violated in Profile Analysis. 6. Configure mitigation with WAF Custom Rules.”

    Adım 1 — Test şeması

    openapi: "3.0.3"
    info: { title: "Demo API", version: "1.0.0" }
    servers:
      - url: "https://api.ornek.com.tr"      # relative URL desteklenmiyor
    paths:
      /v1/siparisler:
        post:
          operationId: siparisOlustur
          requestBody:
            required: true
            content:
              application/json:              # yalnızca bu doğrulanıyor
                schema:
                  type: object               # 'type' Cloudflare'de ZORUNLU
                  required: [sku, adet]
                  properties:
                    sku:  { type: string, format: uuid }
                    adet: { type: integer, minimum: 1, maximum: 10 }
          responses:
            "201": { description: olusturuldu }
    schema_validation/schemas çağrısının yanıtı ve dönen schema_id

    Yüklemeden önce Swagger Editor ile doğrula — resmî tavsiye.

    Adım 2 — Operasyonları envantere ekle

    api_gateway/operations çağrısının yanıtı ve panelde operasyonların full durumda görünmesi

    Adım 3 — Aktive et

    validation_enabled true değeri ve panelde şemanın aktif göründüğü ekran

    Adım 4 — İhlal üret ve hiçbirinin engellenmediğini göster

    # GEÇERLİ
    curl -i -X POST "https://api.ornek.com.tr/v1/siparisler" -H 'Content-Type: application/json' \
      -d '{"sku":"3f2504e0-4f89-11d3-9a0c-0305e82c3301","adet":2}'
    
    # İHLAL: adet > maximum
    curl -i -X POST "https://api.ornek.com.tr/v1/siparisler" -H 'Content-Type: application/json' \
      -d '{"sku":"3f2504e0-4f89-11d3-9a0c-0305e82c3301","adet":9999}'
    
    # İHLAL: sku uuid değil
    curl -i -X POST "https://api.ornek.com.tr/v1/siparisler" -H 'Content-Type: application/json' \
      -d '{"sku":"uuid-degil","adet":1}'
    
    # İHLAL: zorunlu alan eksik
    curl -i -X POST "https://api.ornek.com.tr/v1/siparisler" -H 'Content-Type: application/json' \
      -d '{"adet":1}'
    
    # DOĞRULANMIYOR: content-type application/json değil
    curl -i -X POST "https://api.ornek.com.tr/v1/siparisler" -H 'Content-Type: application/xml' -d '<x/>'
    Dört ihlal isteğinin de 2xx veya origin hatası döndüğü, hiçbirinin 403 almadığı çıktı

    Adım 5 — Profile Analysis’te incele

    Conforms, Violates ve Not evaluated sayaçları; XML isteğinin Not evaluated olarak göründüğü
    Bir ihlale tıklandığında görünen istek bileşeni ve etkilenen alan bilgisi

    Adım 6 — Kuralı yaz ve farkı göster

    Yukarıdaki block kuralını uygula, sonra Adım 4’ün komutlarını tekrarla.

    Aynı dört ihlal isteğinin 400 döndüğü, geçerli isteğin hâlâ 201 döndüğü çıktı
    Kuralın tetiklendiği olayların listesi ve action alanı

    Adım 7 — Body limitini göster

    Free veya Pro planındaysan, limitin üstünde bir gövdeyle ihlal üret.

    # 2 KB'lik bir gövdeyle ihlal — Free planda (1 KB limiti) doğrulanmaz
    python3 -c 'import json;print(json.dumps({"sku":"uuid-degil","adet":9999,"dolgu":"x"*2000}))' \
      | curl -i -X POST "https://api.ornek.com.tr/v1/siparisler" \
          -H 'Content-Type: application/json' --data-binary @-
    Küçük gövdeli ihlalin 400, büyük gövdeli aynı ihlalin 201 döndüğü karşılaştırma

    Bu demoda ölçülenler:

    ÖlçümŞema yokŞema aktif (tespit)+ WAF kuralı (block)
    Geçerli POST201201201
    adet: 9999origin’e giderorigin’e gider400, engellenir
    sku uuid değilorigin’e giderorigin’e gider400, engellenir
    Zorunlu alan eksikorigin’e giderorigin’e gider400, engellenir
    application/xmlorigin’e giderorigin’e gider (Not evaluated)origin’e gider — kural eşleşmiyor
    Limit üstü gövdeorigin’e giderorigin’e giderorigin’e gider — değerlendirilmiyor
    Envanterde olmayan endpointorigin’e giderNot evaluatedorigin’e gider (fallthrough kuralı yoksa)
    cf.schema_validation.uploaded.violatedalan dolmaztruetrue
    Security Events kaydıyokyokvar

    Demo 2: mTLS’in iptal tuzağını göstermek

    Adım 1 — Client sertifikası oluştur

    openssl req -new -newkey rsa:2048 -nodes -keyout istemci1.key -out istemci1.csr \
      -subj '/C=TR/ST=Istanbul/L=Istanbul/O=DemoOrg/CN=demo-istemci-1'
    
    CSR=$(python3 -c 'import json;print(json.dumps(open("istemci1.csr").read()))')
    curl ".../zones/$ZONE_ID/client_certificates" --request POST \
      -H "Authorization: Bearer $CF_API_TOKEN" \
      --json "{\"csr\":$CSR,\"validity_days\":365}" | tee sertifika.json
    jq -r '.result.certificate' sertifika.json > istemci1.pem
    API yanıtında sertifika ID'si ve panelde Client Certificates listesindeki yeni satır

    Adım 2 — Hostname association (herkesin unuttuğu adım)

    curl ".../zones/$ZONE_ID/certificate_authorities/hostname_associations" --request PUT \
      -H "Authorization: Bearer $CF_API_TOKEN" \
      --json '{"hostnames":["api.ornek.com.tr"]}'
    PUT yanıtı ve GET ile doğrulanan hostname listesi

    Adım 3 — Kural yokken hiçbir şey engellenmediğini göster

    curl -I "https://api.ornek.com.tr/v1/siparisler"     # → 200, sertifikasız
    Sertifikasız isteğin 200 döndüğü çıktı

    Schema Validation’la aynı desen: mTLS’i açmak koruma sağlamıyor, kural sağlıyor.

    Adım 4 — Basit kuralı yaz ve iki durumu göster

    (http.host in {"api.ornek.com.tr"} and not cf.tls_client_auth.cert_verified)
    curl -I --cert istemci1.pem --key istemci1.key https://api.ornek.com.tr/v1/siparisler
    # → HTTP/2 200
    
    curl -I https://api.ornek.com.tr/v1/siparisler
    # → HTTP/2 403
    200 ve 403 yanıtlarının yan yana görüldüğü çıktı

    Adım 5 — 🔴 Sertifikayı iptal et ve tekrar dene

    curl ".../zones/$ZONE_ID/client_certificates/$CERT_ID" --request DELETE \
      -H "Authorization: Bearer $CF_API_TOKEN"
    # durum: pending_revocation → revoked
    
    # İptal edilmiş sertifikayla tekrar dene
    curl -I --cert istemci1.pem --key istemci1.key https://api.ornek.com.tr/v1/siparisler
    Sertifika revoked durumdayken isteğin hâlâ 200 döndüğü çıktı

    Adım 6 — Doğru kuralı yaz

    http.host eq "api.ornek.com.tr" and
    (not cf.tls_client_auth.cert_verified or cf.tls_client_auth.cert_revoked)
    Aynı iptal edilmiş sertifikayla isteğin artık 403 döndüğü çıktı

    Adım 7 — Issuer SKI katmanını ekle

    openssl x509 -noout -ext authorityKeyIdentifier -in istemci1.pem | tail -n1 | tr -d ': '
    http.host eq "api.ornek.com.tr" and
    not (cf.tls_client_auth.cert_verified and
         cf.tls_client_auth.cert_issuer_ski eq "<SKI_HASH>")
    Aynı hesaptaki farklı bir CA'dan alınan geçerli sertifikanın 403 alması

    Adım 8 — Workers’tan alanları oku

    export default {
      async fetch(request) {
        return new Response(JSON.stringify(request.cf.tlsClientAuth, null, 2));
      }
    };
    certPresented ve certVerified değerlerinin üç senaryo için çıktısı

    Beklenen üç sonuç: {"certPresented":"1","certVerified":"SUCCESS"} · {"certPresented":"1","certVerified":"FAILED:self signed certificate"} · {"certPresented":"0","certVerified":"NONE"}

    Rules language’de Boolean, Workers’ta string — tip farkına dikkat.

    Bu demoda ölçülenler:

    SenaryoHost’a bağlı değilBağlı, kural yoknot cert_verified+ or cert_revoked+ cert_issuer_ski
    Sertifikasız200200403403403
    Geçerli sertifika200200200200200
    İptal edilmiş sertifika200200🔴 200 — geçer403403
    Self-signed200200403403403
    Başka CA’nın geçerli sertifikası200200🔴 200 — geçer🔴 200 — geçer403
    BYO CA’da iptalçalışmıyorçalışmıyor (CRL yok)çalışmıyor

    Fiyatlandırma

    Plan tablosu

    PlanKayıtlı endpointYüklenen şemaToplam şema boyutuKural aksiyonu
    Free1005200 kByalnızca Block
    Pro2505500 kByalnızca Block
    Business500102 MByalnızca Block
    Enterprise (API Shield’sız)3.000105 MBLog veya Block
    Enterprise (API Shield’lı)10.00010+10+ MBLog veya Block

    Özellik bazında uygunluk

    ÖzellikUygunluk
    mTLS (Cloudflare CA)tüm planlar, ücretsiz
    Web Assets / Endpoint Management“Available on all plans”
    Endpoint labeling“available to all customers”
    Schema Validationplan limitleriyle Free’den itibaren
    API DiscoveryEnterprise 🔒
    Volumetric Abuse DetectionEnterprise 🔒 + Advanced Rate Limiting ayrı SKU
    Authentication PostureEnterprise + API Shield 🔒
    BOLA tespitiEnterprise 🔒
    Vulnerability ScannerEnterprise + API Shield, open beta, yalnızca API 🔒
    Sequence MitigationEnterprise, closed beta 🔒
    API RoutingEnterprise + API Shield, open beta 🔒
    BYO CAEnterprise, hesap başına 5 CA (Workers mTLS ve Gateway ile paylaşımlı) 🔒
    Sensitive Data DetectionEnterprise Advanced application security + ayrı abonelik 🔒🔒
    JWT validationtüm API Shield müşterileri; Enterprise sözleşmesiz önizleme
    Developer portaltüm API Shield aboneleri

    Diğer doğrulanmış limitler

    LimitDeğer
    Discovery eşiği≥500 istek / 10 gün, 2xx, Worker kaynaklı değil
    Edge’de eşleşen operasyon3.000 / zone
    Etkin şemalardaki toplam operasyon10.000 (Enterprise + API Shield)
    Token configuration / zone4
    Token source / configuration4
    BYO CA / Enterprise hesap5 (paylaşımlı), aşınca hata 1489
    Sequence Analytics uzunluğumaks 9 operasyon
    Sequence mitigation lookback10 istek / 10 dakika
    Sequence kural uzunluğutam olarak 2 operasyon
    Volumetric minimum oturum50 farklı oturum / 24 saat
    BOLA enumeration eşiği10.000 oturum
    Zombie endpoint eşiği32 gün
    Risk tarama periyodu24 saat
    GraphQL parse body limiti20 KB POST, yalnızca /graphql ile biten yollar
    Vulnerability Scanner OpenAPI boyutu128k token ≈ 40–60 kB
    Schema operations bulk API20 operasyon / çağrı
    API Routing yayılma5 dakika

    Lisanslama ve hukuki çerçeve

    Hizmet tescillidir ve Cloudflare Hizmet Şartları’na tabidir.

    BOLA tespitinde oturum kimliği. Cloudflare gizliliği koruyan bir yaklaşım belgeliyor: “The hashed session ID is used for privacy purposes and only as a unique identifier for a specific session. It cannot be un-hashed. It will not match your customer values in your application or database.” Yani saldırı incelemesinde gördüğün oturum kimliği kendi veritabanındaki değerle eşleşmiyor.

    Ama “View attack” ekranından dışa aktarabildiğin .csv dosyası IP adreslerini ve JA4 parmak izlerini içeriyor — bunlar kişisel veri kapsamında değerlendirilebilir. Dışa aktardığın dosyanın saklanması ve paylaşımı senin sorumluluğunda.

    mTLS ve istemci sertifikaları. Cloudflare-managed CA ile üretilen sertifikalar kalıcı olarak silinemiyor: “It is not possible to permanently delete client certificates generated with the default Cloudflare-managed CA. Once revoked, these client certificates will still be listed… and can be restored at any time.” Sertifika envanterin kalıcı bir kayıt oluşturuyor.

    Session identifier ve kişisel veri. Session identifier olarak bir çerez, header veya JWT claim seçiyorsun. JWT claim seçtiysen — örneğin sub — bu değer Cloudflare’in analitik sistemlerine giriyor. Kullanıcı kimliği taşıyan bir claim seçmeden önce bunu değerlendir.

    Sık yapılan hatalar

    Şemayı yükleyip aktive edip “koruma açıldı” sanmak. WAF Custom Rule yazılmadan hiçbir istek engellenmiyor.

    Eski cf.api_gateway.request_violates_schema alanını kullanmak. Deprecated.

    Operasyonları Web Assets envanterine eklemeyi atlamak. API veya Terraform ile şema yüklemek yeterli değil — her istek Not evaluated kalıyor.

    Hostname association’ı atlamak. Client cert üretmek TLS el sıkışmasını değiştirmiyor.

    not cf.tls_client_auth.cert_verified yazıp iptali unutmak. İptal edilmiş sertifika geçiyor.

    Issuer SKI kontrolünü atlamak. “any valid client certificate is accepted regardless of which certificate authority issued it.”

    BYO CA’da iptale güvenmek. CRL kontrol edilmiyor.

    Origin’de wildcard sertifika kullanmak. Desteklenmiyor.

    CNAME target’a mTLS uygulamak. Spesifik hostname’e uygulanmalı.

    Şemada application/* kullanıp “JSON dışı da korunuyor” sanmak. Geçiyor — ve origin MIME sniffing yapıyorsa açık üretiyor.

    Body boyut limitini bilmemek. Free’de 1 KB; üstü sessizce geçiyor.

    Bir operasyonu düzenleyip ID’sinin sabit kaldığını sanmak. Sequence kuralların ve routing kırılıyor.

    hostname_associations PUT’unu artımlı sanmak. Tam listeyi değiştiriyor; boş dizi hepsini siliyor.

    10.000 kayıtlı endpoint’i 10.000 korunan endpoint sanmak. Edge’de 3.000.

    OPTIONS preflight’ları bloklamak. CORS kırılıyor; or http.request.method eq "OPTIONS" ekle.

    JWT claim ile rate limit kurup geçersiz token’ları bloklamamak. “the JWT claims will all be counted and possibly blocked.” Ve herkeste aynı olan bir claim seçersen tek kovada sayılıyorlar.

    Öğrenilmiş profili pozitif güvenlik modeli sanmak. Zorunlu parametre varlığı denetlenmiyor, yeni parametreler ihlal üretmiyor.

    Worker’lı yollarda latency metriği beklemek. Gelmiyor — ve Worker’dan çıkan trafik Discovery eşiğine de sayılmıyor.

    Sıkça sorulan sorular

    Schema Validation'ı açtım, hatalı istekler hâlâ geliyor. Hata mı?
    Hayır, tasarım böyle. Resmî cümle: “The detection does not mitigate traffic by itself.” Schema Validation 2.0 yalnızca cf.schema_validation.uploaded.violated alanını true yapıyor. Engellemek için o alanı kullanan bir WAF Custom Rule yazman gerekiyor. 2026 öncesi yazılmış her öğretici bu noktada yanlış — o dönemde “Endpoint action: Block” diye bir dropdown vardı, artık yok.
    Eski <code>cf.api_gateway.request_violates_schema</code> alanını kullanabilir miyim?
    Hayır. Alan referansı birebir: “This field is deprecated. Use cf.schema_validation.uploaded.violated instead.”
    API Gateway mı, API Shield mi?
    Ürünün adı API Shield. cloudflare.com/application-services/products/api-gateway/ bugün 301 ile API Shield'a yönleniyor. Ama eski ad üç yerde hâlâ yaşıyor ve otomasyonu kırıyor: token yetki adları (Account API Gateway, Domain API Gateway), REST yolları (/zones/{id}/api_gateway/…) ve GraphQL düğümü (apiGatewayGraphqlQueryAnalyticsGroups). Resmî bir yeniden adlandırma duyurusu yok.
    Free planda kullanabilir miyim?
    Kısmen. mTLS her planda ücretsiz. Endpoint Management (yeni adıyla Web Assets) “Available on all plans”. Free'de 100 endpoint, 5 şema ve 200 kB toplam şema yükleyebiliyorsun. Ama Free'de Schema Validation yalnızca 1 KB request body inceliyor ve WAF custom rules'ta Log aksiyonu yok. API Discovery, Volumetric Abuse Detection, BOLA tespiti, Sequence Mitigation, BYO CA ve Vulnerability Scanner'ın hepsi Enterprise.
    İsteklerimin body'si büyük, doğrulanıyor mu?
    Plan başına kesiliyor ve üstü sessizce geçiyor. Free 1 KB · Pro 8 KB · Business 8 KB · Enterprise 128 KB. Birebir: “Requests exceeding this limit are not evaluated against the uploaded schema.” Ve bu, WAF'ın body inceleme limitinden ayrı bir sayı: “Increasing one does not affect the other.” “Kural yazdım ama bazı ihlaller geçiyor” şikayetinin en yaygın sebebi bu.
    10.000 endpoint kaydettim, hepsi korunuyor mu?
    Hayır. Birebir: “Cloudflare currently sends up to 3,000 operations per zone to the edge for matching. Operations in the full state are prioritized first, followed by operations in the candidate state.” Yani Enterprise'da 10.000 kaydedebiliyorsun ama edge'de aynı anda yalnızca 3.000 tanesi eşleşiyor. Bu limit dokümantasyonda başka hiçbir yerde tekrarlanmıyor.
    mTLS kuralımı yazdım ama iptal ettiğim sertifika hâlâ geçiyor.
    Beklenen davranış — ve çoğu öğreticinin atladığı en tehlikeli detay. Alan sayfası birebir: “Returns true when an mTLS client presents a valid client certificate. Also returns true when a client presents a valid certificate that was revoked. Doğru ifade: (not cf.tls_client_auth.cert_verified or cf.tls_client_auth.cert_revoked). BYO CA kullanıyorsan bu bile yetmiyor: “Cloudflare currently does not check certificate revocation lists (CRL) for CAs that have been uploaded.”
    Sertifika oluşturdum ama Cloudflare hiç sertifika istemiyor.
    Hostname association adımını atlamışsın — mTLS'in klasik hatası. Sertifika üretmek TLS el sıkışmasını değiştirmiyor; host'u mTLS'e eklemen gerekiyor. Panelde SSL/TLS → Client Certificates → Hosts → Edit, API'de PUT /zones/{id}/certificate_authorities/hostname_associations. CNAME kullanıyorsan: “It is not enough to have it set on the CNAME target.”
    Endpoint'lerim API Discovery'de görünmüyor.
    Üç şart birden gerekiyor: istek 2xx dönmeli, Worker'dan gelmemeli (“Traffic sent through the Cloudflare traffic simulator or other Worker-based test harnesses will not be counted”) ve endpoint 10 gün içinde en az 500 istek almalı. Ayrıca abonelik hem hesap hem zone seviyesinde aktif olmalı: “If your subscription is active at the account level but not assigned to the zone, Discovery will not run for that zone.”
    OpenAPI 3.1 şemam var, yükleyebilir miyim?
    Hayır. Birebir: “OAS v3.1 is not supported, and there are no plans to expand support for OpenAPI 2.0.” Yalnızca 3.0.x. 3.1'den 3.0'a düşürmen gerekiyor.
    XML API'm korunur mu?
    Hayır. Schema Validation yalnızca application/json doğruluyor. Şemanda application/* yazarsan XML istekleri doğrulanmadan geçiyor: “Requests with content-type application/xml (and others matching application/*) will be let through.” Cloudflare kendi örneğinde application/malicious content-type'ıyla gelen bir JSON body'nin doğrulanmadan geçeceğini de anlatıyor — origin'inde MIME sniffing kapalı olmalı.
    JWT'yi POST body'de gönderiyorum, çalışır mı?
    Hayır. Birebir: “JWT validation only operates on JWTs sent in client request headers or cookies. If your clients send JWTs in a POST body, contact your account team.”
    Rate limit önerilerini görüyorum ama uygulayamıyorum.
    İki ayrı ürün. Birebir: “API Shield will always calculate recommendations when session identifiers are configured. To enable session-based rate limits, subscribe to Advanced Rate Limiting. Header, cookie veya JSON alan bazlı sayım, Rate Limiting uygunluk tablosunda yalnızca “Enterprise with Advanced Rate Limiting” sütununda var.
    API Shield'ı Kong veya Apigee yerine kullanabilir miyim?
    Güvenlik katmanı olarak evet, gateway olarak hayır. Dokümantasyonun tamamında (323 KB) şu kelimeler sıfır kez geçiyor: monetization, versioning, request transformation, response transformation, caching, canary, circuit break, aggregation. API Routing metot bile değiştiremiyor (“You cannot change the method of a request”) ve hâlâ open beta. Developer portal ise Cloudflare Pages üzerinde bir Redoc statik sitesi — API key yönetimi veya kota yok.

    İlgili servisler

    • WAFSQL injection, XSS ve bilinen zafiyet istismarlarını request origin’e ulaşmadan engeller.
    • Rate LimitingIP, oturum veya özel anahtara göre request sayısını sınırlar.
    • SSL/TLSÜcretsiz sertifika sağlar ve tarayıcı ile Cloudflare arasındaki şifrelemeyi yönetir.
    • Bot ManagementHer request’e bot skoru verir; kazıyıcı, kimlik doldurma ve stok kapma trafiğini ayırır.

    Bu sayfadaki fiyat ve özellik bilgileri 1 Eylül 2026 tarihinde Cloudflare’in resmî kaynaklarından doğrulanmıştır. Cloudflare fiyatlandırmasını önceden haber vermeden değiştirebilir; bağlayıcı bilgi içinresmî sayfaya bakın.

    Hata bildir

    Yanlış bir rakam, eskimiş bir bilgi veya bozuk bir bağlantı mı buldun? Bildir, kaynağıyla birlikte kontrol edelim.