swarmauri_middleware_securityheaders 0.8.0.dev4__tar.gz → 0.8.0.dev33__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,122 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_middleware_securityheaders
3
+ Version: 0.8.0.dev33
4
+ Summary: Middleware for adding security headers to HTTP responses
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,sdk,standards,middleware,securityheaders,security
8
+ Author: Jacob Stewart
9
+ Author-email: jacob@swarmauri.com
10
+ Requires-Python: >=3.10,<3.13
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Natural Language :: English
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Development Status :: 3 - Alpha
18
+ Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Requires-Dist: fastapi
22
+ Requires-Dist: swarmauri_base
23
+ Requires-Dist: swarmauri_core
24
+ Requires-Dist: swarmauri_standard
25
+ Description-Content-Type: text/markdown
26
+
27
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
28
+
29
+ <p align="center">
30
+ <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
31
+ <img src="https://img.shields.io/pypi/dm/swarmauri-middleware-securityheaders" alt="PyPI - Downloads"/>
32
+ </a>
33
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_securityheaders/">
34
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_securityheaders.svg"/>
35
+ </a>
36
+ <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
37
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri-middleware-securityheaders" alt="PyPI - Python Version"/>
38
+ </a>
39
+ <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
40
+ <img src="https://img.shields.io/pypi/l/swarmauri-middleware-securityheaders" alt="PyPI - License"/>
41
+ </a>
42
+ <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
43
+ <img src="https://img.shields.io/pypi/v/swarmauri-middleware-securityheaders?label=swarmauri-middleware-securityheaders&color=green" alt="PyPI - swarmauri-middleware-securityheaders"/>
44
+ </a>
45
+ </p>
46
+
47
+ ---
48
+
49
+ # Swarmauri Middleware Security Headers
50
+
51
+ Middleware for adding security-focused HTTP headers to FastAPI responses, helping shield applications from common web vulnerabilities.
52
+
53
+ ## What it does
54
+
55
+ `SecurityHeadersMiddleware` ensures every response produced by your FastAPI
56
+ application carries the following headers and values:
57
+
58
+ - `Content-Security-Policy`: `default-src 'self'; script-src 'self'
59
+ https://cdn.example.com; style-src 'self' https://cdn.example.com; img-src
60
+ 'self' https://images.example.com; font-src 'self'
61
+ https://fonts.example.com`
62
+ - `X-Content-Type-Options`: `nosniff`
63
+ - `X-Frame-Options`: `DENY`
64
+ - `X-XSS-Protection`: `1; mode=block`
65
+ - `Strict-Transport-Security`: `max-age=31536000; includeSubDomains; preload`
66
+ - `Referrer-Policy`: `same-origin`
67
+ - `Permissions-Policy`: `interest-cohort=(), geolocation=(self),
68
+ microphone=(), camera=(), magnetometer=(), gyroscope=(), speaker=(self),
69
+ vibrate=(), payment=()`
70
+
71
+ These defaults provide a strong baseline for many applications. Update the
72
+ middleware if you need to tailor the directives (for example, to change the
73
+ allowed host names in the Content Security Policy).
74
+
75
+ ## Installation
76
+
77
+ ### pip
78
+
79
+ ```bash
80
+ pip install swarmauri-middleware-securityheaders
81
+ ```
82
+
83
+ ### Poetry
84
+
85
+ ```bash
86
+ poetry add swarmauri_middleware_securityheaders
87
+ ```
88
+
89
+ ### uv
90
+
91
+ ```bash
92
+ uv add swarmauri_middleware_securityheaders
93
+ ```
94
+
95
+ ## Usage
96
+
97
+ ```python
98
+ from fastapi import FastAPI, Request
99
+ from swarmauri_middleware_securityheaders import SecurityHeadersMiddleware
100
+
101
+ app = FastAPI()
102
+ security_middleware = SecurityHeadersMiddleware(app)
103
+
104
+
105
+ @app.middleware("http")
106
+ async def apply_security_headers(request: Request, call_next):
107
+ return await security_middleware.dispatch(request, call_next)
108
+
109
+
110
+ @app.get("/")
111
+ async def read_root() -> dict[str, str]:
112
+ return {"status": "ok"}
113
+ ```
114
+
115
+ This pattern instantiates the middleware once and reuses its `dispatch` method
116
+ within FastAPI's `@app.middleware("http")` hook so that every response includes
117
+ the security headers listed above.
118
+
119
+ ## Want to help?
120
+
121
+ If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md) that will help you get started.
122
+
@@ -0,0 +1,95 @@
1
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
2
+
3
+ <p align="center">
4
+ <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
5
+ <img src="https://img.shields.io/pypi/dm/swarmauri-middleware-securityheaders" alt="PyPI - Downloads"/>
6
+ </a>
7
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_securityheaders/">
8
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_securityheaders.svg"/>
9
+ </a>
10
+ <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
11
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri-middleware-securityheaders" alt="PyPI - Python Version"/>
12
+ </a>
13
+ <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
14
+ <img src="https://img.shields.io/pypi/l/swarmauri-middleware-securityheaders" alt="PyPI - License"/>
15
+ </a>
16
+ <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
17
+ <img src="https://img.shields.io/pypi/v/swarmauri-middleware-securityheaders?label=swarmauri-middleware-securityheaders&color=green" alt="PyPI - swarmauri-middleware-securityheaders"/>
18
+ </a>
19
+ </p>
20
+
21
+ ---
22
+
23
+ # Swarmauri Middleware Security Headers
24
+
25
+ Middleware for adding security-focused HTTP headers to FastAPI responses, helping shield applications from common web vulnerabilities.
26
+
27
+ ## What it does
28
+
29
+ `SecurityHeadersMiddleware` ensures every response produced by your FastAPI
30
+ application carries the following headers and values:
31
+
32
+ - `Content-Security-Policy`: `default-src 'self'; script-src 'self'
33
+ https://cdn.example.com; style-src 'self' https://cdn.example.com; img-src
34
+ 'self' https://images.example.com; font-src 'self'
35
+ https://fonts.example.com`
36
+ - `X-Content-Type-Options`: `nosniff`
37
+ - `X-Frame-Options`: `DENY`
38
+ - `X-XSS-Protection`: `1; mode=block`
39
+ - `Strict-Transport-Security`: `max-age=31536000; includeSubDomains; preload`
40
+ - `Referrer-Policy`: `same-origin`
41
+ - `Permissions-Policy`: `interest-cohort=(), geolocation=(self),
42
+ microphone=(), camera=(), magnetometer=(), gyroscope=(), speaker=(self),
43
+ vibrate=(), payment=()`
44
+
45
+ These defaults provide a strong baseline for many applications. Update the
46
+ middleware if you need to tailor the directives (for example, to change the
47
+ allowed host names in the Content Security Policy).
48
+
49
+ ## Installation
50
+
51
+ ### pip
52
+
53
+ ```bash
54
+ pip install swarmauri-middleware-securityheaders
55
+ ```
56
+
57
+ ### Poetry
58
+
59
+ ```bash
60
+ poetry add swarmauri_middleware_securityheaders
61
+ ```
62
+
63
+ ### uv
64
+
65
+ ```bash
66
+ uv add swarmauri_middleware_securityheaders
67
+ ```
68
+
69
+ ## Usage
70
+
71
+ ```python
72
+ from fastapi import FastAPI, Request
73
+ from swarmauri_middleware_securityheaders import SecurityHeadersMiddleware
74
+
75
+ app = FastAPI()
76
+ security_middleware = SecurityHeadersMiddleware(app)
77
+
78
+
79
+ @app.middleware("http")
80
+ async def apply_security_headers(request: Request, call_next):
81
+ return await security_middleware.dispatch(request, call_next)
82
+
83
+
84
+ @app.get("/")
85
+ async def read_root() -> dict[str, str]:
86
+ return {"status": "ok"}
87
+ ```
88
+
89
+ This pattern instantiates the middleware once and reuses its `dispatch` method
90
+ within FastAPI's `@app.middleware("http")` hook so that every response includes
91
+ the security headers listed above.
92
+
93
+ ## Want to help?
94
+
95
+ If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md) that will help you get started.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "swarmauri_middleware_securityheaders"
3
- version = "0.8.0.dev4"
3
+ version = "0.8.0.dev33"
4
4
  description = "Middleware for adding security headers to HTTP responses"
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
@@ -14,6 +14,9 @@ classifiers = [
14
14
  "Programming Language :: Python :: 3.12",
15
15
  "Programming Language :: Python :: 3.13",
16
16
  "Development Status :: 3 - Alpha",
17
+ "Programming Language :: Python",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3 :: Only",
17
20
  ]
