Yu-and-Ai's picture
Add Space README
c5ad3b6 verified
|
Raw
History Blame Contribute Delete
5.29 kB
---
title: Whitehack Flashlight
emoji: 🔦
colorFrom: gray
colorTo: yellow
sdk: gradio
sdk_version: 6.21.0
python_version: "3.12"
app_file: app.py
pinned: false
license: mit
short_description: Bounded text-only Whitehack review prompts over UI and MCP
---
# Whitehack Flashlight
One small public doorway into
[`@agenttool/whitehack-scan@0.9.0`](https://www.npmjs.com/package/@agenttool/whitehack-scan):
paste a bounded code excerpt and receive locations that deserve human review.
A finding is a review prompt, not a vulnerability verdict. No findings means
that none of the bundled rules matched this text; it does not prove the text or
its surrounding system is safe.
## What it does
- Inspects caller-provided text using the exact Whitehack 0.9.0 47-check core.
- Supports the current JavaScript/TypeScript, Python, and Solidity rule packs.
- Returns only line, check ID, static title, confidence, doctrine, and Clear
Standard principle.
- Exposes one UI action and one matching MCP tool, `scan_code`.
- Fails closed on malformed input, scanner drift, resource limits, timeout, or
bridge failure.
## What it does not do
- It does not execute submitted code.
- It has no file, archive, filesystem, repository, Git, URL, wallet, or
credential capability. A pasted string can still contain any of those; the
app treats it only as text and never opens, fetches, authenticates, signs, or
broadcasts with it.
- It does not clone, install, build, import, run, or test a target repository.
- It does not contact chains, wallets, RPC providers, models, or other scanning
services.
- It does not return source, filenames, snippets, raw rule messages, raw
errors, hashes, timestamps, or caller identity.
- It does not produce a pass/fail security certification.
## Privacy boundary
This is a public remote service. The application does not intentionally write
submitted source to disk, flagging storage, logs, or its response. Hugging Face
and network infrastructure are outside that application-level claim, so
platform retention is reported as `unknown`.
Do not submit secrets, private repositories, personal data, or proprietary
code. The app cannot reliably recognize or reject every secret. For sensitive
work, run the exact Whitehack package locally instead:
```sh
npx --yes @agenttool/whitehack-scan@0.9.0 scan .
```
## Closed contract
Input:
```json
{
"source": "eval(userInput)\n",
"language": "javascript"
}
```
Accepted language values are `javascript`, `python`, and `solidity`.
`javascript` selects the shared JS/TS/JSX rule pack.
Hard limits:
| Boundary | Limit |
|---|---:|
| UTF-8 source | 65,536 bytes |
| Lines | 2,000 |
| Findings | 500 |
| Scanner child | 3 seconds |
| Concurrent calls | 1 |
| Waiting queue | 16 |
The tool returns deterministic compact JSON text whose decoded response type is
`whitehack-flashlight/v0.1`. Text output is deliberate: Gradio 6.21's MCP
boundary otherwise stringifies a `gr.JSON` value as Python representation
rather than valid JSON. Completed responses declare the observed byte and line
counts plus the number of bundled rules considered. Errors contain one stable
machine code, no raw exception, and no partial findings.
Once deployed, the MCP endpoint is:
```text
https://<space-subdomain>.hf.space/gradio_api/mcp/
```
Gradio derives the single MCP tool from `scan_code` and its bounded docstring.
## Exact offline scanner artifact
The Space vendors the exact public Whitehack tarball as base64 text so the
artifact remains transparent, auditable, and exactly reconstructable through
repository MCP write operations. At process start it:
1. decodes strict base64;
2. requires decoded size `87,196`;
3. requires SHA-256
`b7d004947bc3c7619daa38f002d9ddde731e2865644af0d0e609c8dd86528d3c`;
4. safely extracts only regular files/directories into a private temporary
directory with member-count and size ceilings;
5. verifies package name, version, runtime dependency absence, lifecycle-script
absence, core, and licence before starting the UI.
There is no npm or other runtime artifact download. Gradio is pinned to 6.21.0
and the Space requests Python 3.12. Hugging Face's `nodejs` system package is not
an exact Node patch pin, so the bridge checks the package-supported boundary
(`>=18`) at runtime; this is a declared limit of choosing the official Gradio
Space/MCP path over a custom Docker image. Gradio's transitive Python
dependencies and the hosted base image are also resolved by the Space builder,
not locked here as a fully hashed environment.
The upstream package is self-contained and MIT licensed. Its preserved manifest
and licence notice are under `vendor/` and `THIRD_PARTY_NOTICES.md`.
## Local verification
The scanner tests require Node 18 or newer; the Python tests use only the
standard library:
```sh
python3 -m unittest discover -s tests -v
python3 -m py_compile app.py flashlight.py
node --check bridge.mjs
```
Installing the UI locally is optional:
```sh
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -r requirements.txt
python3 app.py
```
## Authority
GitHub and the exact Whitehack release remain source and release authority.
This Space is a narrow public adapter, not a fork of Whitehack and not an
authority over the submitted code.