Skip to content

Commit 3a580f2

Browse files
author
cak
committed
Add middleware examples and update in README
- Add middleware examples for supported frameworks in docs/frameworks.md - Add Ruff badge to README - Update CSP example in README with `unsafe-inline` support
1 parent f58092c commit 3a580f2

2 files changed

Lines changed: 272 additions & 140 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ _A simple, yet powerful way to secure your Python web applications across multip
44

55
[![PyPI Version](https://img.shields.io/pypi/v/secure.svg)](https://pypi.org/project/secure/)
66
[![Python Versions](https://img.shields.io/pypi/pyversions/secure.svg)](https://pypi.org/project/secure/)
7+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
78
[![Downloads](https://pepy.tech/badge/secure)](https://pepy.tech/project/secure)
89
[![License](https://img.shields.io/pypi/l/secure.svg)](https://github.com/TypeError/secure/blob/main/LICENSE)
910
[![GitHub Stars](https://img.shields.io/github/stars/TypeError/secure.svg)](https://github.com/TypeError/secure/stargazers)
@@ -180,7 +181,7 @@ csp = (
180181
secure.ContentSecurityPolicy()
181182
.default_src("'self'")
182183
.script_src("'self'", "cdn.example.com")
183-
.style_src("'self'", "cdn.example.com")
184+
.style_src("'unsafe-inline'")
184185
.img_src("'self'", "images.example.com")
185186
.connect_src("'self'", "api.example.com")
186187
)
@@ -192,7 +193,7 @@ secure_headers = secure.Secure(csp=csp)
192193
**Resulting HTTP headers:**
193194

194195
```http
195-
Content-Security-Policy: default-src 'self'; script-src 'self' cdn.example.com; style-src 'self' cdn.example.com; img-src 'self' images.example.com; connect-src 'self' api.example.com
196+
Content-Security-Policy: default-src 'self'; script-src 'self' cdn.example.com; style-src 'unsafe-inline'; img-src 'self' images.example.com; connect-src 'self' api.example.com
196197
```
197198

198199
### **Permissions-Policy Example**

0 commit comments

Comments
 (0)