Mozilla Public License 2.0

项目介绍

wallarm/api-firewall 是一个托管在 GitHub 上的开源项目,主要使用 Go 编写,采用 Mozilla Public License 2.0 许可证,目前获得 654 个 Star、62 次 Fork。

仓库全名
wallarm/api-firewall
开源许可证
Mozilla Public License 2.0
Star 数
654
Fork 数
62
未关闭 Issue
7

README 摘要

API Firewall is a high-performance proxy with API request and response validation based on OpenAPI and GraphQL schemas. It is designed to protect REST and GraphQL API endpoints in cloud-native environments. API Firewall provides API hardening with the use of a positive security model allowing calls that match a predefined API specification for requests and responses, while rejecting everything else. The key features…

完整内容见 GitHub 原始 README 或本页 。

常见问题

api-firewall 用什么语言开发?

主要使用 Go 编写,采用 Mozilla Public License 2.0 许可证,目前有 654 个 Star。

api-firewall 可以免费商用吗?

仓库标注的许可证为 Mozilla Public License 2.0,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 api-firewall 的源码?

可以直接克隆仓库:git clone https://github.com/wallarm/api-firewall.git,默认分支为 main;安装与运行步骤见仓库 README。

api-firewall 最近还在维护吗?

仓库最近一次更新为 4月4日,当前有 7 个未关闭 Issue;Star 数为 654,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Fast and light-weight API proxy firewall for request and response validation by OpenAPI specs.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

CSS
Dockerfile
Go
Go Template
HTML
JavaScript
Makefile
Shell

README

Open Source API Firewall by Wallarm Black Hat Arsenal USA 2022

API Firewall is a high-performance proxy with API request and response validation based on OpenAPI and GraphQL schemas. It is designed to protect REST and GraphQL API endpoints in cloud-native environments. API Firewall provides API hardening with the use of a positive security model allowing calls that match a predefined API specification for requests and responses, while rejecting everything else.

The key features of API Firewall are:

  • Secure REST and GraphQL API endpoints by blocking malicious requests
  • Stop API data breaches by blocking malformed API responses
  • Discover Shadow API endpoints
  • Validate JWT access tokens for OAuth 2.0 protocol-based authentication
  • Denylist compromised API tokens, keys, and Cookies
  • AllowIPList - Restrict access to endpoints by defining a list of allowed IP addresses
  • Wide Range Attacks Protection: The API Firewall supports ModSecurity Rules and OWASP ModSecurity Core Rule Set

The product is open source, available at DockerHub and already got 1 billion (!!!) pulls. To support this project, you can star the repository.

Operating modes

Wallarm API Firewall offers several operating modes:

  • PROXY: validates HTTP requests and responses against OpenAPI 3.0 and proxies matching requests to the backend.
  • API: validates individual requests against OpenAPI 3.0 without further proxying.
  • graphql: validates HTTP and WebSocket requests against GraphQL schema and proxies matching requests to the backend.

Use cases

Running in blocking mode

  • Block malicious requests that do not match the specification
  • Block malformed API responses to stop data breaches and sensitive information exposure

Running in monitoring mode

  • Discover Shadow APIs and undocumented API endpoints
  • Log malformed requests and responses that do not match the specification

API schema validation and positive security model

When starting API Firewall, you should provide the REST or GraphQL API specification of the application to be protected with API Firewall. The started API Firewall will operate as a reverse proxy and validate whether requests and responses match the schema defined in the specification.

The traffic that does not match the schema will be logged using the STDOUT and STDERR Docker services or blocked (depending on the configured API Firewall operation mode). When operating in the logging mode on REST API, API Firewall also logs so-called shadow API endpoints, those that are not covered in API specification but respond to requests (except for endpoints returning the code 404).

API Firewall scheme

By allowing you to set the traffic requirements with the API specification, API Firewall relies on a positive security model.

Technical data

API Firewall works as a reverse proxy with a built-in OpenAPI 3.0 or GraphQL request and response validator. It is written in Golang and using fasthttp proxy. The project is optimized for extreme performance and near-zero added latency.

During the processing of incoming requests, the API Firewall recognizes a range of Content-Type header values, including:

  • application/json
  • application/xml
  • application/octet-stream
  • application/x-www-form-urlencoded
  • application/x-yaml
  • application/yaml
  • application/zip
  • multipart/form-data
  • text/csv
  • text/plain
  • +json structured syntax suffixes
  • +xml structured syntax suffixes
  • +yaml structured syntax suffixes
  • +csv structured syntax suffixes

Starting API Firewall

To download, install, and start API Firewall on Docker, refer to:

Demos

You can try API Firewall by running the demo environment that deploys an example application protected with API Firewall. There are two available demo environments:

Performance

When creating API Firewall, we prioritized speed and efficiency to ensure that our customers would have the fastest APIs possible. Our latest tests demonstrate that the average time required for API Firewall to process one request is 1.339 ms which is 66% faster than Nginx:

API Firewall 0.6.2 with JSON validation

$ ab -c 200 -n 10000 -p ./large.json -T application/json http://127.0.0.1:8282/test/signup

Requests per second:    13005.81 [#/sec] (mean)
Time per request:       15.378 [ms] (mean)
Time per request:       0.077 [ms] (mean, across all concurrent requests)

NGINX 1.18.0 without JSON validation

$ ab -c 200 -n 10000 -p ./large.json -T application/json http://127.0.0.1/test/signup

Requests per second:    7887.76 [#/sec] (mean)
Time per request:       25.356 [ms] (mean)
Time per request:       0.127 [ms] (mean, across all concurrent requests)

These performance results are not the only ones we have got during API Firewall testing. Other results along with the methods used to improve API Firewall performance are described in this Wallarm’s blog article.

评论

暂无评论