sentrycove 0.2.1__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.
Files changed (37) hide show
  1. sentrycove-0.2.1/.gitignore +24 -0
  2. sentrycove-0.2.1/CHANGELOG.md +48 -0
  3. sentrycove-0.2.1/LICENSE +202 -0
  4. sentrycove-0.2.1/PKG-INFO +238 -0
  5. sentrycove-0.2.1/README.md +204 -0
  6. sentrycove-0.2.1/examples/fastapi_app.py +52 -0
  7. sentrycove-0.2.1/examples/sentrycove.yaml +71 -0
  8. sentrycove-0.2.1/pyproject.toml +74 -0
  9. sentrycove-0.2.1/scripts/check_versions.py +73 -0
  10. sentrycove-0.2.1/src/sentrycove/__init__.py +22 -0
  11. sentrycove-0.2.1/src/sentrycove/__main__.py +7 -0
  12. sentrycove-0.2.1/src/sentrycove/alerts.py +165 -0
  13. sentrycove-0.2.1/src/sentrycove/cli.py +127 -0
  14. sentrycove-0.2.1/src/sentrycove/clientip.py +43 -0
  15. sentrycove-0.2.1/src/sentrycove/config.py +187 -0
  16. sentrycove-0.2.1/src/sentrycove/detectors.py +133 -0
  17. sentrycove-0.2.1/src/sentrycove/engine.py +328 -0
  18. sentrycove-0.2.1/src/sentrycove/identity.py +64 -0
  19. sentrycove-0.2.1/src/sentrycove/middleware.py +114 -0
  20. sentrycove-0.2.1/src/sentrycove/paths.py +57 -0
  21. sentrycove-0.2.1/src/sentrycove/policy.py +33 -0
  22. sentrycove-0.2.1/src/sentrycove/proxy.py +291 -0
  23. sentrycove-0.2.1/src/sentrycove/sfv.py +274 -0
  24. sentrycove-0.2.1/src/sentrycove/sidecar.py +178 -0
  25. sentrycove-0.2.1/src/sentrycove/store.py +92 -0
  26. sentrycove-0.2.1/src/sentrycove/webbotauth.py +400 -0
  27. sentrycove-0.2.1/tests/__init__.py +0 -0
  28. sentrycove-0.2.1/tests/_servers.py +105 -0
  29. sentrycove-0.2.1/tests/conftest.py +119 -0
  30. sentrycove-0.2.1/tests/test_alerts_config.py +107 -0
  31. sentrycove-0.2.1/tests/test_middleware.py +238 -0
  32. sentrycove-0.2.1/tests/test_paths.py +35 -0
  33. sentrycove-0.2.1/tests/test_proxy.py +183 -0
  34. sentrycove-0.2.1/tests/test_sfv.py +71 -0
  35. sentrycove-0.2.1/tests/test_sidecar.py +179 -0
  36. sentrycove-0.2.1/tests/test_versions.py +21 -0
  37. sentrycove-0.2.1/tests/test_webbotauth.py +234 -0
