Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Single source of truth for every agent working in this repo (Claude Code, Codex,
## What sharpit is

An embedded, local-only developer console for Python web apps: a Python port of BootUI (Spring Boot). It is at
**0.9.0.** It targets FastAPI. One call mounts it:
**0.10.0.** It targets FastAPI. One call mounts it:

```python
import sharpit
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ and the project uses [Semantic Versioning](https://semver.org/).

## [Unreleased]

## [0.10.0] - 2026-11-28

### Added

- Baseline entries record a digest of their test (`owner`); reports list `inconclusive` and `inconclusiveFindings`. Inconclusive entries are listed and kept on rewrite also while an advisor entry is carried. A max-queries entry is checked against the queries of all phases of its test summed, so queries moved into or split across fixtures are inconclusive, not fixed; a fixture that seeds rows keeps a fixed max-queries entry inconclusive until it is cleared. Max-queries, N+1 and unbounded-read entries are inconclusive when the run used a sqlite3 connection factory or cursor class that sharpit does not trace. Known limits: SQL sent through a raw driver cursor beside SQLAlchemy is not traced, and unbounded reads are recorded only in the call phase, so such a change can read fixed.
Expand Down Expand Up @@ -37,6 +39,10 @@ and the project uses [Semantic Versioning](https://semver.org/).
from its environment. A github.com token is no longer sent to an Enterprise host. A setup that relied on
`GITHUB_TOKEN` for an Enterprise host sets `GH_HOST` and `GH_ENTERPRISE_TOKEN`, or runs
`gh auth login --hostname <host>`.
- The pytest plugin masks node ids, and the gate finding targets that contain them, in the JSON report, the JUnit
report, the written baseline and sharpit's own terminal summary lines, as the SARIF report already did: a
secret-shaped parametrize value is no longer stored in clear. pytest's own lines (`FAILED`, `-v` output) still print
the clear node id. Baseline entries still match by fingerprint, so an existing baseline keeps matching.

## [0.9.0] - 2026-11-23

Expand Down Expand Up @@ -571,7 +577,8 @@ Listed in section 14 of the design spec. The main ones:
- Behind a TLS-terminating proxy, uvicorn needs `--proxy-headers` for the Origin check to pass.
- Masking is name- and shape-based: vendor-prefixed tokens under harmless names (`sk_live_...`, `ghp_...`) can show.

[Unreleased]: https://github.com/ffroliva/sharpit/compare/v0.9.0...HEAD
[Unreleased]: https://github.com/ffroliva/sharpit/compare/v0.10.0...HEAD
[0.10.0]: https://github.com/ffroliva/sharpit/releases/tag/v0.10.0
[0.9.0]: https://github.com/ffroliva/sharpit/releases/tag/v0.9.0
[0.8.0]: https://github.com/ffroliva/sharpit/releases/tag/v0.8.0
[0.7.0]: https://github.com/ffroliva/sharpit/releases/tag/v0.7.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ installed packages for known vulnerabilities when you ask for it. Every panel in
swallows an exception, and runs the REST API advisor over your routes. When capture cannot see enough to judge, the
run fails closed.

> **Status: alpha (0.9.0, FastAPI and Starlette console; Flask supported for test gates).** Django is not supported. See [CHANGELOG.md](https://github.com/ffroliva/sharpit/blob/main/CHANGELOG.md).
> **Status: alpha (0.10.0, FastAPI and Starlette console; Flask supported for test gates).** Django is not supported. See [CHANGELOG.md](https://github.com/ffroliva/sharpit/blob/main/CHANGELOG.md).

## Security

Expand Down Expand Up @@ -334,7 +334,7 @@ sharpit ports BootUI feature by feature: 0.6.0 targets BootUI 2.3.0, 0.7.0 targe
| Runtime insight kinds that evaluate | none | 8 of 28 registered | 10 of 28 registered | 11 of 29 registered | 11 of 29 registered | 11 of 29 registered | 28 | 28 | 29 |
| Applicable BootUI GET fixture cases served | not measured | 33 (5 shape-identical, 28 partial) | 33 (5 shape-identical, 28 partial) | 33 (5 shape-identical, 28 partial) | 33 (5 shape-identical, 28 partial) | 41 across 38 routes (5 shape-identical, 36 partial) | 65 | not captured | 56 |

The sharpit 0.10.0 column describes the unreleased `main` branch. The increase from 33 to 41 reflects an inventory
The sharpit 0.10.0 column describes the 0.10.0 release. The increase from 33 to 41 reflects an inventory
correction for existing routes. Most cases marked `n-a` are served with fixtures that cannot establish parity.

How each row is counted, the insight kinds that evaluate, and what comes next: [ROADMAP.md](ROADMAP.md).
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ sharpit 默认关闭,只有检测到开发模式时才会启用:`fastapi dev
**功能概览:** 共 47 个面板。可以在应用运行时调整日志级别、按路由发现 N+1 查询,并按需扫描已安装依赖包中的已知漏洞。
全部面板的浅色和深色截图见 [截图目录](docs/screenshots.md)。

> **状态:alpha(0.9.0;控制台支持 FastAPI 与 Starlette,Flask 支持测试门禁)。** 不支持 Django。更新记录见 [CHANGELOG.md](CHANGELOG.md)。
> **状态:alpha(0.10.0;控制台支持 FastAPI 与 Starlette,Flask 支持测试门禁)。** 不支持 Django。更新记录见 [CHANGELOG.md](CHANGELOG.md)。

## 安全

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Security updates are provided only for the latest release on PyPI:

| Version | Supported | Notes |
|---|---|---|
| Latest release on PyPI (0.9.x) | Yes | Verifiable support boundary |
| Latest release on PyPI (0.10.x) | Yes | Verifiable support boundary |
| Prior versions | No | Unsupported |

## Reporting a Vulnerability
Expand Down
41 changes: 41 additions & 0 deletions docs/reports/2026-11-28-0.10.0-decisions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# sharpit 0.10.0: decisions record

0.10.0 stays on BootUI 2.5.0 for its ported panels and takes one security change from BootUI 2.6.0 (GitHub credentials
bound to the repository host). This file records the maintainer's rulings and the defaults taken during the 0.10.0
lanes (2026-11-24 to 2026-11-28), so they outlive the working notes.

## Owner rulings

| Date | Ruling | Where it lives |
|---|---|---|
| 2026-11-24 | #304 closes with a documentation PR recording that its Task 7 is dropped. | #321 |
| 2026-11-24 | #303: a classic branch protection rule covers `release/*`; the release pull request may be scanned while it is a draft. | `skills/release/SKILL.md`, `scripts/ci/ship_scan.py` |
| 2026-11-25 | #300 ships phases 1 to 4 of the route inventory, with no `n-a` rows for the 0.9.0 column and no public cache API. | #336 |
| 2026-11-25 | HTTP exchange capture reads the request user as plain data only. | #339 |
| 2026-11-26 | Text-less statements follow BootUI: a statement with no text, including one the stdlib `sqlite3` driver refuses, counts once with empty text, raises no hook failure and keeps the run known. Fail-closed covers lost capture only. | #345, `CHANGELOG.md` |
| 2026-11-26 | Writing a baseline after an `unknown` run is refused; BootUI has no findings baseline, so this is an `n-a` deviation row. | #345 |
| 2026-11-26 | Baseline `owner` digests (#329) ship with their deviation rows (BootUI has no baseline); `inconclusive` follows BootUI's not-exercised semantics. | #352, `docs/decisions/baseline-owner.md` |
| 2026-11-26 | #334 keeps a source-rule finding as one sanitized string beginning with the file and line, as BootUI's advisor violation does. Masking, targets and fingerprints are unchanged. | #350 |
| 2026-11-27 | GitHub credentials are bound to the repository host, ported from BootUI 2.6.0 ahead of the 2.6.0 port. | #354, `CHANGELOG.md` (Security) |

## Moved to the next release

The release is accepted with these gaps; each has an issue on the 0.11.0 milestone.

- **Flask console after slice 1** (#348). #260 closed for the console contract slice (#331).
- **API route parity after phase 1** (#347). #300 closed for the inventory phase (#336).
- **Journal sources and insight kinds** (#299), **masked exception message in swallowed-exception findings** (#253) and
**trace and journal masking on the matrix path** (#302): nothing of these shipped, so each issue moved whole.
- **Security sinks for SQL statements and outbound URLs.** 0.10.0 checks commands and file paths only; the later plans
of the sinks lane are not in this release.
- **Masking of whole test names.** The masker can blank a whole test identifier rather than only the secret in it; the
change touches a safety path and goes through prediction and council review first.
- **The BootUI 2.6.0 port.** The 2.6.0 delta is recorded; its remaining items, including a stricter cross-site check,
are planned for 0.11.0.

## Defaults taken (reversible)

- The files-sensor overhead budget is not raised after three Windows CI measurements above it (6.07 to 6.53 against
6.0 µs per event); a performance audit follows in 0.11.0.
- In-process plugin tests collect pending garbage before the run, so an earlier test's unclosed connection is not
counted as opened before capture (#355).
2 changes: 1 addition & 1 deletion plugins/sharpit/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sharpit",
"version": "0.9.0",
"version": "0.10.0",
"displayName": "sharpit",
"description": "Ask a running FastAPI app about itself: routes, configuration, SQL, exceptions, health and advisors, over sharpit's read-only local MCP server.",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/sharpit/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "sharpit",
"version": "0.9.0",
"version": "0.10.0",
"description": "Ask a running FastAPI app about itself: routes, configuration, SQL, exceptions, health and advisors, over sharpit's read-only local MCP server.",
"author": {
"name": "Flavio Oliva",
Expand Down
2 changes: 1 addition & 1 deletion plugins/sharpit/skills/sharpit/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: >

# sharpit: the local developer console for FastAPI apps

> **0.9.0.** APIs, panels and settings can still change before 1.0.
> **0.10.0.** APIs, panels and settings can still change before 1.0.
> The design source is `docs/superpowers/specs/2026-10-30-sharpit-mvp-design.md`; when this file and the code
> disagree, the code wins.

Expand Down
2 changes: 1 addition & 1 deletion skills/sharpit/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: >

# sharpit: the local developer console for FastAPI apps

> **0.9.0.** APIs, panels and settings can still change before 1.0.
> **0.10.0.** APIs, panels and settings can still change before 1.0.
> The design source is `docs/superpowers/specs/2026-10-30-sharpit-mvp-design.md`; when this file and the code
> disagree, the code wins.

Expand Down
2 changes: 1 addition & 1 deletion src/sharpit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""sharpit is a local developer console and pytest gate for FastAPI apps, a Python port of BootUI by Julien Dubois."""

__version__ = "0.9.0"
__version__ = "0.10.0"

from typing import TYPE_CHECKING # noqa: E402 # after __version__, the only version site

Expand Down
7 changes: 6 additions & 1 deletion src/sharpit/engine/testsession/baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from sharpit.engine.testsession.facts import PhaseFacts, TestFacts
from sharpit.engine.testsession.outcome import deciding
from sharpit.engine.testsession.report import clean_text
from sharpit.engine.testsession.sink import report_masker

SCHEMA = "sharpit-baseline/1"
TEST_RUNTIME_PREFIX = "test-runtime:"
Expand Down Expand Up @@ -221,7 +222,7 @@ def compare(


def write(path: Path, findings: Sequence[Finding], keep: Sequence[Entry] = ()) -> None:
"""Write stable, sorted baseline bytes. Findings arrive masked from the capture sink."""
"""Write stable, sorted baseline bytes. Targets and messages are masked here, node ids included."""
rows: dict[str, dict[str, Any]] = {
e.fingerprint: {
"fingerprint": e.fingerprint,
Expand All @@ -246,6 +247,10 @@ def write(path: Path, findings: Sequence[Finding], keep: Sequence[Entry] = ()) -
"observed": finding.observed,
"owner": owner_of(finding.test_node_id),
}
masker = report_masker() # a gate finding's target and message can hold its node id, which carries parametrize text
for row in rows.values():
row["target"] = masker.mask_text(row["target"]) or ""
row["message"] = masker.mask_text(row["message"]) or ""
payload = {"schema": SCHEMA, "findings": [rows[key] for key in sorted(rows)]}
text = clean_text(json.dumps(payload, indent=2, ensure_ascii=False) + "\n") # same cleaning as the report
path.parent.mkdir(parents=True, exist_ok=True)
Expand Down
22 changes: 22 additions & 0 deletions src/sharpit/engine/testsession/finish.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,25 @@ def finish(
unknown_reasons=session.unknown_reasons,
)
return data, status, reasons


# `reason` is masked in memory in finish on purpose; node text is masked only at write time, so counts see clear ids
_NODE_TEXT = ("target", "message", "testNodeId") # a gate finding's target and message can hold its node id


def masked_report(data: dict[str, Any]) -> dict[str, Any]:
"""A copy of the report for a file, with node ids masked as the SARIF writer masks them: a node id carries
parametrize values. The report in memory keeps the clear ids, which tell apart tests whose masked ids are equal."""
masker = report_masker()

def finding(dto: dict[str, Any]) -> dict[str, Any]:
return {**dto, **{key: masker.mask_text(dto[key]) or "" for key in _NODE_TEXT if dto.get(key)}}

return {
**data,
"tests": [{**test, "nodeId": masker.mask_text(test["nodeId"]) or ""} for test in data["tests"]],
"findings": [finding(dto) for dto in data["findings"]],
"advisors": [
{**advisor, "findings": [finding(dto) for dto in advisor["findings"]]} for advisor in data["advisors"]
],
}
7 changes: 3 additions & 4 deletions src/sharpit/pytest_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from sharpit.engine.sources import dispatch, sqlite
from sharpit.engine.sqltext import load_key
from sharpit.engine.testsession import gates as gates
from sharpit.engine.testsession import outcome, report
from sharpit.engine.testsession import outcome
from sharpit.engine.testsession.facts import SessionFacts
from sharpit.engine.testsession.sink import TestSessionSink, report_masker_warnings
from sharpit.pytest_plugin.apps import (
Expand All @@ -47,6 +47,7 @@
from sharpit.pytest_plugin.options import pytest_addoption as pytest_addoption
from sharpit.pytest_plugin.options import resolve as resolve
from sharpit.pytest_plugin.report_io import write_report as _write_report # noqa: F401 - compatibility re-export
from sharpit.pytest_plugin.report_io import write_report_files
from sharpit.pytest_plugin.session import MARKER_USAGE_ERROR
from sharpit.pytest_plugin.session import pytest_collection_finish as pytest_collection_finish
from sharpit.pytest_plugin.session import pytest_deselected as pytest_deselected
Expand Down Expand Up @@ -585,9 +586,7 @@ def _refresh_report_after_hook_failure(state: _State, config: Any, warning: str)
if warning not in data["warnings"]:
data["warnings"].append(warning)
try:
report.write_json(state.options.report, data)
if state.options.junit:
report.write_junit(state.options.junit, data, allow_unknown=state.options.allow_unknown)
write_report_files(state, data)
except Exception as write_exc: # noqa: BLE001
_record_hook_failure(state.sink, write_exc)

Expand Down
14 changes: 10 additions & 4 deletions src/sharpit/pytest_plugin/report_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from sharpit.engine.testsession import baseline as baseline_io
from sharpit.engine.testsession import gates, outcome, report, sarif
from sharpit.engine.testsession.facts import TestFacts, finding_from
from sharpit.engine.testsession.finish import HOOK_FAILURE_PREFIX, GateOptions, finish
from sharpit.engine.testsession.finish import HOOK_FAILURE_PREFIX, GateOptions, finish, masked_report


def write_report(state: Any, session: Any, exitstatus: int) -> None:
Expand Down Expand Up @@ -62,9 +62,7 @@ def write_report(state: Any, session: Any, exitstatus: int) -> None:
if not refusal:
_write_baseline(state, data) # before the report, so a write failure is in it
_write_sarif(state, data, sink.masker) # likewise
report.write_json(state.options.report, data)
if state.options.junit:
report.write_junit(state.options.junit, data, allow_unknown=state.options.allow_unknown)
write_report_files(state, data)
if refusal:
raise pytest.UsageError(refusal)
if exitstatus == 0 and outcome.exit_fails(
Expand All @@ -84,6 +82,14 @@ def write_report(state: Any, session: Any, exitstatus: int) -> None:
session.exitstatus = 1


def write_report_files(state: Any, data: dict[str, Any]) -> None:
"""The JSON and JUnit reports, written from one masked copy: every report file goes through here."""
written = masked_report(data)
report.write_json(state.options.report, written)
if state.options.junit:
report.write_junit(state.options.junit, written, allow_unknown=state.options.allow_unknown)


def _report_parts(plugin: Any, session: Any, state: Any, facts: Any) -> list[Any]:
if plugin._xdist_controller(session.config, state):
return state.parts
Expand Down
4 changes: 3 additions & 1 deletion src/sharpit/pytest_plugin/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from sharpit.engine.testsession.gates import ADVISOR as TEST_RUNTIME_GATES
from sharpit.engine.testsession.gates import GATE_IDS, SWALLOWED, TEST_DOUBLE_NOTE
from sharpit.engine.testsession.report import TEST_RUNTIME, finding_fails
from sharpit.engine.testsession.sink import report_masker
from sharpit.pytest_plugin.apps import AUTODETECT, DETECTED_BY, advisor_assessors, skip_reason
from sharpit.pytest_plugin.swallowed import SOURCE as SWALLOWED_SOURCE

Expand Down Expand Up @@ -50,8 +51,9 @@ def _write_summary(terminalreporter: Any, config: Any, state: Any, plugin: Any,
(test for test in data["tests"] if test["findings"]),
key=lambda test: (-len(test["findings"]), test["nodeId"]),
)[:5]
masker = report_masker() # counts above use the clear ids; a printed node id is masked like the report's
for test in worst:
terminalreporter.write_line(f" {test['nodeId']}: {len(test['findings'])} finding(s)")
terminalreporter.write_line(f" {masker.mask_text(test['nodeId'])}: {len(test['findings'])} finding(s)")
if not worst:
terminalreporter.write_line(" (none)")
swallowed_to_show = (
Expand Down
Loading
Loading