|
| 1 | +[繁中版](./README-tw.md) | [簡中版](./README-zh.md) | [Português (Brasil)](./README-pt_BR.md) | [Français](./README-fr.md) | [한국어](./README-ko.md) | [Nederlands](./README-nl.md) | [Indonesia](./README-id.md) | [ไทย](./README-th.md) | [Русский](./README-ru.md) | [Українська](./README-uk.md) | [Español](./README-es.md) | [Italiano](./README-it.md) | [日本語](./README-ja.md) | [Deutsch](./README-de.md) | [Türkçe](./README-tr.md) | [Tiếng Việt](./README-vi.md) | [Монгол](./README-mn.md) | [हिंदी](./README-hi.md) | [العربية](./README-ar.md) | [Македонски](.README-mk.md) |
| 2 | + |
| 3 | +# API Безбедносна контролна листа |
| 4 | +Безбедносна контролна листа од најважните безбедносни контрамерки при дизајнирање, тестирање и пуштање во употреба на вашето API. |
| 5 | +--- |
| 6 | + |
| 7 | +## Автентикација |
| 8 | +- [ ] Не користете `Basic Auth` Користете стандардна автентикација (п.р. [JWT](https://jwt.io/), [OAuth](https://oauth.net/)). |
| 9 | +- [ ] Не измислувајте топла вода за `Authentication`,` generation token `, `password storage`. Користете ги стандардите. |
| 10 | +- [ ] Користете `Max Retry` и затворските функции во Login. |
| 11 | +- [ ] Користете енкрипција на сите чувствителни податоци. |
| 12 | + |
| 13 | +### JWT (JSON Web Token) |
| 14 | +- [ ] Користете случајно генериран и комплициран клуч (`JWT Secret`) за да направите што можно потешко погодување на токенот со испробување на секоја можна комбинација |
| 15 | +- [ ] Don't extract the algorithm from the payload. Force the algorithm in the backend (`HS256` or `RS256`). |
| 16 | +- [ ] Направете токенот да истече (`TTL`, `RTTL`) што е можно побрзо . |
| 17 | +- [ ] Не чувајте чувствителни податоци во JWR payload, може да се декодира [лесно](https://jwt.io/#debugger-io). |
| 18 | + |
| 19 | +### OAuth |
| 20 | +- [ ] Секогаш проверувајте ја `redirect_uri` од страна на серверот за да дозволите само бела листа на адреси. |
| 21 | +- [ ]Секогаш обидувајте се да разменувате за код, а не токени (не дозволувајте `response_type = token`). |
| 22 | +- [ ] Користете го параметрот `state` со случаен хаш за да го спречите CSRF за процесот на автентикација на OAuth. |
| 23 | +- [ ] Дефинирајте го основниот опсег и проверете ги параметрите на опсегот за секоја апликација. |
| 24 | + |
| 25 | +## Пристап |
| 26 | +- [ ] Ограничете ги барањата (забавување) за да избегнете напади DDoS / brute-force. |
| 27 | +- [ ] Користете HTTPS на страната на серверот за да избегнете MITM (Man In The Middle Attack). |
| 28 | +- [ ] Користете `HSTS` насловот со SSL за да избегнете SSL Strip напад. |
| 29 | + |
| 30 | +## Влез |
| 31 | +- [ ] Користете ја соодветната HTTP-метод според операцијата: "GET (read)", "POST (создади)", "PUT / PATCH (замени / ажурирај)" и "DELETE (за бришење на запис) 405 Метод не е дозволено` ако бараниот метод не е соодветен за бараниот ресурс. |
| 32 | +- [ ] Потврдете `content-type` на барање Accept header (Content Negotiation) за да го дозволите само вашиот поддржан формат (на пр.`application/xml`, `application/json`, etc) И да одговори со 406 Not Acceptable` одговор ако не се совпаѓа. |
| 33 | +- [ ] Потврдете ги `content-type` на објавените податоци што ги прифаќате (на пр., `application/x-www-form-urlencoded`, `multipart/form-data`, `application/json`, итн.). |
| 34 | +- [ ] Потврдете го корисничкиот влез за да избегнете вообичаени слабости (e.g. `XSS`, `SQL-Injection`, `Remote Code Execution`, etc). |
| 35 | +- [ ] Не користете чувствителни податоци(`credentials`, `Passwords`, `security tokens`, или `API keys`) во URL-то, но користете стандарден заглавие за авторизација. |
| 36 | +- [ ] Користете API Gateway-услуга за да овозможите кеширање, политики за ограничување на тарифите (пр. `Quota`, `Spike Arrest`, `Concurrent Rate Limit`) и динамички да ги распоредите ресурсите за API-то. |
| 37 | + |
| 38 | +## Processing |
| 39 | +- [ ] Check if all the endpoints are protected behind authentication to avoid broken authentication process. |
| 40 | +- [ ] User own resource ID should be avoided. Use `/me/orders` instead of `/user/654321/orders`. |
| 41 | +- [ ] Don't auto-increment IDs. Use `UUID` instead. |
| 42 | +- [ ] If you are parsing XML files, make sure entity parsing is not enabled to avoid `XXE` (XML external entity attack). |
| 43 | +- [ ] If you are parsing XML files, make sure entity expansion is not enabled to avoid `Billion Laughs/XML bomb` via exponential entity expansion attack. |
| 44 | +- [ ] Use a CDN for file uploads. |
| 45 | +- [ ] If you are dealing with huge amount of data, use Workers and Queues to process as much as possible in background and return response fast to avoid HTTP Blocking. |
| 46 | +- [ ] Do not forget to turn the DEBUG mode OFF. |
| 47 | + |
| 48 | +## Output |
| 49 | +- [ ] Send `X-Content-Type-Options: nosniff` header. |
| 50 | +- [ ] Send `X-Frame-Options: deny` header. |
| 51 | +- [ ] Send `Content-Security-Policy: default-src 'none'` header. |
| 52 | +- [ ] Remove fingerprinting headers - `X-Powered-By`, `Server`, `X-AspNet-Version` etc. |
| 53 | +- [ ] Force `content-type` for your response, if you return `application/json` then your response `content-type` is `application/json`. |
| 54 | +- [ ] Don't return sensitive data like `credentials`, `Passwords`, `security tokens`. |
| 55 | +- [ ] Return the proper status code according to the operation completed. (e.g. `200 OK`, `400 Bad Request`, `401 Unauthorized`, `405 Method Not Allowed`, etc). |
| 56 | + |
| 57 | +## CI & CD |
| 58 | +- [ ] Audit your design and implementation with unit/integration tests coverage. |
| 59 | +- [ ] Use a code review process and disregard self-approval. |
| 60 | +- [ ] Ensure that all components of your services are statically scanned by AV software before push to production, including vendor libraries and other dependencies. |
| 61 | +- [ ] Design a rollback solution for deployments. |
| 62 | + |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## See also: |
| 67 | +- [yosriady/api-development-tools](https://github.com/yosriady/api-development-tools) - A collection of useful resources for building RESTful HTTP+JSON APIs. |
| 68 | + |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +# Contribution |
| 73 | +Feel free to contribute by forking this repository, making some changes, and submitting pull requests. For any questions drop us an email at `team@shieldfy.io`. |
0 commit comments