@@ -0,0 +1,24 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .eggs/
5
+ build/
6
+ dist/
7
+ .venv/
8
+ venv/
9
+ .env
10
+ .pytest_cache/
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ .coverage
14
+ htmlcov/
15
+
16
+ # Node
17
+ node_modules/
18
+ clients/node/dist/
19
+ *.tgz
20
+
21
+ # .NET
22
+ bin/
23
+ obj/
24
+ *.user
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+
3
+ All notable changes to SentryCove are recorded here. The Python package, the
4
+ Node package, the .NET package and the container image share one version
5
+ number and are released together.
6
+
7
+ ## 0.2.1
8
+
9
+ No changes to how SentryCove behaves. This is the first version published by
10
+ the automated release pipeline.
11
+
12
+ ### Added
13
+ - Release workflow that publishes to PyPI, npm and NuGet via trusted publishing
14
+ (no stored tokens), builds a multi-arch container image, and creates a GitHub
15
+ release — after checking that all versions match and the full test suite passes.
16
+ - `RELEASING.md` with step-by-step setup for each registry.
17
+
18
+ ## 0.2.0
19
+
20
+ First public release under the name SentryCove (the 0.1 prototype was called AgentGate).
21
+
22
+ ### Added
23
+ - **Reverse proxy** (`sentrycove proxy`, container image): protect an app in any
24
+ language with no code change. Streams requests and responses, strips forged
25
+ forwarding headers, and tells the app who is calling via `X-SentryCove-Agent`.
26
+ - **Decision API** (`sentrycove sidecar`): token-protected local service that
27
+ lets middleware in other languages use the same engine.
28
+ - **Node package**: Express / Connect / `node:http` middleware and a guard for
29
+ Next.js and other web-standard runtimes.
30
+ - **ASP.NET Core package** for .NET 8 and .NET 10.
31
+ - `sentrycove check-config` to validate a policy file.
32
+
33
+ ### Security
34
+ - Rules, honeypots and login paths are matched on a canonical path, so they can
35
+ no longer be dodged with upper-case, percent-encoding, extra slashes or
36
+ dot segments (`/LOGIN`, `/lo%67in`, `//login`, `/x/../login`).
37
+ - An undeterminable client address is never banned or rate-counted (a ban
38
+ would otherwise have applied to every such client at once).
39
+ - IPv4-mapped IPv6 peers (`::ffff:203.0.113.9`) are treated as the IPv4 address.
40
+
41
+ ### Changed
42
+ - Renamed from AgentGate: package `sentrycove`, class `SentryCove`,
43
+ `request.state.sentrycove`, `sentrycove.yaml`, `SENTRYCOVE_*` environment variables.
44
+
45
+ ## 0.1.0
46
+
47
+ Prototype (unreleased): ASGI middleware with Web Bot Auth verification,
48
+ per-agent rules, honeypots, login and session monitoring, and alerts.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ https://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ https://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,238 @@
1
+ Metadata-Version: 2.5
2
+ Name: sentrycove
3
+ Version: 0.2.1
4
+ Summary: Open-source agent firewall and early-warning layer for web apps: verify AI agents, enforce per-agent policies, detect hijacked sessions and credential stuffing.
5
+ Project-URL: Repository, https://github.com/XSiddhSaraf/sentrycove
6
+ Project-URL: Issues, https://github.com/XSiddhSaraf/sentrycove/issues
7
+ Project-URL: Changelog, https://github.com/XSiddhSaraf/sentrycove/blob/main/CHANGELOG.md
8
+ Author: Siddharth
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: ai-agents,asgi,bot-detection,fastapi,security,waf,web-bot-auth
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Framework :: FastAPI
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
17
+ Classifier: Topic :: Security
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: cryptography>=42
20
+ Requires-Dist: httpx>=0.27
21
+ Requires-Dist: pydantic>=2.6
22
+ Requires-Dist: pyyaml>=6.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: fastapi>=0.110; extra == 'dev'
25
+ Requires-Dist: http-message-signatures>=0.5; extra == 'dev'
26
+ Requires-Dist: mypy>=1.10; extra == 'dev'
27
+ Requires-Dist: pytest>=8; extra == 'dev'
28
+ Requires-Dist: ruff>=0.5; extra == 'dev'
29
+ Requires-Dist: types-pyyaml; extra == 'dev'
30
+ Requires-Dist: uvicorn>=0.30; extra == 'dev'
31
+ Provides-Extra: server
32
+ Requires-Dist: uvicorn>=0.30; extra == 'server'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # SentryCove
36
+
37
+ **An open-source agent firewall and early-warning layer for web apps.**
38
+ Know *which* AI agent is calling your app, decide what each one may do, and get
39
+ an alert within seconds when someone probes your app, brute-forces logins or
40
+ replays a stolen session.
41
+
42
+ > Status: **alpha (0.2)**. Start in `monitor` mode. APIs may change before 1.0.
43
+ > Packages are not yet published to PyPI, npm or NuGet — install from this repository for now.
44
+
45
+ ## Why
46
+
47
+ Bot traffic is no longer "bot vs human". AI agents browse with real browsers
48
+ from cloud infrastructure, antidetect browsers replay stolen session cookies,
49
+ and User-Agent strings prove nothing. SentryCove answers three questions on
50
+ every request:
51
+
52
+ 1. **Who is this?** A cryptographically verified AI agent (Web Bot Auth / RFC 9421),
53
+ a self-declared bot, a script, or an ordinary browser.
54
+ 2. **Is it allowed to do this?** Per-agent rules: e.g. verified agents may read
55
+ docs; unverified bots may not submit forms.
56
+ 3. **Is something attacking us right now?** Honeypot hits, credential stuffing,
57
+ session hijacking, forged agent signatures → alert to Slack, a webhook or your logs.
58
+
59
+ ## Pick your integration
60
+
61
+ One detection engine, four ways to put it in front of your app:
62
+
63
+ | Your app | Use | Code change |
64
+ |---|---|---|
65
+ | Anything (PHP, Java, Go, Ruby, Rails, WordPress, ...) | [Reverse proxy](#reverse-proxy-any-language) (Docker) | none |
66
+ | Python: FastAPI, Starlette, any ASGI app | [ASGI middleware](#python-fastapi--starlette--asgi) | one line |
67
+ | Node: Express, Next.js, Hono, plain `http` | [`clients/node`](https://github.com/XSiddhSaraf/sentrycove/tree/main/clients/node) | a few lines |
68
+ | ASP.NET Core (.NET 8 / 10) | [`clients/dotnet`](https://github.com/XSiddhSaraf/sentrycove/tree/main/clients/dotnet) | a few lines |
69
+
70
+ All four read the same policy file — copy [`examples/sentrycove.yaml`](https://github.com/XSiddhSaraf/sentrycove/blob/main/examples/sentrycove.yaml)
71
+ and adjust the paths.
72
+
73
+ ### Reverse proxy (any language)
74
+
75
+ ```
76
+ client ──> your TLS terminator ──> sentrycove proxy ──> your app
77
+ ```
78
+
79
+ ```bash
80
+ docker build -t sentrycove .
81
+ docker run -p 8080:8080 --add-host=host.docker.internal:host-gateway \
82
+ -e SENTRYCOVE_UPSTREAM=http://host.docker.internal:3000 \
83
+ -v "$PWD/sentrycove.yaml:/etc/sentrycove/sentrycove.yaml:ro" \
84
+ sentrycove
85
+ ```
86
+
87
+ or `docker compose -f deploy/docker-compose.yml up --build` for a complete
88
+ example. Without Docker: `pip install ".[server]"` then
89
+ `sentrycove proxy --upstream http://127.0.0.1:3000 --config sentrycove.yaml`.
90
+
91
+ Your app receives two extra headers it can trust (client-sent copies are
92
+ removed): `X-SentryCove-Agent` (e.g. `verified:example-agent`,
93
+ `automation:curl`) and `X-SentryCove-Client-IP`. Make sure the app is only
94
+ reachable through the proxy.
95
+
96
+ ### Python (FastAPI / Starlette / ASGI)
97
+
98
+ ```python
99
+ from fastapi import FastAPI, Request
100
+ from sentrycove import SentryCove
101
+
102
+ app = FastAPI()
103
+ app.add_middleware(SentryCove, config="sentrycove.yaml")
104
+
105
+ @app.get("/")
106
+ def home(request: Request):
107
+ return {"caller": request.state.sentrycove.label} # e.g. "declared:GPTBot"
108
+ ```
109
+
110
+ ### Node and ASP.NET Core
111
+
112
+ These use a thin middleware that asks a local SentryCove service (the
113
+ "decision API") for a verdict — about 1 ms per request on localhost in our
114
+ measurement:
115
+
116
+ ```bash
117
+ export SENTRYCOVE_API_TOKEN=$(python -c "import secrets; print(secrets.token_urlsafe(32))")
118
+ sentrycove sidecar --config sentrycove.yaml # or deploy/docker-compose.sidecar.yml
119
+ ```
120
+
121
+ ```js
122
+ // Express
123
+ import { sentrycove } from "sentrycove/express";
124
+ app.use(sentrycove({ url: "http://127.0.0.1:8787", token: process.env.SENTRYCOVE_API_TOKEN }));
125
+ ```
126
+
127
+ ```csharp
128
+ // ASP.NET Core
129
+ builder.Services.AddSentryCove(o => { o.Url = new Uri("http://127.0.0.1:8787"); o.Token = token; });
130
+ app.UseSentryCove();
131
+ ```
132
+
133
+ See [`clients/node`](https://github.com/XSiddhSaraf/sentrycove/tree/main/clients/node) (including Next.js) and
134
+ [`clients/dotnet`](https://github.com/XSiddhSaraf/sentrycove/tree/main/clients/dotnet) for details.
135
+
136
+ ## What it detects
137
+
138
+ | Detection | Signal | Default action |
139
+ |---|---|---|
140
+ | Verified AI agent | Valid Web Bot Auth signature from a trusted signer | Classified `verified`, rules decide |
141
+ | Forged / replayed agent signature | Signature fails or nonce reused | **High** alert |
142
+ | Bots on sensitive endpoints | Rule match (e.g. unverified bot POSTing a form) | Alert; block in `enforce` |
143
+ | Probing / scanning | Request to a honeypot path (`/.env`, `/.git/*`…) | **Critical** alert; IP ban in `enforce` |
144
+ | Brute force | N failed logins from one IP in a window | **High** alert |
145
+ | Credential stuffing | Site-wide spike of failed logins | **Critical** alert |
146
+ | Session hijack | Session cookie reused from a different browser/device | **High** alert |
147
+
148
+ ## Rollout: monitor → enforce
149
+
150
+ 1. Deploy with `mode: monitor`. Nothing is blocked; you only get alerts.
151
+ 2. Tune rules and honeypot paths until alerts are meaningful.
152
+ 3. Switch to `mode: enforce`. Blocking applies to `block` rules, honeypots and bans.
153
+
154
+ By default SentryCove fails open: a bug or outage in SentryCove never takes
155
+ your app down. Set `fail_open: false` (and `failOpen` / `FailOpen` in the Node
156
+ and .NET middleware) if you prefer requests to be refused instead.
157
+
158
+ ## Security design
159
+
160
+ - **Rules cannot be dodged with path tricks.** Paths are matched in a canonical
161
+ form, so `/LOGIN`, `/login/`, `//login`, `/lo%67in` and `/x/../login` all hit
162
+ a rule on `/login`.
163
+ - **No SSRF**: key directories are fetched only from origins you list under
164
+ `web_bot_auth.trusted_agents`, over HTTPS, without redirects, size-capped.
165
+ - **Spoof-resistant client IP**: `X-Forwarded-For` is ignored unless you set
166
+ `trusted_proxy_hops`, and then only the proxy-written entry is used. The
167
+ reverse proxy strips forged forwarding and `X-SentryCove-*` headers.
168
+ - **Unknown addresses are never banned**: if the client address cannot be
169
+ determined, IP bans and per-IP counters are skipped rather than applied to
170
+ everyone at once.
171
+ - **Decision API is authenticated**: every call needs a bearer token, compared
172
+ in constant time; it binds to localhost by default.
173
+ - **Bounded memory**: every tracker is size-capped and expires.
174
+ - **Privacy**: session tokens are stored only as truncated SHA-256 hashes; raw
175
+ tokens never appear in alerts. Webhook URLs come from environment variables.
176
+ - **Strict config**: unknown keys are rejected so a typo cannot silently
177
+ disable a protection.
178
+
179
+ ## Limitations (honest list)
180
+
181
+ - State is **per process**. With several workers or hosts, counters and bans
182
+ are not shared (a shared Redis backend is planned). Run one SentryCove
183
+ process per app for now.
184
+ - **Reverse proxy**: no WebSocket support yet (connections are refused), no
185
+ TLS termination (run it behind your load balancer, Caddy or nginx), and it
186
+ is a single Python process — fine for small and medium sites, not a CDN.
187
+ - **Next.js / edge runtimes** cannot see the response status, so failed-login
188
+ monitoring needs the Express middleware or the reverse proxy; see
189
+ [`clients/node`](https://github.com/XSiddhSaraf/sentrycove/tree/main/clients/node) for how the client address is determined.
190
+ - Session-hijack detection compares User-Agent and Accept-Language, so a
191
+ browser auto-update can cause a false positive. It alerts; it never blocks.
192
+ - Web Bot Auth is an IETF **draft**; the verifier implements Ed25519 signatures
193
+ with `@method`, `@authority`, `@scheme`, `@path`, `@query` and header
194
+ components (including `;key=` dictionary members). Key-directory response
195
+ signatures are not yet verified (HTTPS to a trusted origin is relied on).
196
+ - Behind a proxy that rewrites `Host`, signatures covering `@authority` will
197
+ fail to verify — preserve the original Host header.
198
+
199
+ ## Roadmap
200
+
201
+ - Publish to PyPI, npm, NuGet and a container registry
202
+ - Shared state via Redis; WebSocket proxying; JA4 TLS fingerprints
203
+ - LLM-assisted alert triage: plain-language "what happened, how bad, what to do"
204
+ - Optional hosted console: fleet view, shared threat intelligence, team alert routing
205
+
206
+ ## Repository layout
207
+
208
+ ```
209
+ src/sentrycove/ engine, ASGI middleware, reverse proxy, decision API, CLI (Python)
210
+ clients/node/ Express middleware and Next.js / fetch guard (TypeScript)
211
+ clients/dotnet/ ASP.NET Core middleware (C#)
212
+ deploy/ Docker Compose examples
213
+ examples/ example policy and FastAPI app
214
+ ```
215
+
216
+ ## Development
217
+
218
+ ```bash
219
+ pip install -e ".[dev]"
220
+ pytest
221
+ ruff check src tests && mypy --ignore-missing-imports src
222
+
223
+ (cd clients/node && npm ci && npm test)
224
+ dotnet run -c Release --project clients/dotnet/tests/SentryCove.AspNetCore.Tests
225
+ ```
226
+
227
+ Releases are described in [RELEASING.md](https://github.com/XSiddhSaraf/sentrycove/blob/main/RELEASING.md).
228
+
229
+ The Node and .NET suites start the real decision API and run the middleware
230
+ against it. The Python suite includes real-socket reverse-proxy tests, an
231
+ interoperability test that verifies signatures produced by the independent
232
+ `http-message-signatures` library, and the RFC 8037 JWK-thumbprint vector.
233
+
234
+ ## License
235
+
236
+ Apache-2.0. Contributions require agreeing to the CLA — see
237
+ [CONTRIBUTING.md](https://github.com/XSiddhSaraf/sentrycove/blob/main/CONTRIBUTING.md). Report vulnerabilities privately as
238
+ described in [SECURITY.md](https://github.com/XSiddhSaraf/sentrycove/blob/main/SECURITY.md).