sharpit 0.0.1__tar.gz → 0.1.0__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.
- sharpit-0.1.0/.gitattributes +1 -0
- sharpit-0.1.0/.gitignore +22 -0
- sharpit-0.1.0/CHANGELOG.md +61 -0
- sharpit-0.1.0/LICENSE +201 -0
- sharpit-0.1.0/NOTICE +10 -0
- sharpit-0.1.0/PKG-INFO +247 -0
- sharpit-0.1.0/README.md +204 -0
- sharpit-0.1.0/docs/README.md +18 -0
- sharpit-0.1.0/docs/development/workflow.md +70 -0
- sharpit-0.1.0/docs/how-it-works.md +108 -0
- sharpit-0.1.0/docs/reference/BOOTUI-CONTRACT-MVP.md +762 -0
- sharpit-0.1.0/docs/reference/BOOTUI-PYTHON-MAPPING.md +106 -0
- sharpit-0.1.0/docs/reports/2026-10-31-dogfood-klipermedia.md +80 -0
- sharpit-0.1.0/docs/reports/2026-10-31-mvp-retrospective.md +31 -0
- sharpit-0.1.0/docs/reports/2026-10-31-mvp-summary.md +154 -0
- sharpit-0.1.0/examples/fastapi_sample/app.py +112 -0
- sharpit-0.1.0/examples/fastapi_sample/static/hello.txt +1 -0
- sharpit-0.1.0/pyproject.toml +90 -0
- sharpit-0.1.0/src/sharpit/__init__.py +7 -0
- sharpit-0.1.0/src/sharpit/engine/__init__.py +0 -0
- sharpit-0.1.0/src/sharpit/engine/activation.py +69 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/__init__.py +1 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/beans.py +36 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/config/__init__.py +153 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/config/getenv_scan.py +98 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/config/settings_source.py +144 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/loggers.py +53 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/mappings.py +32 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/overview.py +40 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/vulns/__init__.py +1 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/vulns/cvss.py +120 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/vulns/dismissals.py +128 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/vulns/epss.py +156 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/vulns/interpreter.py +391 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/vulns/inventory.py +46 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/vulns/osv.py +191 -0
- sharpit-0.1.0/src/sharpit/engine/collectors/vulns/service.py +359 -0
- sharpit-0.1.0/src/sharpit/engine/context.py +49 -0
- sharpit-0.1.0/src/sharpit/engine/guard.py +382 -0
- sharpit-0.1.0/src/sharpit/engine/headers.py +32 -0
- sharpit-0.1.0/src/sharpit/engine/masking.py +106 -0
- sharpit-0.1.0/src/sharpit/engine/mcp.py +347 -0
- sharpit-0.1.0/src/sharpit/engine/paging.py +43 -0
- sharpit-0.1.0/src/sharpit/engine/panels.py +76 -0
- sharpit-0.1.0/src/sharpit/engine/relaxed.py +15 -0
- sharpit-0.1.0/src/sharpit/engine/singleflight.py +37 -0
- sharpit-0.1.0/src/sharpit/engine/spi.py +44 -0
- sharpit-0.1.0/src/sharpit/engine/tools.py +429 -0
- sharpit-0.1.0/src/sharpit/fastapi/__init__.py +0 -0
- sharpit-0.1.0/src/sharpit/fastapi/adapter.py +451 -0
- sharpit-0.1.0/src/sharpit/fastapi/http.py +18 -0
- sharpit-0.1.0/src/sharpit/fastapi/introspector.py +274 -0
- sharpit-0.1.0/src/sharpit/fastapi/signals.py +19 -0
- sharpit-0.1.0/src/sharpit/py.typed +0 -0
- sharpit-0.1.0/src/sharpit/settings.py +316 -0
- sharpit-0.1.0/src/sharpit/ui/static/assets/index-B35rjvFd.css +1 -0
- sharpit-0.1.0/src/sharpit/ui/static/assets/index-BuJxUNPy.js +6 -0
- sharpit-0.1.0/src/sharpit/ui/static/index.html +14 -0
- sharpit-0.1.0/tests/conftest.py +128 -0
- sharpit-0.1.0/tests/engine/config/test_config_report.py +421 -0
- sharpit-0.1.0/tests/engine/config/test_getenv_scan.py +64 -0
- sharpit-0.1.0/tests/engine/config/test_settings_source.py +226 -0
- sharpit-0.1.0/tests/engine/test_activation.py +301 -0
- sharpit-0.1.0/tests/engine/test_beans.py +63 -0
- sharpit-0.1.0/tests/engine/test_context.py +61 -0
- sharpit-0.1.0/tests/engine/test_guard.py +967 -0
- sharpit-0.1.0/tests/engine/test_headers.py +29 -0
- sharpit-0.1.0/tests/engine/test_loggers.py +128 -0
- sharpit-0.1.0/tests/engine/test_mappings.py +64 -0
- sharpit-0.1.0/tests/engine/test_masking.py +181 -0
- sharpit-0.1.0/tests/engine/test_mcp.py +395 -0
- sharpit-0.1.0/tests/engine/test_overview.py +80 -0
- sharpit-0.1.0/tests/engine/test_paging.py +68 -0
- sharpit-0.1.0/tests/engine/test_panels.py +66 -0
- sharpit-0.1.0/tests/engine/test_relaxed.py +46 -0
- sharpit-0.1.0/tests/engine/test_singleflight.py +68 -0
- sharpit-0.1.0/tests/engine/test_tools.py +368 -0
- sharpit-0.1.0/tests/engine/vulns/test_cvss.py +215 -0
- sharpit-0.1.0/tests/engine/vulns/test_dismissals.py +147 -0
- sharpit-0.1.0/tests/engine/vulns/test_epss.py +266 -0
- sharpit-0.1.0/tests/engine/vulns/test_interpreter.py +636 -0
- sharpit-0.1.0/tests/engine/vulns/test_inventory.py +74 -0
- sharpit-0.1.0/tests/engine/vulns/test_osv.py +364 -0
- sharpit-0.1.0/tests/engine/vulns/test_service.py +494 -0
- sharpit-0.1.0/tests/engine/vulns/vulnfakes.py +69 -0
- sharpit-0.1.0/tests/fastapi/test_cli_api.py +186 -0
- sharpit-0.1.0/tests/fastapi/test_concurrency.py +50 -0
- sharpit-0.1.0/tests/fastapi/test_install.py +456 -0
- sharpit-0.1.0/tests/fastapi/test_introspector_providers.py +259 -0
- sharpit-0.1.0/tests/fastapi/test_introspector_routes.py +211 -0
- sharpit-0.1.0/tests/fastapi/test_loggers_api.py +120 -0
- sharpit-0.1.0/tests/fastapi/test_mcp_api.py +180 -0
- sharpit-0.1.0/tests/fastapi/test_signals.py +25 -0
- sharpit-0.1.0/tests/fastapi/test_vulns_api.py +199 -0
- sharpit-0.1.0/tests/fixtures/bootui/beans.json +6625 -0
- sharpit-0.1.0/tests/fixtures/bootui/config.json +11315 -0
- sharpit-0.1.0/tests/fixtures/bootui/health.json +84 -0
- sharpit-0.1.0/tests/fixtures/bootui/loggers.json +6040 -0
- sharpit-0.1.0/tests/fixtures/bootui/mappings.json +5475 -0
- sharpit-0.1.0/tests/fixtures/bootui/meta.json +6 -0
- sharpit-0.1.0/tests/fixtures/bootui/overview.json +26 -0
- sharpit-0.1.0/tests/fixtures/bootui/panels.json +545 -0
- sharpit-0.1.0/tests/fixtures/bootui/vulnerabilities.json +1684 -0
- sharpit-0.1.0/tests/fixtures/epss/CVE-2024-34064.json +1 -0
- sharpit-0.1.0/tests/fixtures/getenv_corpus/pkg/__init__.py +0 -0
- sharpit-0.1.0/tests/fixtures/getenv_corpus/pkg/forms.py +12 -0
- sharpit-0.1.0/tests/fixtures/osv/GHSA-h75v-3vvj-5mfj.json +31 -0
- sharpit-0.1.0/tests/fixtures/osv/PYSEC-2017-9999.json +17 -0
- sharpit-0.1.0/tests/fixtures/osv/querybatch.json +11 -0
- sharpit-0.1.0/tests/pytest_speed_exceptions.json +1 -0
- sharpit-0.1.0/tests/test_conformance.py +152 -0
- sharpit-0.1.0/tests/test_durations.json +26 -0
- sharpit-0.1.0/tests/test_durations.meta.json +4 -0
- sharpit-0.1.0/tests/test_example_app.py +41 -0
- sharpit-0.1.0/tests/test_fixtures.py +65 -0
- sharpit-0.1.0/tests/test_masking_corpus.py +297 -0
- sharpit-0.1.0/tests/test_packaging.py +41 -0
- sharpit-0.1.0/tests/test_release_workflow.py +38 -0
- sharpit-0.1.0/tests/test_safety_matrix.py +404 -0
- sharpit-0.1.0/tests/test_settings.py +333 -0
- sharpit-0.0.1/PKG-INFO +0 -16
- sharpit-0.0.1/README.md +0 -5
- sharpit-0.0.1/pyproject.toml +0 -16
- sharpit-0.0.1/src/sharpit/__init__.py +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto eol=lf
|
sharpit-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# raw BootUI runtime captures can contain this machine's environment: never commit them.
|
|
2
|
+
# Sanitised fixtures are committed under tests/fixtures/bootui/.
|
|
3
|
+
replica/evidence/
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.pyc
|
|
6
|
+
.venv/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
.pytest_cache/
|
|
10
|
+
.ruff_cache/
|
|
11
|
+
.coverage
|
|
12
|
+
coverage.xml
|
|
13
|
+
node_modules/
|
|
14
|
+
ui/node_modules/
|
|
15
|
+
ui/dist/
|
|
16
|
+
.sharpit/
|
|
17
|
+
ui/test-results/
|
|
18
|
+
ui/playwright-report/
|
|
19
|
+
.superpowers/
|
|
20
|
+
.serena/
|
|
21
|
+
*.egg-info/
|
|
22
|
+
.env
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to sharpit are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
4
|
+
and the project uses [Semantic Versioning](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- Releases publish from CI: pushing a signed `v<version>` tag runs `.github/workflows/release.yml`, which
|
|
11
|
+
publishes to PyPI with Trusted Publishing and creates the GitHub Release. `/sharpit:release` drives it.
|
|
12
|
+
|
|
13
|
+
## [0.1.0] - 2026-10-31
|
|
14
|
+
|
|
15
|
+
First release: an embedded, local-only developer console for FastAPI apps, ported from
|
|
16
|
+
[BootUI](https://github.com/jdubois/boot-ui) (Julien Dubois, Apache-2.0).
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- `sharpit.install(app, settings=..., **options)` mounts the console at `/sharpit` and a BootUI-compatible JSON API at
|
|
21
|
+
`/sharpit/api`. `settings=` takes pydantic-settings instances so the Config panel can show each value's source.
|
|
22
|
+
- Panels: Overview, Configuration (environment, `.env`, pydantic-settings and `os.getenv` keys, masked), Mappings,
|
|
23
|
+
Loggers (runtime level changes), Beans (dependency providers, middleware, lifespan), Vulnerabilities (OSV scan with
|
|
24
|
+
EPSS scores, on explicit request; dismissable rules in `.sharpit/sharpit.yml`), MCP Server and CLI.
|
|
25
|
+
- Read-only MCP endpoint (`POST /sharpit/api/mcp`, off by default; `SHARPIT_MCP_ENABLED=ON`) with the tools
|
|
26
|
+
`get_overview`, `get_config`, `get_mappings`, `get_loggers`, `get_beans` and `get_vulnerabilities_report`; the CLI
|
|
27
|
+
HTTP endpoint (`/sharpit/api/cli`) offers the same catalogue plus the vulnerability scan.
|
|
28
|
+
- Configuration through `SHARPIT_*` environment variables and `install()` keywords; the environment wins. Invalid values
|
|
29
|
+
fall back to a fail-safe value and record a warning.
|
|
30
|
+
- Fail-closed activation: on for `SHARPIT_ENABLED=ON`, a dev profile, `uvicorn --reload` or `fastapi dev`; a `prod`
|
|
31
|
+
profile switches it off unless `SHARPIT_ENABLED=ON` forces it. When off, the mount stays in place (as in BootUI) and
|
|
32
|
+
every path under it answers a plain 404 from the host's 404 handler; a host with a catch-all or authenticate-first
|
|
33
|
+
route answers those paths differently, so the mount can be told apart. `path="/"` and a trailing slash are refused.
|
|
34
|
+
- Request guard: loopback-only by default, `Host` allow-list, full-origin (API paths) and `Sec-Fetch-Site` cross-site checks on
|
|
35
|
+
every method, bearer token with `HttpOnly` session cookie for untrusted sources.
|
|
36
|
+
- Secret masking of values, defaults and suggestions in API, MCP and CLI output, including pydantic `SecretStr` and any URL with userinfo.
|
|
37
|
+
- Extras `sharpit[fastapi]` and `sharpit[settings]`; typed package (`py.typed`); prebuilt UI in the wheel, so end users
|
|
38
|
+
never need Node.
|
|
39
|
+
|
|
40
|
+
### Deviations from BootUI
|
|
41
|
+
|
|
42
|
+
Listed in section 14 of the design spec. The main ones:
|
|
43
|
+
|
|
44
|
+
- FastAPI only; Django and Flask are out of scope.
|
|
45
|
+
- A new Svelte UI instead of BootUI's Vue UI, over the same JSON contract.
|
|
46
|
+
- Activation uses profile variables and a dev-server signal read from the command line (no DevTools equivalent);
|
|
47
|
+
`uvicorn.run(..., reload=True)` from a script is not detected.
|
|
48
|
+
- The cross-site check applies to every method, compares the full origin on API paths, and any forwarded header makes a caller
|
|
49
|
+
untrusted unless a trusted proxy is configured.
|
|
50
|
+
- `defaultValue` is masked as well, because Python defaults come from code.
|
|
51
|
+
- Beans are dependency providers, middleware and lifespan rather than an IoC container.
|
|
52
|
+
- Deferred: config overrides, health, profile diff and the `sharpit` command-line client (the HTTP endpoint ships).
|
|
53
|
+
|
|
54
|
+
### Known limitations
|
|
55
|
+
|
|
56
|
+
- State (token, MCP switch, logger levels, scan cache) is per process under `--workers` and `--reload`.
|
|
57
|
+
- Behind a TLS-terminating proxy, uvicorn needs `--proxy-headers` for the Origin check to pass.
|
|
58
|
+
- Masking is name- and shape-based: vendor-prefixed tokens under harmless names (`sk_live_...`, `ghp_...`) can show.
|
|
59
|
+
|
|
60
|
+
[Unreleased]: https://github.com/ffroliva/sharpit/compare/v0.1.0...HEAD
|
|
61
|
+
[0.1.0]: https://github.com/ffroliva/sharpit/releases/tag/v0.1.0
|
sharpit-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
sharpit-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
sharpit
|
|
2
|
+
Copyright 2026 Flavio Oliva
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0.
|
|
5
|
+
|
|
6
|
+
This product is a derivative work of BootUI (https://github.com/jdubois/boot-ui),
|
|
7
|
+
Copyright Julien Dubois, licensed under the Apache License, Version 2.0.
|
|
8
|
+
sharpit ports BootUI's design goals, JSON contract and test cases from Java/Spring
|
|
9
|
+
Boot to Python/FastAPI. Files carrying ported logic or test cases are modified from
|
|
10
|
+
the originals. The sharpit UI is a new implementation.
|
sharpit-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sharpit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Embedded, local-only developer console for Python apps (a port of BootUI).
|
|
5
|
+
Project-URL: Homepage, https://github.com/ffroliva/sharpit
|
|
6
|
+
Project-URL: Source, https://github.com/ffroliva/sharpit
|
|
7
|
+
Project-URL: Issues, https://github.com/ffroliva/sharpit/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/ffroliva/sharpit/blob/master/CHANGELOG.md
|
|
9
|
+
Author: Flavio Oliva
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Keywords: bootui,debugging,developer-tools,devtools,fastapi,introspection,mcp,starlette
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Web Environment
|
|
16
|
+
Classifier: Framework :: FastAPI
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.12
|
|
28
|
+
Requires-Dist: packaging>=23
|
|
29
|
+
Requires-Dist: starlette>=0.44
|
|
30
|
+
Provides-Extra: fastapi
|
|
31
|
+
Requires-Dist: fastapi>=0.115; extra == 'fastapi'
|
|
32
|
+
Provides-Extra: settings
|
|
33
|
+
Requires-Dist: pydantic-settings>=2.4; extra == 'settings'
|
|
34
|
+
Provides-Extra: test
|
|
35
|
+
Requires-Dist: fastapi>=0.115; extra == 'test'
|
|
36
|
+
Requires-Dist: httpx>=0.27; extra == 'test'
|
|
37
|
+
Requires-Dist: pydantic-settings>=2.4; extra == 'test'
|
|
38
|
+
Requires-Dist: pytest-timeout>=2.3; extra == 'test'
|
|
39
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
40
|
+
Requires-Dist: python-multipart>=0.0.9; extra == 'test'
|
|
41
|
+
Requires-Dist: uvicorn>=0.30; extra == 'test'
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
|
|
44
|
+
# sharpit
|
|
45
|
+
|
|
46
|
+
An embedded, local-only developer console for FastAPI apps. One call mounts a web console at `/sharpit` and a
|
|
47
|
+
JSON API at `/sharpit/api` inside your own app, so a running service becomes understandable in minutes: its
|
|
48
|
+
configuration and where each value came from, every route, the dependency providers, loggers you can retune live,
|
|
49
|
+
and a vulnerability scan of the installed packages.
|
|
50
|
+
|
|
51
|
+
sharpit is a Python/FastAPI port of [BootUI](https://github.com/jdubois/boot-ui) by Julien Dubois (Apache-2.0), the
|
|
52
|
+
Spring Boot developer console. It ports BootUI's design goals, JSON contract and test cases; the UI is new.
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
> **Status: alpha (0.1.0, FastAPI only).** Django and Flask are not supported. See [CHANGELOG.md](https://github.com/ffroliva/sharpit/blob/master/CHANGELOG.md).
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
sharpit is not on PyPI yet. Until 0.1.0 is published, install it from git:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install "sharpit @ git+https://github.com/ffroliva/sharpit.git"
|
|
64
|
+
# or
|
|
65
|
+
uv add "sharpit @ git+https://github.com/ffroliva/sharpit.git"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Once published, it is `pip install sharpit` or `uv add sharpit`.
|
|
69
|
+
|
|
70
|
+
Python 3.12+. Runtime dependencies are only `starlette>=0.44` and `packaging>=23`. Optional extras:
|
|
71
|
+
|
|
72
|
+
| Extra | Adds | Why |
|
|
73
|
+
|---|---|---|
|
|
74
|
+
| `sharpit[fastapi]` | `fastapi>=0.115` | the supported host |
|
|
75
|
+
| `sharpit[settings]` | `pydantic-settings>=2.4` | the Config panel shows which source each value came from |
|
|
76
|
+
|
|
77
|
+
## Quickstart
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from fastapi import FastAPI
|
|
81
|
+
import sharpit
|
|
82
|
+
|
|
83
|
+
app = FastAPI()
|
|
84
|
+
sharpit.install(app) # mounts /sharpit and /sharpit/api
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Run it **with a dev signal** and open <http://127.0.0.1:8000/sharpit/>:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
fastapi dev app.py # or: uvicorn app:app --reload
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
To show where your own settings values come from, pass the pydantic-settings instance (or a list of them):
|
|
94
|
+
`sharpit.install(app, settings=Settings())`. Other options are keyword arguments, see the table below.
|
|
95
|
+
|
|
96
|
+
### Why does a plain `uvicorn app:app` give 404?
|
|
97
|
+
|
|
98
|
+
sharpit is a development tool, so it fails closed. With no reason to be on, every path under `/sharpit` answers a
|
|
99
|
+
plain 404 rendered by the host app's own 404 handler. The mount stays in place while inactive, as BootUI's does, so
|
|
100
|
+
sharpit still owns the paths under it: a host route such as `/{user}/...` cannot answer for `/sharpit/...`, and a host
|
|
101
|
+
with a catch-all or authenticate-first route answers `/sharpit/*` differently from its other paths (a 404 where it
|
|
102
|
+
would otherwise send 401), which shows that sharpit is installed. It switches on when the first of these applies:
|
|
103
|
+
|
|
104
|
+
1. `SHARPIT_ENABLED=ON` (always on; `OFF` always off).
|
|
105
|
+
2. An active profile is in `SHARPIT_ENABLED_PROFILES` (default `dev,local,development`). Profiles are read from the
|
|
106
|
+
variables in `SHARPIT_PROFILE_VARS` (default `SHARPIT_PROFILES,APP_ENV,ENVIRONMENT`), so `APP_ENV=dev` works.
|
|
107
|
+
3. A reloading dev server is detected from the command line: `uvicorn ... --reload` or `fastapi dev`.
|
|
108
|
+
|
|
109
|
+
A profile in `SHARPIT_DISABLED_PROFILES` (default `prod,production`) wins over 2 and 3 and switches it off.
|
|
110
|
+
`uvicorn.run(..., reload=True)` from a script is not detected: set `APP_ENV=dev` or `SHARPIT_ENABLED=ON`.
|
|
111
|
+
|
|
112
|
+
When sharpit was asked for but ended up off, it logs the reason at WARNING; an explicit `OFF` or nothing asking for it
|
|
113
|
+
logs at INFO. When on, it prints a banner on stderr and `GET /sharpit/api/overview` reports the reason under
|
|
114
|
+
`activation`.
|
|
115
|
+
|
|
116
|
+
## Panels
|
|
117
|
+
|
|
118
|
+
| Panel | What it shows |
|
|
119
|
+
|---|---|
|
|
120
|
+
| Overview | app, Python and package versions, active profiles, activation reason and warnings |
|
|
121
|
+
| Configuration | environment, `.env` files, pydantic-settings and `os.getenv` keys, the winning source of each value, masked |
|
|
122
|
+
| Mappings | every route of the host app |
|
|
123
|
+
| Loggers | logger tree with levels you can change at runtime |
|
|
124
|
+
| Beans | dependency providers, middleware and lifespan, with their dependencies |
|
|
125
|
+
| Vulnerabilities | installed distributions checked against [OSV](https://osv.dev) and scored with EPSS, on explicit request |
|
|
126
|
+
| MCP server | status and switch for the read-only MCP endpoint |
|
|
127
|
+
| CLI | the same tool catalogue over plain HTTP |
|
|
128
|
+
|
|
129
|
+
`GET /sharpit/api/panels` lists what this build offers and why a panel is unavailable or read-only.
|
|
130
|
+
|
|
131
|
+

|
|
132
|
+
|
|
133
|
+
## MCP for AI agents
|
|
134
|
+
|
|
135
|
+
The MCP endpoint is **off by default**. Enable it with `SHARPIT_MCP_ENABLED=ON` (or `install(app, mcp_enabled="ON")`,
|
|
136
|
+
or the switch in the MCP Server panel), then point a streamable-HTTP MCP client at
|
|
137
|
+
`http://127.0.0.1:8000/sharpit/api/mcp` (POST only). It exposes read-only tools: `get_overview`, `get_config`,
|
|
138
|
+
`get_mappings`, `get_loggers`, `get_beans`, `get_vulnerabilities_report`. There is no action tool, so an agent cannot
|
|
139
|
+
change a logger or start a scan through MCP. The same guard chain and masking apply to it as to the UI.
|
|
140
|
+
|
|
141
|
+
An agent skill that teaches an AI assistant to install and use sharpit is in
|
|
142
|
+
[`skills/sharpit`](https://github.com/ffroliva/sharpit/tree/master/skills/sharpit). The `sharpit` command-line client
|
|
143
|
+
is planned and not shipped; the `/sharpit/api/cli` HTTP endpoint is.
|
|
144
|
+
|
|
145
|
+
## Settings
|
|
146
|
+
|
|
147
|
+
Every setting is an environment variable and an `install()` keyword. **The environment variable wins over the
|
|
148
|
+
keyword**, so a deployment can always force `SHARPIT_ENABLED=OFF`. An empty value counts as unset. The name rule is
|
|
149
|
+
`SHARPIT_` + the keyword in upper case. An invalid value never raises: that setting takes its fail-safe value
|
|
150
|
+
(disabled, read-only, masked) and a warning is recorded and shown on the Overview panel. Only an unusable `path` or
|
|
151
|
+
`api_path` raises `ValueError`, and an unknown keyword raises `TypeError` with a suggestion. Booleans accept
|
|
152
|
+
`true/false/yes/no/on/off/1/0`; durations accept `10s`, `500ms` or a bare number of seconds.
|
|
153
|
+
|
|
154
|
+
| Env var | Keyword | Default | Meaning |
|
|
155
|
+
|---|---|---|---|
|
|
156
|
+
| `SHARPIT_ENABLED` | `enabled` | `AUTO` | `ON`, `OFF` or `AUTO` (use the rules above) |
|
|
157
|
+
| `SHARPIT_ENABLED_PROFILES` | `enabled_profiles` | `dev,local,development` | profiles that turn it on |
|
|
158
|
+
| `SHARPIT_DISABLED_PROFILES` | `disabled_profiles` | `prod,production` | profiles that turn it off |
|
|
159
|
+
| `SHARPIT_PROFILE_VARS` | `profile_vars` | `SHARPIT_PROFILES,APP_ENV,ENVIRONMENT` | variables the profiles are read from |
|
|
160
|
+
| `SHARPIT_PATH` | `path` | `/sharpit` | console mount point |
|
|
161
|
+
| `SHARPIT_API_PATH` | `api_path` | `/sharpit/api` | must sit under `path` |
|
|
162
|
+
| `SHARPIT_ALLOW_NON_LOCALHOST` | `allow_non_localhost` | `false` | accept non-loopback callers (token required) |
|
|
163
|
+
| `SHARPIT_ALLOWED_HOSTS` | `allowed_hosts` | empty | extra `Host` names to accept |
|
|
164
|
+
| `SHARPIT_TRUSTED_PROXIES` | `trusted_proxies` | empty | proxy addresses or ranges admitted as remote callers (token still required) |
|
|
165
|
+
| `SHARPIT_TRUST_CONTAINER_GATEWAY` | `trust_container_gateway` | `OFF` | `AUTO` trusts the detected container gateway |
|
|
166
|
+
| `SHARPIT_AUTHENTICATION_TOKEN` | `authentication_token` | generated | bearer token for untrusted sources |
|
|
167
|
+
| `SHARPIT_READ_ONLY` | `read_only` | `false` | refuse every write action |
|
|
168
|
+
| `SHARPIT_PANELS_<ID>_ENABLED` | `panels={"<id>": {"enabled": ...}}` | `true` | per-panel switch |
|
|
169
|
+
| `SHARPIT_PANELS_<ID>_READ_ONLY` | `panels={"<id>": {"read_only": ...}}` | `false` | per-panel read-only; `<ID>` is the panel id in capitals with `-` as `_`: `OVERVIEW`, `CONFIG`, `MAPPINGS`, `LOGGERS`, `BEANS`, `VULNERABILITIES`, `MCP_SERVER`, `CLI` |
|
|
170
|
+
| `SHARPIT_EXPOSE_VALUES` | `expose_values` | `MASKED` | `MASKED`, `METADATA_ONLY` or `FULL` (FULL logs a warning) |
|
|
171
|
+
| `SHARPIT_MASK_SECRETS` | `mask_secrets` | `true` | mask secret-looking names and values; sharpit's own token is masked even when `false` |
|
|
172
|
+
| `SHARPIT_SHOW_BANNER` | `show_banner` | `true` | print the startup banner to stderr |
|
|
173
|
+
| `SHARPIT_STATE_DIR` | `state_dir` | `.sharpit` | where dismissed vulnerability rules are stored (`sharpit.yml`, created on first write) |
|
|
174
|
+
| `SHARPIT_CONFIG_SCAN` | `config_scan` | `true` | `true` scans your top-level package for `os.getenv` keys, `false` disables, or a list of package names |
|
|
175
|
+
| `SHARPIT_VULNERABILITIES_OSV_ENABLED` | `vulnerabilities_osv_enabled` | `true` | allow the OSV scan |
|
|
176
|
+
| `SHARPIT_VULNERABILITIES_OSV_BASE_URI` | `vulnerabilities_osv_base_uri` | `https://api.osv.dev` | OSV endpoint |
|
|
177
|
+
| `SHARPIT_VULNERABILITIES_EPSS_ENABLED` | `vulnerabilities_epss_enabled` | `true` | enrich findings with EPSS scores |
|
|
178
|
+
| `SHARPIT_VULNERABILITIES_EPSS_BASE_URI` | `vulnerabilities_epss_base_uri` | `https://api.first.org` | EPSS endpoint |
|
|
179
|
+
| `SHARPIT_VULNERABILITIES_REQUEST_TIMEOUT` | `vulnerabilities_request_timeout` | `10s` | per-request timeout |
|
|
180
|
+
| `SHARPIT_VULNERABILITIES_MAX_PACKAGES` | `vulnerabilities_max_packages` | `500` | packages sent to OSV |
|
|
181
|
+
| `SHARPIT_VULNERABILITIES_MAX_ADVISORIES` | `vulnerabilities_max_advisories` | `200` | advisories kept per scan |
|
|
182
|
+
| `SHARPIT_MCP_ENABLED` | `mcp_enabled` | `OFF` | `ON` enables the MCP endpoint |
|
|
183
|
+
| `SHARPIT_MCP_MAX_RESULTS` | `mcp_max_results` | `200` | cap on items per tool call |
|
|
184
|
+
| `SHARPIT_MCP_MAX_PAYLOAD_BYTES` | `mcp_max_payload_bytes` | `1048576` | largest request body |
|
|
185
|
+
| `SHARPIT_MCP_MAX_CONCURRENT_CALLS` | `mcp_max_concurrent_calls` | `20` | parallel tool calls |
|
|
186
|
+
| `SHARPIT_MCP_EXECUTION_TIMEOUT` | `mcp_execution_timeout` | `30s` | per tool call |
|
|
187
|
+
| `SHARPIT_MCP_MAX_RESPONSE_BYTES` | `mcp_max_response_bytes` | `4194304` | largest response body |
|
|
188
|
+
| `SHARPIT_CLI_ENABLED` | `cli_enabled` | `true` | enable the `/sharpit/api/cli` endpoint |
|
|
189
|
+
| `SHARPIT_CLI_MAX_RESULTS` | `cli_max_results` | `200` | cap on items per call |
|
|
190
|
+
| `SHARPIT_CLI_MAX_CONCURRENT_CALLS` | `cli_max_concurrent_calls` | `20` | parallel calls |
|
|
191
|
+
| `SHARPIT_CLI_EXECUTION_TIMEOUT` | `cli_execution_timeout` | `30s` | per call |
|
|
192
|
+
|
|
193
|
+
The first Config load scans your package's source for `os.getenv` keys and caches the result. On a large application
|
|
194
|
+
that one-time scan can take several seconds. Set `SHARPIT_CONFIG_SCAN=false` to skip it, or narrow it to the smaller
|
|
195
|
+
top-level packages that read settings (`SHARPIT_CONFIG_SCAN=billing_config,accounts`; a dotted name scans its whole
|
|
196
|
+
top-level package).
|
|
197
|
+
|
|
198
|
+
## Safety model
|
|
199
|
+
|
|
200
|
+
- **Local only.** Requests must come from a loopback address with a loopback or allow-listed `Host`. If `Forwarded`,
|
|
201
|
+
`X-Forwarded-For` or `X-Real-IP` is present and no trusted proxy is configured, the caller counts as remote.
|
|
202
|
+
- **Cross-site requests are refused** on every method (`Sec-Fetch-Site: cross-site`, or, on API paths, an `Origin` that differs from
|
|
203
|
+
the request's full origin: scheme, host and port; other paths compare the host), even when your app has `CORSMiddleware(allow_origins=["*"])`.
|
|
204
|
+
- **Remote access needs a token.** Only loopback, or the container gateway under
|
|
205
|
+
`SHARPIT_TRUST_CONTAINER_GATEWAY=AUTO`, with no forwarded header skips the token. Callers admitted by
|
|
206
|
+
`SHARPIT_ALLOW_NON_LOCALHOST=true` or by a `SHARPIT_TRUSTED_PROXIES` address (whose requests may carry a rewritten
|
|
207
|
+
peer) must present the token as `Authorization: Bearer <token>`. Set `SHARPIT_AUTHENTICATION_TOKEN`; otherwise a
|
|
208
|
+
token is generated per process and printed once to stderr. A browser trades it for an `HttpOnly; SameSite=Strict`
|
|
209
|
+
cookie through `POST /sharpit/api/auth/session`.
|
|
210
|
+
- **Secrets are masked** (`******`) in values, defaults and suggestions, in API, MCP and CLI output, including pydantic `SecretStr`.
|
|
211
|
+
sharpit masks any URL that carries userinfo, including a user name with no password
|
|
212
|
+
(`https://<key>@o1.ingest.sentry.io/1`, `redis://admin@cache:6379`), because DSN-style keys sit in that slot. A
|
|
213
|
+
harmless user name in a URL is shown as `******` too. That is intentional: sharpit errs towards hiding.
|
|
214
|
+
- **GET has no side effects.** No network call, no file write, no logger change. The vulnerability scan (OSV and EPSS)
|
|
215
|
+
runs only on an explicit POST.
|
|
216
|
+
- **Fails closed.** When off, or in a `prod`/`production` profile (unless `SHARPIT_ENABLED=ON` forces it on, with a warning), the whole mount answers a plain 404 (see [Why does a plain `uvicorn app:app` give 404?](#why-does-a-plain-uvicorn-appapp-give-404) for what that does and does not hide).
|
|
217
|
+
|
|
218
|
+
### Behind a TLS-terminating proxy
|
|
219
|
+
|
|
220
|
+
The Origin check compares scheme, host and port. If a proxy terminates TLS and forwards plain HTTP, uvicorn must see
|
|
221
|
+
the original scheme or browser POSTs from the UI are rejected. Start uvicorn with `--proxy-headers` and
|
|
222
|
+
`--forwarded-allow-ips` (or set `FORWARDED_ALLOW_IPS`) to the proxy's address, and add that address to
|
|
223
|
+
`SHARPIT_TRUSTED_PROXIES`. Requests through the proxy still need the token.
|
|
224
|
+
|
|
225
|
+
### Multiple workers and `--reload`
|
|
226
|
+
|
|
227
|
+
sharpit keeps its state in the process that serves the request. With `uvicorn --workers N`, gunicorn or `--reload`:
|
|
228
|
+
|
|
229
|
+
- **Token.** When `SHARPIT_ALLOW_NON_LOCALHOST=true` and no token is configured, each process generates its own token,
|
|
230
|
+
so a token printed by one worker is rejected by the others and a reload invalidates the browser session. Set
|
|
231
|
+
`SHARPIT_AUTHENTICATION_TOKEN` to a fixed value in these setups.
|
|
232
|
+
- **MCP switch, logger levels, scan cache.** The MCP on/off switch, the last scan result and logger levels changed in
|
|
233
|
+
the panel live in memory per process, so each worker has its own. Dismissed vulnerability rules are shared because
|
|
234
|
+
they live in `sharpit.yml`.
|
|
235
|
+
|
|
236
|
+
For a dev tool, the simplest setup is one worker.
|
|
237
|
+
|
|
238
|
+
## Deviations from BootUI
|
|
239
|
+
|
|
240
|
+
sharpit follows BootUI's JSON contract and keeps its guard and masking rules, with deliberate differences (a stricter
|
|
241
|
+
cross-site check, Python-specific activation, a new UI, deferred features). The log is section 14 of the
|
|
242
|
+
[design spec](https://github.com/ffroliva/sharpit/blob/master/docs/superpowers/specs/2026-10-30-sharpit-mvp-design.md).
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
Apache License 2.0. See [LICENSE](https://github.com/ffroliva/sharpit/blob/master/LICENSE) and [NOTICE](https://github.com/ffroliva/sharpit/blob/master/NOTICE). sharpit is derived from
|
|
247
|
+
[BootUI](https://github.com/jdubois/boot-ui), Copyright Julien Dubois.
|