18
21
  authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
19
22
  dependencies = [
@@ -22,6 +25,14 @@ dependencies = [
22
25
  "swarmauri_base",
23
26
  "swarmauri_standard",
24
27
  ]
28
+ keywords = [
29
+ 'swarmauri',
30
+ 'sdk',
31
+ 'standards',
32
+ 'middleware',
33
+ 'securityheaders',
34
+ 'security',
35
+ ]
25
36
 
26
37
  [tool.uv.sources]
27
38
  swarmauri_core = { workspace = true }
@@ -34,6 +45,7 @@ markers = [
34
45
  "test: standard test",
35
46
  "unit: Unit tests",
36
47
  "i9n: Integration tests",
48
+ "example: Documentation-backed examples",
37
49
  "r8n: Regression tests",
38
50
  "timeout: mark test to timeout after X seconds",
39
51
  "xpass: Expected passes",
@@ -1,46 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: swarmauri_middleware_securityheaders
3
- Version: 0.8.0.dev4
4
- Summary: Middleware for adding security headers to HTTP responses
5
- License: Apache-2.0
6
- Author: Jacob Stewart
7
- Author-email: jacob@swarmauri.com
8
- Requires-Python: >=3.10,<3.13
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Natural Language :: English
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Programming Language :: Python :: 3.13
15
- Classifier: Development Status :: 3 - Alpha
16
- Requires-Dist: fastapi
17
- Requires-Dist: swarmauri_base
18
- Requires-Dist: swarmauri_core
19
- Requires-Dist: swarmauri_standard
20
- Description-Content-Type: text/markdown
21
-
22
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
23
-
24
- <p align="center">
25
- <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
26
- <img src="https://img.shields.io/pypi/dm/swarmauri-middleware-securityheaders" alt="PyPI - Downloads"/></a>
27
- <a href="https://github.com/swarmauri/swarmauri-sdk/pkgs/pkgs/swarmauri-middleware-securityheaders">
28
- <img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https://github.com/swarmauri/swarmauri-sdk/pkgs/pkgs/swarmauri-middleware-securityheaders&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false" alt="GitHub Hits"/></a>
29
- <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
30
- <img src="https://img.shields.io/pypi/pyversions/swarmauri-middleware-securityheaders" alt="PyPI - Python Version"/></a>
31
- <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
32
- <img src="https://img.shields.io/pypi/l/swarmauri-middleware-securityheaders" alt="PyPI - License"/></a>
33
- <br />
34
- <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
35
- <img src="https://img.shields.io/pypi/v/swarmauri-middleware-securityheaders?label=swarmauri-middleware-securityheaders&color=green" alt="PyPI - swarmauri-middleware-securityheaders"/></a>
36
- </p>
37
-
38
- ---
39
-
40
- # `swarmauri-middleware-securityheaders`
41
-
42
- A middleware library for adding security headers to HTTP responses in FastAPI applications. This middleware helps protect against common web vulnerabilities by setting appropriate security headers.
43
-
44
- ## Installation
45
-
46
- To install the package, use pip:
@@ -1,25 +0,0 @@
1
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
2
-
3
- <p align="center">
4
- <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
5
- <img src="https://img.shields.io/pypi/dm/swarmauri-middleware-securityheaders" alt="PyPI - Downloads"/></a>
6
- <a href="https://github.com/swarmauri/swarmauri-sdk/pkgs/pkgs/swarmauri-middleware-securityheaders">
7
- <img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https://github.com/swarmauri/swarmauri-sdk/pkgs/pkgs/swarmauri-middleware-securityheaders&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false" alt="GitHub Hits"/></a>
8
- <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
9
- <img src="https://img.shields.io/pypi/pyversions/swarmauri-middleware-securityheaders" alt="PyPI - Python Version"/></a>
10
- <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
11
- <img src="https://img.shields.io/pypi/l/swarmauri-middleware-securityheaders" alt="PyPI - License"/></a>
12
- <br />
13
- <a href="https://pypi.org/project/swarmauri-middleware-securityheaders/">
14
- <img src="https://img.shields.io/pypi/v/swarmauri-middleware-securityheaders?label=swarmauri-middleware-securityheaders&color=green" alt="PyPI - swarmauri-middleware-securityheaders"/></a>
15
- </p>
16
-
17
- ---
18
-
19
- # `swarmauri-middleware-securityheaders`
20
-
21
- A middleware library for adding security headers to HTTP responses in FastAPI applications. This middleware helps protect against common web vulnerabilities by setting appropriate security headers.
22
-
23
- ## Installation
24
-
25
- To install the package, use pip: