API Specification Enforcement Setup
¶
Bu makale, yüklenen API specification dosyanıza dayalı API korumanızı nasıl etkinleştireceğinizi ve yapılandıracağınızı açıklar.
Adım 1: Specification Yükleme¶
-
US Cloud veya EU Cloud üzerindeki API Specifications bölümünde Upload specification düğmesine tıklayın.
-
Specification yükleme parametrelerini ayarlayın ve yüklemeyi başlatın.
Specification dosyası başarıyla yüklenene kadar API specification enforcement yapılandırmasına başlayamayacağınızı unutmayın.
Adım 2: Politika İhlallerinde Alınacak Aksiyonları Belirleme¶
-
API specification enforcement sekmesine tıklayın.
Rogue API detection
- Güvenlik politikalarını uygulamanın yanı sıra, specification'lar API Discovery modülü tarafından rogue API detection için de kullanılabilir. API Discovery etkinse bu sekme görüntülenir.
- Specification'ı güvenlik politikalarını uygulamak için kullanmadan önce, API Discovery ile rogue (gölge, zombi ve yetimsiz) API'leri aramak için kullanmanız tavsiye edilir. Böylece specification'ınızın müşterilerinizin asıl isteklerinden ne kadar farklı olduğunu anlayabilir; bu farklılıklar, güvenlik politikaları uygulandıktan sonra ilgili isteklerin engellenmesine yol açabilir.
-
Use for API specification enforcement seçeneğini seçin.
-
Politika ihlali aksiyonlarını etkinleştirmek istediğiniz host veya endpoint'i belirtin.
- Yüklenen specification'ın uygulanacağı endpoint'leri yanlış belirtirseniz, birçok false positive olayı ortaya çıkabilir.
- Aynı host için birden fazla specification'a sahipseniz, ancak bunlar farklı endpoint'ler için geçerliyse (örneğin
domain.com/v1/api/users/
vedomain.com/v1/api/orders/
), specification'ın hangi endpointlere uygulanacağını belirtmeniz gerekmektedir. - Bir host'a bir specification ekleyip sonra bu host'un belirli endpointlerine ayrı bir specification eklediğinizde, her iki specification da bu endpointlere uygulanacaktır.
- Bu değer, URI constructor veya advanced edit form aracılığıyla yapılandırılabilir.
-
İstekler specification'ınızı ihlal ederse sistemin nasıl tepki vereceğini ayarlayın.
Olası ihlallerle ilgili ayrıntılar:
- Requesting an undefined endpoint - a request targets the endpoint not presented in your specification
- Requesting endpoint with undefined parameter - a request contains the parameter not presented for this endpoint in your specification
- Requesting endpoint without required parameter - a request does not contain the parameter or its value that are marked as required in your specification
- Requesting endpoint with invalid parameter value - a request parameter's value in not in correspondence with its type/format defined by your specification
- Requesting endpoint without authentication method - a request does not contain the information about the authentication method
- Requesting endpoint with invalid JSON - a request contains an invalid JSON
The system can perform the following actions in case of found inconsistency:
-
Block - block a request and put in the Attacks section as blocked
Filtration mode
The Wallarm node will block requests only when the blocking filtration mode is enabled for target endpoint - otherwise, Monitor action will be performed.
-
Monitor - mark a request as incorrect, but do not block, put it in the Attacks section as monitored
- Not tracked - do nothing
Note that several specifications can be used for setting policies. In case when one request falls on two different specifications (the same policy and different actions in different specifications), the following will happen:
- Block and Block - the request will be blocked and two events will be added to the Attacks section with status
Blocked
pointing at the reason of blocking and at the fact that the request violated two different specifications. - Monitor and Block - the request will be blocked and one event will be added to the Attacks section with status
Blocked
explaining the reason of blocking. - Monitor and Monitor - the request will not be blocked and two events will be added to the Attacks section with status
Monitoring
pointing at the fact that specific policy was violated.
Specification'ı ilk kez güvenlik politikaları belirlemek için kullanırken, specification'ın gerekli endpointlerde uygulandığından ve gerçek hataları tespit ettiğinden emin olmak için tepki olarak Monitor
seçeneğinin ayarlanması tavsiye edilir.
Devre Dışı Bırakma¶
API Specification Enforcement, Use for API specification enforcement seçeneği etkin olan yüklenen veya birden fazla specification'a dayanmaktadır. Bu seçeneğin bazı specification'lar için kaldırılması veya bir specification'ın silinmesi, bu specification'a dayalı korumanın sonlandırılmasına yol açar.
Ayrıca, API Specification Enforcement işlevselliğini API'nizin sadece belirli bölümleri için devre dışı bırakmanız gerektiğinde şu yöntemlerden yararlanabilirsiniz:
-
all-in-one installer dağıtımları için, API Specification Enforcement'ın
wallarm_enable_apifw
NGINX yönergesininoff
olarak ayarlandığı herhangi birserver
bölümünde. -
NGINX tabanlı Docker görüntüsü için,
WALLARM_APIFW_ENABLE
environment variable değerininfalse
olarak ayarlanması. -
NGINX Ingress Controller için,
enable
değerifalse
olarak ayarlanmışcontroller.wallarm.apifirewall
değerler grubunun kullanılması.