mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-23 00:20:55 +08:00
Compare commits
48
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f6aaef02a | ||
|
|
2677ff32ef | ||
|
|
8bacfc0245 | ||
|
|
90cd290d42 | ||
|
|
449065aaaa | ||
|
|
5df46e22c1 | ||
|
|
83b35f844b | ||
|
|
9d7983f1a2 | ||
|
|
3ca8f217a3 | ||
|
|
132af98029 | ||
|
|
6ef01d4f24 | ||
|
|
f72311994e | ||
|
|
4171a041e6 | ||
|
|
db867f63a4 | ||
|
|
d59227c5d4 | ||
|
|
f37d09e365 | ||
|
|
5ce7ae6006 | ||
|
|
7b8be967cc | ||
|
|
09eb73c547 | ||
|
|
43ace17ad7 | ||
|
|
4f4bf201f7 | ||
|
|
444bca59d5 | ||
|
|
d86b22719a | ||
|
|
1e7696c572 | ||
|
|
f4c7184dcc | ||
|
|
0c55774613 | ||
|
|
a133b79a0e | ||
|
|
19110a4727 | ||
|
|
c8b771881e | ||
|
|
0eb66f4c44 | ||
|
|
9a8f366574 | ||
|
|
5bed53b6ae | ||
|
|
25217afdce | ||
|
|
a4a2ee4a51 | ||
|
|
cc573132c4 | ||
|
|
ca9aef6692 | ||
|
|
09a28a3bf8 | ||
|
|
55e2a4d037 | ||
|
|
8b4f890e61 | ||
|
|
ff287467aa | ||
|
|
c65034c50f | ||
|
|
df9536b7e5 | ||
|
|
e435b6b0bd | ||
|
|
1adfc21346 | ||
|
|
c90e2c980c | ||
|
|
b56ad38b43 | ||
|
|
b5bf99f5fb | ||
|
|
61478bb90b |
+7
-1
@@ -1,5 +1,6 @@
|
||||
# Docker deployment configuration (copy to .env)
|
||||
# The image is built locally by `docker compose build`; there is no registry tag.
|
||||
# docker-compose.yml builds the image locally. docker-compose.ghcr.yml pulls the
|
||||
# released GHCR image; pin it with ARTEX_IMAGE_TAG (latest or a vX.Y.Z tag).
|
||||
# Address the web UI is published on. 127.0.0.1 keeps it host-local; set 0.0.0.0
|
||||
# to reach it from another machine or from Windows when ARTEX runs inside WSL.
|
||||
ARTEX_BIND_ADDR=127.0.0.1
|
||||
@@ -11,8 +12,13 @@ ARTEX_TRUSTED_PROXIES=
|
||||
# Set it when ./keys is not persistent. Losing the key loses the stored secrets.
|
||||
# ARTEX_SECRET_KEY=
|
||||
POSTGRES_USER=artex
|
||||
# The server percent-encodes this into the connection URL, so / ? % @ : and
|
||||
# spaces are safe. Quote a value that contains #, and write $$ for a literal $,
|
||||
# because Compose reads this file that way.
|
||||
POSTGRES_PASSWORD=change-me-please
|
||||
POSTGRES_DB=artex
|
||||
# Prebuilt GHCR image tag for docker-compose.ghcr.yml. Unset uses latest.
|
||||
# ARTEX_IMAGE_TAG=latest
|
||||
|
||||
# LLM (fill one or both; you can also leave empty and configure in the UI)
|
||||
ANTHROPIC_API_KEY=
|
||||
|
||||
@@ -73,12 +73,12 @@ jobs:
|
||||
with:
|
||||
name: pkg-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: "dist/*.zip"
|
||||
# Upload raw Linux binaries separately for reuse by the docker job (avoids rebuilding the frontend + Go inside the image)
|
||||
- if: matrix.goos == 'linux'
|
||||
# Upload the raw linux/amd64 binary separately for the release job's Syft SBOM scan
|
||||
- if: matrix.goos == 'linux' && matrix.goarch == 'amd64'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bin-linux-${{ matrix.goarch }}
|
||||
path: dist/artex-linux-${{ matrix.goarch }}/artex
|
||||
name: bin-linux-amd64
|
||||
path: dist/artex-linux-amd64/artex
|
||||
|
||||
# ③ Collect all zips → create the GitHub Release
|
||||
release:
|
||||
@@ -152,45 +152,52 @@ jobs:
|
||||
generate_release_notes: false
|
||||
body_path: ${{ runner.temp }}/release-body.md
|
||||
|
||||
# ④ Multi-arch image → push to Docker Hub (reuses the Linux binaries built by the
|
||||
# binaries job; the image only installs tools + ships the binary; arm64 only needs
|
||||
# to emulate the apt layer, so builds are much faster)
|
||||
# Publishing the image needs Docker Hub credentials and a namespace we own, so the
|
||||
# job stays skipped unless the repository defines DOCKERHUB_ENABLED (set it to true
|
||||
# and provide DOCKERHUB_USERNAME / DOCKERHUB_TOKEN secrets plus DOCKERHUB_IMAGE).
|
||||
# ④ Multi-arch image → push to GitHub Container Registry (and optionally Docker Hub
|
||||
# when DOCKERHUB_ENABLED is set to 'true' alongside DOCKERHUB_IMAGE and
|
||||
# DOCKERHUB_USERNAME / DOCKERHUB_TOKEN secrets). Dry runs (workflow_dispatch)
|
||||
# build both platforms without logging in or pushing.
|
||||
docker:
|
||||
needs: binaries
|
||||
if: ${{ vars.DOCKERHUB_ENABLED == 'true' && github.event_name == 'push' }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4 # fetch the Dockerfile and skills/
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bin-linux-amd64
|
||||
path: dist/amd64
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bin-linux-arm64
|
||||
path: dist/arm64
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/login-action@v3
|
||||
- name: Log in to GitHub Container Registry
|
||||
if: github.event_name == 'push'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Log in to Docker Hub
|
||||
if: github.event_name == 'push' && vars.DOCKERHUB_ENABLED == 'true'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ${{ vars.DOCKERHUB_IMAGE }}
|
||||
images: |
|
||||
ghcr.io/${{ github.repository }}
|
||||
${{ vars.DOCKERHUB_ENABLED == 'true' && vars.DOCKERHUB_IMAGE || '' }}
|
||||
tags: |
|
||||
type=ref,event=tag
|
||||
type=semver,pattern={{version}}
|
||||
type=raw,value=latest
|
||||
- uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: ARTEX_VERSION=${{ github.ref_name }}
|
||||
provenance: true
|
||||
sbom: true
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
@@ -2,6 +2,20 @@
|
||||
|
||||
All notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Live log subscribers can no longer crash the process**: a client disconnect closes its log channel. The sink now delivers a line while it still holds the subscriber lock, so that close cannot land in the middle of the send.
|
||||
- **Notification delivery ignores HTTP_PROXY**: the dial guard checks the address it connects to. An environment proxy made that address the proxy, so a link-local target could still be reached. Notification HTTP now connects directly.
|
||||
- **Captured traffic blobs are owner-only**: HTTP and raw-stream bodies spilled out of the database are written `0600`, and their bucket directory is `0700`. An existing blob is tightened when it is seen again.
|
||||
- **Asset URLs drop userinfo when parsing fails**: a URL `url.Parse` rejects is no longer stored unchanged. The `scheme://userinfo@` prefix is removed first, so a password in that prefix does not land in the asset row.
|
||||
- **Hook `range` counts against the memory budget**: ranging over a body, slice, string, or map charges the iteration before the loop. A body larger than the hook budget now stops with the memory limit instead of allocating one element at a time with no check.
|
||||
- **Chat upload name search stops**: choosing `name`, `name-1`, `name-2`, … now returns an error when the filesystem rejects the path or after 10000 collisions, instead of looping while `Stat` keeps failing.
|
||||
- **Uploads do not follow a symlink**: chat and workspace uploads `Lstat` the destination and refuse to write when it is already a symlink. A dangling link is no longer treated as a free name.
|
||||
- **Hardening follow-up for the upload and capture fixes**: existing spill blob directories and files are tightened on startup, hook `range` charges 32 bytes per pair, and uploads open with `O_NOFOLLOW` on Unix. The Windows upload path keeps the `Lstat` check.
|
||||
- **Docker Compose database passwords with URL-special characters**: `docker-compose.yml` no longer pastes `POSTGRES_PASSWORD` into `ARTEX_PG_DSN`. The server builds the URL from `ARTEX_PG_HOST`, `ARTEX_PG_PORT`, `ARTEX_PG_USER`, `ARTEX_PG_PASSWORD`, `ARTEX_PG_DBNAME` and `ARTEX_PG_SSLMODE`, percent-encoding the user and password, so `/`, `?`, `%`, `@`, `:` and spaces connect. An explicit `ARTEX_PG_DSN` still wins and is not rewritten. `ARTEX_PG_PASSWORD` is removed from the environment with the other startup secrets (#450).
|
||||
|
||||
## [0.7.0] - 2026-11-21
|
||||
|
||||
Agent-driven traffic capture (SOCKS5, transparent TCP and raw UDP), operator tampering hooks with their admin panel, the agentic injection and proof hardening from the #124 audit, LLM context telemetry and the worker cache-prefix split, capture-proxy rewrite rules, HAR import and export, and a large security batch across the interception gate, sessions, logs, the workspace file API and the model endpoint probe.
|
||||
|
||||
+5
-4
@@ -22,10 +22,11 @@ COPY web/ ./
|
||||
RUN npm run build:static
|
||||
|
||||
# ------------------------------------------------------------- Go binary ---
|
||||
# Pinned to the Go 1.26 line (matches go.mod and the release binaries job). The
|
||||
# binary is CGO-free, so this stage runs on the build platform and cross-compiles
|
||||
# to $TARGETARCH without QEMU.
|
||||
FROM --platform=$BUILDPLATFORM golang:1.26-bookworm AS build
|
||||
# Pinned to the exact Go release go.mod requires. The official image sets
|
||||
# GOTOOLCHAIN=local, so a floating 1.26 tag that lags go.mod fails the build;
|
||||
# bump this together with the go line in go.mod. The binary is CGO-free, so this
|
||||
# stage runs on the build platform and cross-compiles to $TARGETARCH without QEMU.
|
||||
FROM --platform=$BUILDPLATFORM golang:1.26.11-bookworm AS build
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
@@ -57,8 +57,9 @@ printed at startup:
|
||||
docker compose logs artex | grep "Setup token"
|
||||
```
|
||||
|
||||
> There is no prebuilt Docker image to pull: the image is always built from your checkout.
|
||||
> For all installation paths (script, binaries, source, release archives), see [Installation](#installation).
|
||||
> Multi-arch release images (`linux/amd64`, `linux/arm64`) are published to GitHub Container
|
||||
> Registry at `ghcr.io/baarai/artex`. For pulling the prebuilt image and all other installation
|
||||
> paths (script, binaries, source, release archives), see [Installation](#installation).
|
||||
|
||||
---
|
||||
|
||||
@@ -331,7 +332,9 @@ The UI listens on `127.0.0.1` by default. To reach it from another machine (or f
|
||||
ARTEX runs inside WSL), set `ARTEX_BIND_ADDR=0.0.0.0` in `.env` (the setup token still protects the
|
||||
first-run claim), or keep loopback and use a reverse proxy or SSH tunnel.
|
||||
|
||||
### Option 2: Docker Compose (manual)
|
||||
### Option 2: Docker (Compose checkout build or prebuilt GHCR image)
|
||||
|
||||
Build from a checkout with Docker Compose:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/BaaRai/ARTEX.git
|
||||
@@ -341,8 +344,73 @@ docker compose up -d --build
|
||||
# → http://localhost:8787
|
||||
```
|
||||
|
||||
Each `v*` release publishes a multi-arch image (`linux/amd64`, `linux/arm64`) to GitHub
|
||||
Container Registry with tags `:latest`, `:v<version>`, and `:<version>`. GHCR packages start
|
||||
private. After the first release, maintainers should check that the `artex` package visibility
|
||||
is set to Public and verify the pull below on a machine without GHCR credentials before
|
||||
announcing anonymous installation.
|
||||
|
||||
The standalone container requires an existing PostgreSQL database reachable from the container.
|
||||
Set the `ARTEX_PG_*` variables below. The example uses Docker Desktop's
|
||||
`host.docker.internal` to reach PostgreSQL on the host. On native Linux Docker Engine, add
|
||||
`--add-host=host.docker.internal:host-gateway` to `docker run` for a host database, or use
|
||||
the reachable hostname of your database server.
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/baarai/artex:latest
|
||||
|
||||
mkdir -p data keys
|
||||
docker run -d --name artex \
|
||||
--security-opt no-new-privileges:true \
|
||||
-p 127.0.0.1:8787:8787 \
|
||||
-p 127.0.0.1:8788:8788 \
|
||||
-e ARTEX_PG_HOST=host.docker.internal \
|
||||
-e ARTEX_PG_PORT=5432 \
|
||||
-e ARTEX_PG_USER=artex \
|
||||
-e ARTEX_PG_PASSWORD='yourpass' \
|
||||
-e ARTEX_PG_DBNAME=artex \
|
||||
-e ARTEX_PG_SSLMODE=disable \
|
||||
-e ARTEX_JWT_KEY_DIR=/app/keys \
|
||||
-v "$PWD/data:/app/data" \
|
||||
-v "$PWD/keys:/app/keys" \
|
||||
ghcr.io/baarai/artex:latest
|
||||
# → http://localhost:8787 (docker logs artex | grep "Setup token")
|
||||
```
|
||||
|
||||
In `docker-compose.yml` and `docker-compose.ghcr.yml`, `POSTGRES_PASSWORD` is passed to ARTEX as
|
||||
its own variable. The server percent-encodes it into the connection URL, so a password may contain
|
||||
`/`, `?`, `%`, `@`, `:` or spaces. In `.env`, quote a value that contains `#`, and write `$$` for a
|
||||
literal `$`. The `ARTEX_PG_*` variables take the password raw; quote it in a shell.
|
||||
|
||||
The image includes a scanner toolchain (`nmap`, `nuclei`, `httpx`, `katana`, `ffuf`, `dalfox`,
|
||||
`sqlmap`, `ripgrep`, `curl`, `npm`, …); `./skills` and `./data` are persisted via bind mounts.
|
||||
`sqlmap`, `ripgrep`, `curl`, `npm`, …) and built-in `/app/skills`. The GHCR Compose file below
|
||||
persists `./keys` and `./data`; it does not mount a host `skills/` directory, so the image's
|
||||
built-in skills are used.
|
||||
|
||||
#### Compose stack from the prebuilt image
|
||||
|
||||
`docker-compose.ghcr.yml` runs the same ARTEX + PostgreSQL stack from the released image, with no
|
||||
checkout build. Download it and `.env.example` once:
|
||||
|
||||
```bash
|
||||
curl -fsSLO https://raw.githubusercontent.com/BaaRai/ARTEX/main/docker-compose.ghcr.yml
|
||||
curl -fsSLO https://raw.githubusercontent.com/BaaRai/ARTEX/main/.env.example
|
||||
cp .env.example .env # set POSTGRES_PASSWORD, optionally an LLM key
|
||||
docker compose -f docker-compose.ghcr.yml pull
|
||||
docker compose -f docker-compose.ghcr.yml up -d
|
||||
# → http://localhost:8787 (docker compose -f docker-compose.ghcr.yml logs artex | grep "Setup token")
|
||||
```
|
||||
|
||||
Update the stack without a git checkout:
|
||||
|
||||
```bash
|
||||
docker compose -f docker-compose.ghcr.yml pull
|
||||
docker compose -f docker-compose.ghcr.yml up -d
|
||||
```
|
||||
|
||||
Pin a version with `ARTEX_IMAGE_TAG=v0.7.1` in `.env` (or `0.7.1`); unset uses `latest`. To use
|
||||
custom skills, copy them into a host directory and add `- ./skills:/app/skills` to the `artex`
|
||||
volumes, which overrides the built-in `/app/skills`.
|
||||
|
||||
For remote MCP you can choose `http` (Streamable HTTP) or `sse` (legacy SSE) in system settings.
|
||||
Legacy SSE servers usually establish the event stream with `GET /sse` and receive JSON-RPC over
|
||||
@@ -405,7 +473,7 @@ runtime supports it.
|
||||
|
||||
## Configuration
|
||||
|
||||
**Database** (`config.json`, or the `ARTEX_PG_DSN` environment variable):
|
||||
**Database** (`config.json`, `ARTEX_PG_DSN`, or `ARTEX_PG_*` environment variables — see [External PostgreSQL](#external-postgresql)):
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -490,6 +558,70 @@ from the defaults until a worker finishes in this process.
|
||||
**Common flags**: `./start.sh -addr :8787 -proxy :8788` (`-addr` frontend/API, `-proxy` traffic
|
||||
recording proxy).
|
||||
|
||||
### External PostgreSQL
|
||||
|
||||
ARTEX already supports an external PostgreSQL 16+ instance — the `postgres` service in
|
||||
`docker-compose.yml` is only the bundled default. Because the database is startup configuration and
|
||||
the system's single source of truth, there is no runtime database switcher in the UI: change the
|
||||
environment variables and restart the server to point at another instance.
|
||||
|
||||
Configure the connection with either a full connection string or individual parts:
|
||||
|
||||
- **`ARTEX_PG_DSN`**: full PostgreSQL connection URL (for example
|
||||
`postgres://artex:pass@db.example.internal:5432/artex?sslmode=require`). When set, it takes
|
||||
precedence over the `ARTEX_PG_*` variables and you are responsible for percent-encoding any
|
||||
URL-special characters in the username or password.
|
||||
- **`ARTEX_PG_*` parts** (recommended when passwords contain `/`, `?`, `%`, `@`, `:`, or spaces —
|
||||
ARTEX percent-encodes the user and password and removes `ARTEX_PG_PASSWORD` from the environment
|
||||
at startup):
|
||||
- `ARTEX_PG_HOST` — PostgreSQL host
|
||||
- `ARTEX_PG_PORT` — PostgreSQL port (default `5432`)
|
||||
- `ARTEX_PG_USER` — database user
|
||||
- `ARTEX_PG_PASSWORD` — database password (raw, not URL-encoded)
|
||||
- `ARTEX_PG_DBNAME` — database name
|
||||
- `ARTEX_PG_SSLMODE` — TLS mode (`disable`, `require`, `verify-ca`, `verify-full`)
|
||||
|
||||
#### Compose without the bundled `postgres` service
|
||||
|
||||
To run ARTEX against an external PostgreSQL server with Docker Compose, remove the `postgres`
|
||||
service, the `depends_on` block, and the `pgdata` volume from `docker-compose.yml`, and point
|
||||
`artex` at your database:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
artex:
|
||||
image: ghcr.io/baarai/artex:latest
|
||||
security_opt:
|
||||
- "no-new-privileges:true"
|
||||
environment:
|
||||
# Option A: individual parts (recommended; percent-encodes special characters)
|
||||
ARTEX_PG_HOST: ${ARTEX_PG_HOST:?Set ARTEX_PG_HOST in .env}
|
||||
ARTEX_PG_PORT: ${ARTEX_PG_PORT:-5432}
|
||||
ARTEX_PG_USER: ${ARTEX_PG_USER:-artex}
|
||||
ARTEX_PG_PASSWORD: ${ARTEX_PG_PASSWORD:?Set ARTEX_PG_PASSWORD in .env}
|
||||
ARTEX_PG_DBNAME: ${ARTEX_PG_DBNAME:-artex}
|
||||
ARTEX_PG_SSLMODE: ${ARTEX_PG_SSLMODE:-require}
|
||||
# Option B: full DSN (overrides ARTEX_PG_* when set)
|
||||
# ARTEX_PG_DSN: ${ARTEX_PG_DSN}
|
||||
ARTEX_JWT_KEY_DIR: /app/keys
|
||||
ports:
|
||||
- "${ARTEX_BIND_ADDR:-127.0.0.1}:8787:8787"
|
||||
- "127.0.0.1:8788:8788"
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
- ./keys:/app/keys
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
#### Local disk usage (`data/`)
|
||||
|
||||
Moving PostgreSQL to an external host does **not** move the runtime `data/` directory off local
|
||||
disk. `data/` still stores spilled HTTP/TCP traffic blobs (`data/traffic/_blobs`), LLM
|
||||
transcripts, task working files, and local task archives, so heavy workloads can still fill the
|
||||
host disk if `data/` is on a small volume. Mount `data/` on a suitably sized volume, and consider
|
||||
setting `ARTEX_ARCHIVE_STORAGE=s3` (see [Task archive storage](docs/task-archive-storage.md)) to
|
||||
offload cold task archives to object storage.
|
||||
|
||||
### Reverse proxy deployment (HTTPS / exposing only 443)
|
||||
|
||||
The frontend, API and SSE stream share port 8787 (the binary listens on `127.0.0.1:8787` by
|
||||
@@ -643,7 +775,7 @@ The script optionally `git pull`s, then offers **① Docker update** (`docker co
|
||||
`docker compose up -d artex`) or **② local build update** (rebuild the frontend static assets, then
|
||||
recompile `./artex`; restart the process for it to take effect).
|
||||
|
||||
#### Option 2: Docker Compose (manual)
|
||||
#### Option 2: Docker (Compose or GHCR image)
|
||||
|
||||
```bash
|
||||
cd ARTEX
|
||||
@@ -653,6 +785,15 @@ docker compose up -d artex
|
||||
docker image prune -f # optional
|
||||
```
|
||||
|
||||
If running the prebuilt `ghcr.io/baarai/artex` container directly, pull the new tag (`docker pull
|
||||
ghcr.io/baarai/artex:latest` or a pinned `:v<version>`) and recreate the container with the same
|
||||
`/app/data` and `/app/keys` mounts. If you run the prebuilt Compose stack, the update is:
|
||||
|
||||
```bash
|
||||
docker compose -f docker-compose.ghcr.yml pull
|
||||
docker compose -f docker-compose.ghcr.yml up -d
|
||||
```
|
||||
|
||||
#### Option 3: prebuilt binaries
|
||||
|
||||
Download the new zip, stop the old process, overwrite `artex` and `skills/` (keep `config.json` and
|
||||
|
||||
@@ -20,10 +20,6 @@ type TrafficCaptureChecker interface {
|
||||
TrafficExists(ctx context.Context, trafficID string) (bool, error)
|
||||
}
|
||||
|
||||
// Tool-use guidance is appended without replacing the user's editable prompt.
|
||||
// It does not require capture or claim that unavailable traffic tools exist.
|
||||
const findingTrafficGuidance = "\n\n**Vulnerability traffic evidence**: when reporting a vulnerability via report_finding, bind real HTTP request/response IDs via traffic_refs in reproduction order; domains and times are only candidate filters and do not imply association. A finding without bound traffic stays recorded and visible, but cannot close a goal via prove_goal until verified traffic matching its asset host is bound (via report_finding or bind_finding_traffic). For TCP and other non-HTTP vulnerabilities, when nothing was captured, or when there is no exact match, omit traffic_refs or pass [], keep verifiable command output and logs in evidence, and close non-HTTP goals with an observed tool_output fact. Do not guess IDs, and do not re-probe just to capture packets."
|
||||
|
||||
func (t *ToolSet) SetFindingRecorder(r FindingRecorder) { t.findingRecorder = r }
|
||||
func (w *Worker) SetFindingRecorder(r FindingRecorder) { w.findingRecorder = r }
|
||||
func (p *Planner) SetFindingRecorder(r FindingRecorder) { p.findingRecorder = r }
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"go/ast"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFindingRecorderHasNoLegacyTrafficGuidance(t *testing.T) {
|
||||
// Check the declaration directly: an unused constant cannot affect prompt output.
|
||||
f, err := parser.ParseFile(token.NewFileSet(), "finding_recorder.go", nil, parser.SkipObjectResolution)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ast.Inspect(f, func(n ast.Node) bool {
|
||||
if spec, ok := n.(*ast.ValueSpec); ok {
|
||||
for _, name := range spec.Names {
|
||||
if name.Name == "findingTrafficGuidance" {
|
||||
t.Fatal("finding_recorder.go declares the obsolete findingTrafficGuidance constant")
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
@@ -43,10 +43,82 @@ func findingTrafficBindingEnabled() bool {
|
||||
return f != nil && f()
|
||||
}
|
||||
|
||||
var (
|
||||
trafficCaptureMu sync.RWMutex
|
||||
trafficCaptureHook func() bool
|
||||
)
|
||||
|
||||
// SetTrafficCaptureEnabled installs (or, with nil, removes) the hook that
|
||||
// reports whether the server's global traffic capture switch is currently on.
|
||||
func SetTrafficCaptureEnabled(f func() bool) {
|
||||
trafficCaptureMu.Lock()
|
||||
trafficCaptureHook = f
|
||||
trafficCaptureMu.Unlock()
|
||||
}
|
||||
|
||||
// TrafficCaptureEnabled returns the current hook, or nil when none is set.
|
||||
func TrafficCaptureEnabled() func() bool {
|
||||
trafficCaptureMu.RLock()
|
||||
defer trafficCaptureMu.RUnlock()
|
||||
return trafficCaptureHook
|
||||
}
|
||||
|
||||
func trafficCaptureExplicitlyOff() bool {
|
||||
f := TrafficCaptureEnabled()
|
||||
return f != nil && !f()
|
||||
}
|
||||
|
||||
const (
|
||||
trafficCaptureOffProveGoalNote = "\nNote: traffic capture is currently OFF on this server, so no HTTP traffic is being recorded and findings cannot be bound to captured traffic to prove HTTP goals. Recorded findings stay visible, and non-HTTP goals can still be proved with an observed tool_output fact; enable traffic capture in System settings to make HTTP findings provable."
|
||||
trafficCaptureOffReportFindingNote = "\nNote: traffic capture is currently OFF on this server, so no HTTP traffic is being recorded. Findings still save with textual/command evidence, but cannot prove goals via prove_goal until traffic capture is enabled in System settings and verified traffic is bound."
|
||||
)
|
||||
|
||||
func trafficCaptureOffToolNote(toolName string, captureOff bool) string {
|
||||
if !captureOff {
|
||||
return ""
|
||||
}
|
||||
switch toolName {
|
||||
case "prove_goal":
|
||||
return trafficCaptureOffProveGoalNote
|
||||
case "report_finding":
|
||||
return trafficCaptureOffReportFindingNote
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// Automatic traffic binding off is a DIFFERENT switch from capture off: capture
|
||||
// can be on while binding is off, and then the disabled branch below strips
|
||||
// bind_finding_traffic and every traffic parameter from the schemas while the
|
||||
// tool descriptions keep promising the binding path. An agent then chases a tool
|
||||
// that is not in its toolset (observed: "the tool bind_finding_traffic must be
|
||||
// invoked as a tool", a bare Bash true, then grepping the transcripts and the
|
||||
// binary). These notes ride on the tool descriptions, exactly like the capture
|
||||
// notes above, so the standing guidance stays empty when the feature is off.
|
||||
const (
|
||||
findingBindingOffProveGoalNote = "\nNote: automatic traffic binding is OFF on this server, so a finding cannot be bound to captured traffic here and cannot close an HTTP goal. Recorded findings stay visible; non-HTTP goals still close with an observed tool_output fact. An operator can enable binding (System settings) or bind captured traffic manually on the finding page, after which a bound finding closes the goal."
|
||||
findingBindingOffReportFindingNote = "\nNote: automatic traffic binding is OFF on this server, so report_finding carries no traffic parameters and the bind_finding_traffic tool is not in your toolset. Findings still save with their evidence, but stay unverified and cannot prove a goal. Register a reproducible PoC in evidence as usual; do not guess traffic IDs and do not re-probe only to capture packets."
|
||||
findingBindingOffHintNote = "\nNote: automatic traffic binding is OFF on this server, so hint traffic parameters are not in this schema. Keep the verified evidence and the known real traffic IDs in the hint text; the receiving task registers the finding and the operator can bind captured traffic later."
|
||||
)
|
||||
|
||||
func findingBindingOffToolNote(toolName string) string {
|
||||
switch toolName {
|
||||
case "prove_goal":
|
||||
return findingBindingOffProveGoalNote
|
||||
case "report_finding":
|
||||
return findingBindingOffReportFindingNote
|
||||
case "add_hint", "add_task_hint":
|
||||
return findingBindingOffHintNote
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// Applied after ToolResolve: user descriptions and prompts remain intact, while
|
||||
// all actual reporters (including Planner and custom chat agents) see the same
|
||||
// API contract. Disabled/unbound tools are never reintroduced here.
|
||||
func findingWorkflowTools(agentKey string, tools []actool.CoreTool) ([]actool.CoreTool, string) {
|
||||
captureOff := trafficCaptureExplicitlyOff()
|
||||
if !findingTrafficBindingEnabled() {
|
||||
out := make([]actool.CoreTool, 0, len(tools))
|
||||
for _, tool := range tools {
|
||||
@@ -56,18 +128,36 @@ func findingWorkflowTools(agentKey string, tools []actool.CoreTool) ([]actool.Co
|
||||
if agentKey == "reporter" && (tool.Name() == "traffic_search" || tool.Name() == "traffic_get" || tool.Name() == "traffic_blob" || tool.Name() == "traffic_messages") {
|
||||
continue
|
||||
}
|
||||
desc := tool.Description()
|
||||
schema := tool.InputSchema()
|
||||
decorated := false
|
||||
switch tool.Name() {
|
||||
case "report_finding", "add_hint", "add_task_hint":
|
||||
// Work on a copy: toggling back on must restore the original schema.
|
||||
raw, _ := json.Marshal(tool.InputSchema())
|
||||
var schema map[string]any
|
||||
if json.Unmarshal(raw, &schema) == nil {
|
||||
stripTrafficParameters(schema)
|
||||
tool = DecorateTool(tool, tool.Description(), schema)
|
||||
var s map[string]any
|
||||
if json.Unmarshal(raw, &s) == nil {
|
||||
stripTrafficParameters(s)
|
||||
schema = s
|
||||
decorated = true
|
||||
}
|
||||
}
|
||||
if note := trafficCaptureOffToolNote(tool.Name(), captureOff); note != "" {
|
||||
desc += note
|
||||
decorated = true
|
||||
}
|
||||
if note := findingBindingOffToolNote(tool.Name()); note != "" {
|
||||
desc += note
|
||||
decorated = true
|
||||
}
|
||||
if decorated {
|
||||
tool = DecorateTool(tool, desc, schema)
|
||||
}
|
||||
out = append(out, tool)
|
||||
}
|
||||
// The standing guidance stays empty: the binding-off notes ride on the
|
||||
// tool descriptions, so a disabled deployment keeps the same contract the
|
||||
// PG test asserts (def.FindingGuidance == "").
|
||||
return out, ""
|
||||
}
|
||||
out := append([]actool.CoreTool(nil), tools...)
|
||||
@@ -83,6 +173,9 @@ func findingWorkflowTools(agentKey string, tools []actool.CoreTool) ([]actool.Co
|
||||
case "get_finding_traffic", "bind_finding_traffic", "list_findings", "list_task_findings", "node_detail", "get_task_node_detail", "update_finding_report":
|
||||
note = findingIDGuidance
|
||||
}
|
||||
if capNote := trafficCaptureOffToolNote(tool.Name(), captureOff); capNote != "" {
|
||||
note += capNote
|
||||
}
|
||||
if note != "" {
|
||||
out[i] = DecorateTool(tool, tool.Description()+note, tool.InputSchema())
|
||||
}
|
||||
|
||||
@@ -39,6 +39,29 @@ func TestFindingWorkflowSharedAssemblyAndSwitch(t *testing.T) {
|
||||
if strings.Contains(system[0], "traffic_refs") != on {
|
||||
t.Fatalf("%s: guidance ignored switch: %v", role, on)
|
||||
}
|
||||
if !on {
|
||||
// The switch strips the tool and the schema, so the tool descriptions
|
||||
// must say so: otherwise the agent chases bind_finding_traffic, which
|
||||
// is not in its toolset, and burns turns on it.
|
||||
if def.FindingGuidance != "" {
|
||||
t.Fatalf("%s: disabled deployment must keep the standing guidance empty, got %q", role, def.FindingGuidance)
|
||||
}
|
||||
noted := false
|
||||
for _, tool := range out {
|
||||
if !strings.Contains(tool.Description(), "automatic traffic binding is OFF") {
|
||||
continue
|
||||
}
|
||||
noted = true
|
||||
// The tool that carries traffic parameters is the one whose
|
||||
// schema lost them, so it must name the absent tool.
|
||||
if tool.Name() == "report_finding" && !strings.Contains(tool.Description(), "bind_finding_traffic") {
|
||||
t.Fatalf("%s: report_finding note must name the absent tool", role)
|
||||
}
|
||||
}
|
||||
if !noted {
|
||||
t.Fatalf("%s: disabled deployment must state on the tools that binding is off", role)
|
||||
}
|
||||
}
|
||||
if on && (!strings.Contains(system[0], "TCP") || !strings.Contains(system[0], "evidence_hint_id")) {
|
||||
t.Fatal("missing optional/handoff contract")
|
||||
}
|
||||
@@ -70,3 +93,54 @@ func TestFindingWorkflowSharedAssemblyAndSwitch(t *testing.T) {
|
||||
t.Fatal("reintroduced disabled tool or its guidance")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFindingWorkflowToolsTrafficCaptureOffNotice(t *testing.T) {
|
||||
oldPolicy, oldCapture, oldResolve, oldAugment := FindingTrafficBindingEnabled(), TrafficCaptureEnabled(), ToolResolve(), ToolAugment()
|
||||
t.Cleanup(func() {
|
||||
SetFindingTrafficBindingEnabled(oldPolicy)
|
||||
SetTrafficCaptureEnabled(oldCapture)
|
||||
SetToolResolve(oldResolve)
|
||||
SetToolAugment(oldAugment)
|
||||
})
|
||||
SetToolAugment(nil)
|
||||
SetToolResolve(nil)
|
||||
ts := NewToolSet(nil, "fixture")
|
||||
base := []actool.CoreTool{ts.proveGoal(), ts.addFinding(), ts.addHint()}
|
||||
|
||||
for _, binding := range []bool{false, true} {
|
||||
SetFindingTrafficBindingEnabled(func() bool { return binding })
|
||||
|
||||
calls := 0
|
||||
SetTrafficCaptureEnabled(func() bool {
|
||||
calls++
|
||||
return false
|
||||
})
|
||||
outOff, _, clOff := AugmentTools(t.Context(), "planner", base)
|
||||
clOff()
|
||||
if calls != 1 {
|
||||
t.Fatalf("binding=%v: capture hook called %d times for %d tools, want 1", binding, calls, len(base))
|
||||
}
|
||||
for _, tool := range outOff {
|
||||
desc := tool.Description()
|
||||
switch tool.Name() {
|
||||
case "prove_goal", "report_finding":
|
||||
if !strings.Contains(desc, "traffic capture is currently OFF") {
|
||||
t.Fatalf("binding=%v %s: expected capture-off notice in description, got %q", binding, tool.Name(), desc)
|
||||
}
|
||||
case "add_hint":
|
||||
if strings.Contains(desc, "traffic capture is currently OFF") {
|
||||
t.Fatalf("binding=%v add_hint: unexpected capture-off notice", binding)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetTrafficCaptureEnabled(func() bool { return true })
|
||||
outOn, _, clOn := AugmentTools(t.Context(), "planner", base)
|
||||
clOn()
|
||||
for _, tool := range outOn {
|
||||
if strings.Contains(tool.Description(), "traffic capture is currently OFF") {
|
||||
t.Fatalf("binding=%v %s: unexpected capture-off notice when capture is ON", binding, tool.Name())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -1692,7 +1692,9 @@ func factEvidenceLines(evidence string) []string {
|
||||
}
|
||||
}
|
||||
return out
|
||||
} // factProvenance classifies one fact against the intent's recorded activity.
|
||||
}
|
||||
|
||||
// factProvenance classifies one fact against the intent's recorded activity.
|
||||
// Beyond the activity tie it checks whether the quoted bytes were captured
|
||||
// coming back from the target through the proxy, in which case the target
|
||||
// authored them and the fact is classified target_response even when the model
|
||||
|
||||
+39
-2
@@ -157,7 +157,15 @@ func SkillDir() (string, error) {
|
||||
|
||||
// PostgresDSN resolves the connection string with precedence:
|
||||
//
|
||||
// env ARTEX_PG_DSN > config file (database.dsn, or assembled from fields)
|
||||
// env ARTEX_PG_DSN
|
||||
// > env ARTEX_PG_HOST / ARTEX_PG_PORT / ARTEX_PG_USER / ARTEX_PG_PASSWORD /
|
||||
// ARTEX_PG_DBNAME / ARTEX_PG_SSLMODE
|
||||
// > config file (database.dsn, or assembled from fields)
|
||||
//
|
||||
// The component variables are how Docker Compose passes a password that contains
|
||||
// URL-special characters: the password stays a raw environment value, and
|
||||
// buildDSN percent-encodes it. An explicit ARTEX_PG_DSN is returned unchanged,
|
||||
// so a value that was already assembled by something else is not rewritten.
|
||||
//
|
||||
// There is NO built-in fallback: when neither source supplies a database config,
|
||||
// it returns an error naming the config path it inspected, so startup fails loudly
|
||||
@@ -167,6 +175,9 @@ func PostgresDSN() (dsn, source string, err error) {
|
||||
if v := strings.TrimSpace(os.Getenv("ARTEX_PG_DSN")); v != "" {
|
||||
return v, "environment variable ARTEX_PG_DSN", nil
|
||||
}
|
||||
if d, ok, err := postgresDSNFromEnv(); ok || err != nil {
|
||||
return d, "environment variables ARTEX_PG_HOST/USER/PASSWORD/DBNAME", err
|
||||
}
|
||||
c, err := Load()
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
@@ -178,7 +189,33 @@ func PostgresDSN() (dsn, source string, err error) {
|
||||
if db.Host != "" || db.DBName != "" || db.User != "" {
|
||||
return db.buildDSN(), "config file " + Path() + " (database fields)", nil
|
||||
}
|
||||
return "", "", fmt.Errorf("no database config found: the environment variable ARTEX_PG_DSN is not set, and config file %s provides no database (dsn or host/user/dbname). Create the config file or set the environment variable and retry", Path())
|
||||
return "", "", fmt.Errorf("no database config found: ARTEX_PG_DSN is not set, ARTEX_PG_HOST/USER/PASSWORD/DBNAME are not set, and config file %s provides no database (dsn or host/user/dbname). Create the config file or set the environment variable and retry", Path())
|
||||
}
|
||||
|
||||
// postgresDSNFromEnv assembles a URL from the component environment variables.
|
||||
// ok is false when none of them is set. The password is not trimmed: a space is
|
||||
// a legal character and is the case docker-compose used to break.
|
||||
func postgresDSNFromEnv() (dsn string, ok bool, err error) {
|
||||
host := strings.TrimSpace(os.Getenv("ARTEX_PG_HOST"))
|
||||
user := strings.TrimSpace(os.Getenv("ARTEX_PG_USER"))
|
||||
password := os.Getenv("ARTEX_PG_PASSWORD")
|
||||
dbname := strings.TrimSpace(os.Getenv("ARTEX_PG_DBNAME"))
|
||||
portStr := strings.TrimSpace(os.Getenv("ARTEX_PG_PORT"))
|
||||
ssl := strings.TrimSpace(os.Getenv("ARTEX_PG_SSLMODE"))
|
||||
if host == "" && user == "" && password == "" && dbname == "" && portStr == "" && ssl == "" {
|
||||
return "", false, nil
|
||||
}
|
||||
port := 0
|
||||
if portStr != "" {
|
||||
n, convErr := strconv.Atoi(portStr)
|
||||
if convErr != nil || n <= 0 || n > 65535 {
|
||||
return "", true, fmt.Errorf("ARTEX_PG_PORT %q is not a TCP port", portStr)
|
||||
}
|
||||
port = n
|
||||
}
|
||||
return Database{
|
||||
Host: host, Port: port, User: user, Password: password, DBName: dbname, SSLMode: ssl,
|
||||
}.buildDSN(), true, nil
|
||||
}
|
||||
|
||||
func (d Database) buildDSN() string {
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func clearPGComponentEnv(t *testing.T) {
|
||||
t.Helper()
|
||||
for _, k := range []string{
|
||||
"ARTEX_PG_HOST", "ARTEX_PG_PORT", "ARTEX_PG_USER", "ARTEX_PG_PASSWORD",
|
||||
"ARTEX_PG_DBNAME", "ARTEX_PG_SSLMODE",
|
||||
} {
|
||||
t.Setenv(k, "")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPostgresDSNPrecedence(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
cfgPath := filepath.Join(dir, "config.json")
|
||||
os.WriteFile(cfgPath, []byte(`{"database":{"host":"10.1.2.3","port":6000,"user":"u","password":"p","dbname":"d","sslmode":"require"}}`), 0o644)
|
||||
t.Setenv("ARTEX_CONFIG", cfgPath)
|
||||
clearPGComponentEnv(t)
|
||||
|
||||
// no env DSN → built from config file fields
|
||||
t.Setenv("ARTEX_PG_DSN", "")
|
||||
@@ -42,6 +54,53 @@ func TestPostgresDSNPrecedence(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPostgresDSNEncodesComponentPassword(t *testing.T) {
|
||||
clearPGComponentEnv(t)
|
||||
t.Setenv("ARTEX_PG_DSN", "")
|
||||
t.Setenv("ARTEX_CONFIG", filepath.Join(t.TempDir(), "nope.json"))
|
||||
const password = "p/ss w@rd?#%"
|
||||
t.Setenv("ARTEX_PG_HOST", "postgres")
|
||||
t.Setenv("ARTEX_PG_PORT", "5432")
|
||||
t.Setenv("ARTEX_PG_USER", "artex")
|
||||
t.Setenv("ARTEX_PG_PASSWORD", password)
|
||||
t.Setenv("ARTEX_PG_DBNAME", "artex")
|
||||
t.Setenv("ARTEX_PG_SSLMODE", "disable")
|
||||
|
||||
got, source, err := PostgresDSN()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(source, "ARTEX_PG_HOST") {
|
||||
t.Fatalf("source %q", source)
|
||||
}
|
||||
u, err := url.Parse(got)
|
||||
if err != nil {
|
||||
t.Fatalf("parse %q: %v", got, err)
|
||||
}
|
||||
pw, ok := u.User.Password()
|
||||
if !ok || pw != password || u.User.Username() != "artex" || u.Host != "postgres:5432" || u.Path != "/artex" {
|
||||
t.Fatalf("dsn %q decoded user=%q password=%q ok=%v host=%q path=%q", got, u.User.Username(), pw, ok, u.Host, u.Path)
|
||||
}
|
||||
if u.Query().Get("sslmode") != "disable" {
|
||||
t.Fatalf("sslmode %q", u.RawQuery)
|
||||
}
|
||||
if strings.Contains(got, password) {
|
||||
t.Fatalf("password left raw in %q", got)
|
||||
}
|
||||
|
||||
// An explicit URL is not rewritten, even when the component password is set.
|
||||
t.Setenv("ARTEX_PG_DSN", "postgres://already/set")
|
||||
if got, _, err = PostgresDSN(); err != nil || got != "postgres://already/set" {
|
||||
t.Fatalf("explicit DSN got %q err %v", got, err)
|
||||
}
|
||||
|
||||
t.Setenv("ARTEX_PG_DSN", "")
|
||||
t.Setenv("ARTEX_PG_PORT", "nope")
|
||||
if _, _, err = PostgresDSN(); err == nil || !strings.Contains(err.Error(), "ARTEX_PG_PORT") {
|
||||
t.Fatalf("bad port: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// A config file that exists but is not valid JSON must fail loudly, not run with
|
||||
// defaults (or report "no database config") as if the file were absent.
|
||||
func TestRedactMasksEveryDSNPasswordForm(t *testing.T) {
|
||||
@@ -66,6 +125,7 @@ func TestMalformedConfigIsAnError(t *testing.T) {
|
||||
os.WriteFile(cfgPath, []byte(`{"database":{"host":"h","password":"a"b","dbname":"d"},"skill_dir":"/s"}`), 0o644)
|
||||
t.Setenv("ARTEX_CONFIG", cfgPath)
|
||||
t.Setenv("ARTEX_PG_DSN", "")
|
||||
clearPGComponentEnv(t)
|
||||
t.Setenv("ARTEX_SKILL_DIR", "")
|
||||
|
||||
if _, _, err := PostgresDSN(); err == nil || !strings.Contains(err.Error(), "parse config file") {
|
||||
|
||||
+20
-1
@@ -165,7 +165,7 @@ func calcCSegment(ipStr string) string {
|
||||
func normalizeURL(raw string) string {
|
||||
u, err := url.Parse(raw)
|
||||
if err != nil {
|
||||
return raw
|
||||
return stripURLUserinfo(raw)
|
||||
}
|
||||
u.Scheme = strings.ToLower(u.Scheme)
|
||||
u.Host = strings.ToLower(u.Host)
|
||||
@@ -177,6 +177,25 @@ func normalizeURL(raw string) string {
|
||||
return s
|
||||
}
|
||||
|
||||
// stripURLUserinfo removes scheme://userinfo@ when url.Parse cannot. The
|
||||
// userinfo is the span before the last @ that still sits in the authority.
|
||||
func stripURLUserinfo(raw string) string {
|
||||
i := strings.Index(raw, "://")
|
||||
if i < 0 {
|
||||
return raw
|
||||
}
|
||||
rest := raw[i+3:]
|
||||
authEnd := len(rest)
|
||||
if j := strings.IndexAny(rest, "/?#"); j >= 0 {
|
||||
authEnd = j
|
||||
}
|
||||
at := strings.LastIndex(rest[:authEnd], "@")
|
||||
if at < 0 {
|
||||
return raw
|
||||
}
|
||||
return raw[:i+3] + rest[at+1:]
|
||||
}
|
||||
|
||||
// parseURL extracts domain, port, service_name from a URL.
|
||||
func parseURL(raw string) (domain string, port int, serviceName string) {
|
||||
u, err := url.Parse(raw)
|
||||
|
||||
@@ -908,6 +908,7 @@ func TestNormalizeURL(t *testing.T) {
|
||||
{"https://user@example.com/", "https://example.com"},
|
||||
{"https://u:p@example.com:8443/users/@alice?x=1", "https://example.com:8443/users/@alice?x=1"},
|
||||
{"https://example.com/@me?r=http://a:b@x/", "https://example.com/@me?r=http://a:b@x/"},
|
||||
{"http://user:secret@ex ample.com/a", "http://ex ample.com/a"},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
got := normalizeURL(tc.raw)
|
||||
|
||||
@@ -102,8 +102,9 @@ func coordinateWithSchemaMigration(tx *sql.Tx) error {
|
||||
}
|
||||
|
||||
// DSN resolves the PostgreSQL connection string and reports where it came from.
|
||||
// Precedence: env ARTEX_PG_DSN > config file (config.json). There is no
|
||||
// built-in default — it errors if neither source is configured.
|
||||
// Precedence: env ARTEX_PG_DSN > ARTEX_PG_HOST/USER/PASSWORD/DBNAME > config
|
||||
// file (config.json). There is no built-in default — it errors if no source
|
||||
// is configured.
|
||||
func DSN() (dsn, source string, err error) {
|
||||
return config.PostgresDSN()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# ARTEX from the published GHCR image, with the same PostgreSQL service as
|
||||
# docker-compose.yml. Use this file to run and update without a git checkout:
|
||||
#
|
||||
# docker compose -f docker-compose.ghcr.yml pull
|
||||
# docker compose -f docker-compose.ghcr.yml up -d
|
||||
#
|
||||
# Set POSTGRES_PASSWORD in .env. Pin the image with ARTEX_IMAGE_TAG=v0.7.1 in
|
||||
# .env; unset uses latest. The image carries the built-in /app/skills; this file
|
||||
# does not mount a host skills/ directory. To use custom skills, copy them into a
|
||||
# host directory and add `- ./skills:/app/skills` to the artex volumes.
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-artex}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Please set POSTGRES_PASSWORD in .env}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-artex}
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-artex} -d ${POSTGRES_DB:-artex}"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
restart: unless-stopped
|
||||
|
||||
artex:
|
||||
image: ghcr.io/baarai/artex:${ARTEX_IMAGE_TAG:-latest}
|
||||
# Agent processes run as an unprivileged executor (-exec-uid): no setuid program
|
||||
# or file capability may raise them back to root.
|
||||
security_opt:
|
||||
- "no-new-privileges:true"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
# Parts, not a pasted URL. PostgresDSN percent-encodes the password, so a
|
||||
# value with / ? % @ : or a space still connects.
|
||||
ARTEX_PG_HOST: postgres
|
||||
ARTEX_PG_PORT: "5432"
|
||||
ARTEX_PG_USER: ${POSTGRES_USER:-artex}
|
||||
ARTEX_PG_PASSWORD: ${POSTGRES_PASSWORD:?Please set POSTGRES_PASSWORD in .env}
|
||||
ARTEX_PG_DBNAME: ${POSTGRES_DB:-artex}
|
||||
ARTEX_PG_SSLMODE: disable
|
||||
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
|
||||
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
|
||||
ARTEX_LLM_PROVIDER: ${ARTEX_LLM_PROVIDER:-}
|
||||
ARTEX_LLM_MODEL: ${ARTEX_LLM_MODEL:-}
|
||||
ARTEX_LLM_BASE_URL: ${ARTEX_LLM_BASE_URL:-}
|
||||
ARTEX_LLM_PROXY: ${ARTEX_LLM_PROXY:-}
|
||||
# Exact host:port list the model-list fetch may reach on private addresses
|
||||
# (e.g. host.docker.internal:11434 for Ollama).
|
||||
ARTEX_LLM_PRIVATE_ENDPOINTS: ${ARTEX_LLM_PRIVATE_ENDPOINTS:-}
|
||||
ARTEX_JWT_KEY_DIR: /app/keys
|
||||
# Optional: key for secrets at rest; empty = keys/secret.key (generated at
|
||||
# first start).
|
||||
ARTEX_SECRET_KEY: ${ARTEX_SECRET_KEY:-}
|
||||
ARTEX_TRUSTED_PROXIES: ${ARTEX_TRUSTED_PROXIES:-}
|
||||
# Untrusted-output boundary: on by default (empty = on); set 0 to disable.
|
||||
ARTEX_UNTRUSTED_BOUNDARY: ${ARTEX_UNTRUSTED_BOUNDARY:-}
|
||||
ARTEX_UPDATE_CHECK: ${ARTEX_UPDATE_CHECK:-}
|
||||
# Noise profile for target requests: off (default) | quiet | balanced | aggressive.
|
||||
ARTEX_NOISE_PROFILE: ${ARTEX_NOISE_PROFILE:-}
|
||||
ARTEX_TARGET_USER_AGENT: ${ARTEX_TARGET_USER_AGENT:-}
|
||||
# Hierarchical run budgets: unset or 0 = unlimited. See README.
|
||||
ARTEX_TASK_BUDGET_TOKENS: ${ARTEX_TASK_BUDGET_TOKENS:-}
|
||||
ARTEX_TASK_BUDGET_TURNS: ${ARTEX_TASK_BUDGET_TURNS:-}
|
||||
ARTEX_INTENT_BUDGET_TOKENS: ${ARTEX_INTENT_BUDGET_TOKENS:-}
|
||||
ARTEX_INTENT_BUDGET_TURNS: ${ARTEX_INTENT_BUDGET_TURNS:-}
|
||||
ports:
|
||||
- "${ARTEX_BIND_ADDR:-127.0.0.1}:8787:8787"
|
||||
- "127.0.0.1:8788:8788"
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
- ./keys:/app/keys
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
+9
-1
@@ -31,7 +31,15 @@ services:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
ARTEX_PG_DSN: postgres://${POSTGRES_USER:-artex}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-artex}?sslmode=disable
|
||||
# Parts, not a pasted URL. PostgresDSN percent-encodes the password, so a
|
||||
# value with / ? % @ : or a space still connects. ARTEX_PG_DSN, when set,
|
||||
# would override these and is responsible for its own escaping.
|
||||
ARTEX_PG_HOST: postgres
|
||||
ARTEX_PG_PORT: "5432"
|
||||
ARTEX_PG_USER: ${POSTGRES_USER:-artex}
|
||||
ARTEX_PG_PASSWORD: ${POSTGRES_PASSWORD:?Please set POSTGRES_PASSWORD in .env}
|
||||
ARTEX_PG_DBNAME: ${POSTGRES_DB:-artex}
|
||||
ARTEX_PG_SSLMODE: disable
|
||||
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
|
||||
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
|
||||
ARTEX_LLM_PROVIDER: ${ARTEX_LLM_PROVIDER:-}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ boundary and trusted proxies. No password or token value is ever logged there.
|
||||
| Setting | Resolution order | Code |
|
||||
| --- | --- | --- |
|
||||
| Config file | `ARTEX_CONFIG` → `./config.json` → `config.json` next to the binary | `config.Path` |
|
||||
| PostgreSQL DSN | `ARTEX_PG_DSN` → `database.dsn` → assembled `host/port/user/password/dbname` | `config.PostgresDSN` |
|
||||
| PostgreSQL DSN | `ARTEX_PG_DSN` → `ARTEX_PG_HOST` / `ARTEX_PG_PORT` / `ARTEX_PG_USER` / `ARTEX_PG_PASSWORD` / `ARTEX_PG_DBNAME` / `ARTEX_PG_SSLMODE` → `database.dsn` → assembled `host/port/user/password/dbname` | `config.PostgresDSN` |
|
||||
| Skill directory | `ARTEX_SKILL_DIR` → `skill_dir` → `<binary dir>/skills` | `config.SkillDir` |
|
||||
| JWT / secret key directory | `ARTEX_JWT_KEY_DIR` → `<binary dir>` (never the browsable data dir) | `config.KeyDir` |
|
||||
| Secret encryption key | `ARTEX_SECRET_KEY` → `<key dir>/secret.key` → newly generated key file | `db.InitSecrets` |
|
||||
|
||||
+50
-2
@@ -29,8 +29,10 @@ ensure_docker(){
|
||||
case "$(uname -s)" in
|
||||
Linux)
|
||||
if [ "$(ask 'Install Docker automatically? (y/n)' y)" = y ]; then
|
||||
curl -fsSL https://get.docker.com | sh
|
||||
install_docker_linux
|
||||
sudo usermod -aG docker "$USER" || true
|
||||
docker compose version >/dev/null 2>&1 || sudo docker compose version >/dev/null 2>&1 \
|
||||
|| die "docker installed but 'docker compose' is unavailable; install the compose v2 plugin and retry"
|
||||
ok "Docker installed (re-login required for the group change to take effect)"
|
||||
else
|
||||
die "please install docker yourself and retry"
|
||||
@@ -40,6 +42,52 @@ ensure_docker(){
|
||||
esac
|
||||
}
|
||||
|
||||
# install_docker_linux uses get.docker.com only on the distros it supports. That
|
||||
# script keys its repo URL off /etc/os-release ID + codename, so on derivatives
|
||||
# such as Kali it writes a repo for a nonexistent release (debian kali-rolling)
|
||||
# and leaves apt broken. Other apt-based distros get the distro's own packages.
|
||||
install_docker_linux(){
|
||||
local id="" id_like=""
|
||||
if [ -r /etc/os-release ]; then
|
||||
id="$(. /etc/os-release && echo "${ID:-}")"
|
||||
id_like="$(. /etc/os-release && echo "${ID_LIKE:-}")"
|
||||
fi
|
||||
case "$id" in
|
||||
ubuntu|debian|raspbian|centos|fedora|rhel|sles)
|
||||
curl -fsSL https://get.docker.com | sh
|
||||
return ;;
|
||||
esac
|
||||
command -v apt-get >/dev/null 2>&1 \
|
||||
|| die "automatic Docker install is not supported on '${id:-unknown}'; please install docker + the compose plugin yourself and retry"
|
||||
info "'${id:-unknown}' (like: ${id_like:-n/a}) is not supported by get.docker.com; installing from the distro's apt repos"
|
||||
# Drop a broken repo left by an earlier get.docker.com run (it fails every apt update).
|
||||
# Match the URI and the distro id anywhere in the file: in a one-line .list entry
|
||||
# they share a line, but in a deb822 .sources file the URIs and Suites fields are
|
||||
# on separate lines. -w keeps "kali" matching inside "kali-rolling".
|
||||
local f
|
||||
for f in /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.sources; do
|
||||
if [ -n "$id" ] && [ -f "$f" ] \
|
||||
&& grep -qF "download.docker.com/linux/debian" "$f" 2>/dev/null \
|
||||
&& grep -qwF "$id" "$f" 2>/dev/null; then
|
||||
warn "removing broken Docker repo $f"
|
||||
sudo rm -f "$f"
|
||||
fi
|
||||
done
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y docker.io
|
||||
# The compose v2 package name varies across Debian derivatives; take the first that exists.
|
||||
local p
|
||||
for p in docker-compose-plugin docker-compose-v2 docker-compose; do
|
||||
if apt-cache madison "$p" 2>/dev/null | grep -q .; then
|
||||
sudo apt-get install -y "$p" && break
|
||||
fi
|
||||
done
|
||||
# Kali (and some others) don't start services on package install.
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
sudo systemctl enable --now docker || true
|
||||
fi
|
||||
}
|
||||
|
||||
# ── 1) All-Docker ───────────────────────────────
|
||||
install_docker(){
|
||||
ensure_docker
|
||||
@@ -107,7 +155,7 @@ JSON
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
info "building frontend static assets..."
|
||||
( cd web && npm ci --ignore-scripts && npm run build:static )
|
||||
rm -rf server/webui/dist && cp -r web/out server/webui/dist
|
||||
rm -rf server/webui/dist && mkdir -p server/webui && cp -r web/out server/webui/dist
|
||||
info "compiling embedded single binary..."
|
||||
CGO_ENABLED=0 go build -tags embedui -trimpath -o artex ./cmd/artex
|
||||
else
|
||||
|
||||
@@ -104,6 +104,10 @@ var notifyTransport = func() *http.Transport {
|
||||
return &http.Transport{}
|
||||
}
|
||||
clone := t.Clone()
|
||||
// Clone keeps ProxyFromEnvironment. The dial would then be to the proxy, so
|
||||
// blockInternalDial would see the proxy address and a link-local target
|
||||
// could still be reached through it. Notifications go direct.
|
||||
clone.Proxy = nil
|
||||
clone.DialContext = (&net.Dialer{Timeout: 10 * time.Second, Control: blockInternalDial}).DialContext
|
||||
return clone
|
||||
}()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package notify
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNotifyTransportIgnoresEnvironmentProxy(t *testing.T) {
|
||||
if notifyTransport.Proxy != nil {
|
||||
t.Fatal("notification transport must dial the target, not an environment proxy")
|
||||
}
|
||||
}
|
||||
@@ -223,6 +223,7 @@ func seedPrompts(pg *db.DB) {
|
||||
// and default params get injected. MCP/skill/host tools have no row and pass through.
|
||||
func wireTools(pg *db.DB, domainReg map[string]actool.CoreTool) {
|
||||
agent.SetFindingTrafficBindingEnabled(func() bool { return pg.GetBool(settingAgentTrafficBinding, false) })
|
||||
agent.SetTrafficCaptureEnabled(func() bool { return pg.GetBool(settingTrafficCapture, false) })
|
||||
// Seed the built-in domain tools (first-insert only; DO NOTHING preserves edits).
|
||||
// No startup prune: rows we didn't seed are left alone so future user-defined
|
||||
// custom tools (system=false, added via the UI) survive restarts.
|
||||
|
||||
+31
-8
@@ -21,6 +21,10 @@ const (
|
||||
// Allow multipart headers and boundaries in addition to the file data.
|
||||
chatUploadMultipartOverhead = 1 << 20 // 1 MiB
|
||||
chatUploadLimitMessage = "files exceed the 512 MiB upload limit"
|
||||
// maxUploadNameTries bounds the name-1, name-2, … search. A Stat error that
|
||||
// is not "not exist" (a component the filesystem rejects) must stop the
|
||||
// search instead of spinning.
|
||||
maxUploadNameTries = 10000
|
||||
)
|
||||
|
||||
// safeChatID guards the {id} path segment against traversal — task ids are numeric,
|
||||
@@ -123,7 +127,11 @@ func (s *Server) chatUpload(w http.ResponseWriter, r *http.Request) {
|
||||
if name == "" || name == "." || name == ".." || strings.ContainsAny(name, `/\`) {
|
||||
continue
|
||||
}
|
||||
dest := uniqueUploadPath(dir, name)
|
||||
dest, err := uniqueUploadPath(dir, name)
|
||||
if err != nil {
|
||||
writeErr(w, 500, "Save failed: "+err.Error())
|
||||
return
|
||||
}
|
||||
if err := saveUpload(hdr, dest); err != nil {
|
||||
writeErr(w, 500, "Save failed: "+err.Error())
|
||||
return
|
||||
@@ -136,19 +144,34 @@ func (s *Server) chatUpload(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// uniqueUploadPath returns dir/name, or dir/name-1, dir/name-2… when it already exists,
|
||||
// so re-uploading the same filename never clobbers a prior attachment.
|
||||
func uniqueUploadPath(dir, name string) string {
|
||||
dest := filepath.Join(dir, name)
|
||||
if _, err := os.Stat(dest); os.IsNotExist(err) {
|
||||
return dest
|
||||
func uniqueUploadPath(dir, name string) (string, error) {
|
||||
if dest, ok, err := uploadPathFree(filepath.Join(dir, name)); err != nil || ok {
|
||||
return dest, err
|
||||
}
|
||||
ext := filepath.Ext(name)
|
||||
stem := strings.TrimSuffix(name, ext)
|
||||
for i := 1; ; i++ {
|
||||
for i := 1; i <= maxUploadNameTries; i++ {
|
||||
cand := filepath.Join(dir, fmt.Sprintf("%s-%d%s", stem, i, ext))
|
||||
if _, err := os.Stat(cand); os.IsNotExist(err) {
|
||||
return cand
|
||||
dest, ok, err := uploadPathFree(cand)
|
||||
if err != nil || ok {
|
||||
return dest, err
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("no free name for upload %q", name)
|
||||
}
|
||||
|
||||
// uploadPathFree reports whether path can be created. ok is false when a file
|
||||
// or a symlink (including a dangling one) is already there. Any other Lstat
|
||||
// error is returned so the caller stops.
|
||||
func uploadPathFree(path string) (dest string, ok bool, err error) {
|
||||
_, err = os.Lstat(path)
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return path, true, nil
|
||||
}
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
return "", false, nil
|
||||
}
|
||||
|
||||
// composeAgentMessage appends an attachment manifest to the user's message so the agent
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUniqueUploadPathSuffixesCollisions(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
if err := os.WriteFile(filepath.Join(dir, "note.txt"), []byte("a"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(dir, "note-1.txt"), []byte("b"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got, err := uniqueUploadPath(dir, "note.txt")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if filepath.Base(got) != "note-2.txt" {
|
||||
t.Fatalf("got %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUniqueUploadPathStopsOnUnstorableName(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
name := strings.Repeat("a", 300) + ".txt"
|
||||
if _, err := uniqueUploadPath(dir, name); err == nil {
|
||||
t.Fatal("an overlong file name must not be searched forever")
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -3,7 +3,9 @@ package server
|
||||
import "os"
|
||||
|
||||
// secretEnv lists the credentials read from the environment only at startup:
|
||||
// ARTEX_PG_DSN and ARTEX_SECRET_KEY by NewManager, the API keys by agent.FromEnv inside New.
|
||||
// ARTEX_PG_DSN and ARTEX_PG_PASSWORD by NewManager (the password is a separate
|
||||
// variable so Docker Compose does not paste it into a URL), ARTEX_SECRET_KEY,
|
||||
// and the API keys by agent.FromEnv inside New.
|
||||
// agent.FromEnv also reads ARTEX_LLM_PROXY and ARTEX_LLM_BASE_URL: both are URLs that
|
||||
// can carry credentials in their userinfo (http://user:pass@proxy:3128). The archive
|
||||
// store also captures ARTEX_ARCHIVE_S3_* credentials during New, before the scrub,
|
||||
@@ -16,7 +18,7 @@ import "os"
|
||||
// credentials or config file, or from the instance metadata service, are not in
|
||||
// the environment: the scrub does not hide them from child processes.
|
||||
var secretEnv = []string{
|
||||
"ARTEX_PG_DSN", "ARTEX_SECRET_KEY", "ANTHROPIC_API_KEY", "OPENAI_API_KEY",
|
||||
"ARTEX_PG_DSN", "ARTEX_PG_PASSWORD", "ARTEX_SECRET_KEY", "ANTHROPIC_API_KEY", "OPENAI_API_KEY",
|
||||
"ARTEX_LLM_PROXY", "ARTEX_LLM_BASE_URL",
|
||||
"ARTEX_ARCHIVE_S3_ACCESS_KEY_ID", "ARTEX_ARCHIVE_S3_SECRET_ACCESS_KEY", "ARTEX_ARCHIVE_S3_SESSION_TOKEN",
|
||||
"AWS_ACCESS_KEY_ID", "AWS_ACCESS_KEY", "AWS_SECRET_ACCESS_KEY", "AWS_SECRET_KEY", "AWS_SESSION_TOKEN",
|
||||
|
||||
+3
-2
@@ -13,8 +13,9 @@ import (
|
||||
|
||||
// Sealing the server environment. ScrubSecretEnv removes the secrets from the Go
|
||||
// environment, but the kernel keeps the environment block the process was executed
|
||||
// with: /proc/<pid>/environ still shows ARTEX_PG_DSN, ARTEX_SECRET_KEY and the API
|
||||
// keys to any process that can read it. SealProcessEnv re-executes the server once,
|
||||
// with: /proc/<pid>/environ still shows ARTEX_PG_DSN, ARTEX_PG_PASSWORD,
|
||||
// ARTEX_SECRET_KEY and the API keys to any process that can read it.
|
||||
// SealProcessEnv re-executes the server once,
|
||||
// with those variables left out of the block; the values travel to the new image
|
||||
// through an inherited pipe and are put back into the Go environment there, so the
|
||||
// readers that run next see the same configuration.
|
||||
|
||||
@@ -51,6 +51,7 @@ func TestSealedEnvironmentHandoff(t *testing.T) {
|
||||
}
|
||||
want := map[string]string{
|
||||
"ARTEX_PG_DSN": "postgres://artex:p@ss@db.internal/artex?sslmode=disable\nsecond line\twith tab",
|
||||
"ARTEX_PG_PASSWORD": "p/ss w@rd?#%",
|
||||
"ARTEX_SECRET_KEY": "",
|
||||
"ANTHROPIC_API_KEY": "sk-ant-test",
|
||||
"OPENAI_API_KEY": "=leading-equals",
|
||||
|
||||
+8
-9
@@ -152,9 +152,15 @@ func (s *logSinkT) add(l LogLine) {
|
||||
s.ring = s.ring[len(s.ring)-s.cap:]
|
||||
}
|
||||
ch := s.dbCh
|
||||
subs := make([]chan LogLine, 0, len(s.subs))
|
||||
// Fan-out stays under the lock. subscribe's cancel removes the channel and
|
||||
// then closes it; a send on a closed channel panics even inside select, so
|
||||
// the send and the close must not interleave. The send does not block: a
|
||||
// full buffer drops the line.
|
||||
for sub := range s.subs {
|
||||
subs = append(subs, sub)
|
||||
select {
|
||||
case sub <- l:
|
||||
default:
|
||||
}
|
||||
}
|
||||
s.mu.Unlock()
|
||||
|
||||
@@ -165,13 +171,6 @@ func (s *logSinkT) add(l LogLine) {
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
for _, sub := range subs {
|
||||
select {
|
||||
case sub <- l:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// recent returns ring lines with Seq > since (capped to limit), and the latest seq.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"io"
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLogSinkUnsubscribeDuringAddDoesNotPanic(t *testing.T) {
|
||||
s := &logSinkT{cap: 8, subs: map[chan LogLine]struct{}{}, out: io.Discard}
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < 32; i++ {
|
||||
_, unsub := s.subscribe()
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
unsub()
|
||||
}()
|
||||
s.add(LogLine{Text: "line"})
|
||||
}
|
||||
wg.Wait()
|
||||
s.add(LogLine{Text: "after"})
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//go:build !windows
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// openUploadFileNoFollow opens dest for writing without following a symlink at
|
||||
// the final path component, closing the TOCTOU window after refuseUploadSymlink.
|
||||
func openUploadFileNoFollow(dest string) (*os.File, error) {
|
||||
return os.OpenFile(dest, os.O_WRONLY|os.O_CREATE|os.O_TRUNC|syscall.O_NOFOLLOW, 0o644)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//go:build windows
|
||||
|
||||
package server
|
||||
|
||||
import "os"
|
||||
|
||||
func openUploadFileNoFollow(dest string) (*os.File, error) {
|
||||
return os.OpenFile(dest, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644)
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRefuseUploadSymlink(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
target := filepath.Join(dir, "secret")
|
||||
if err := os.WriteFile(target, []byte("keep"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
link := filepath.Join(dir, "upload")
|
||||
if err := os.Symlink(target, link); err != nil {
|
||||
t.Skipf("symlink: %v", err)
|
||||
}
|
||||
if err := refuseUploadSymlink(link); err == nil {
|
||||
t.Fatal("symlink destination was accepted")
|
||||
}
|
||||
body, err := os.ReadFile(target)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if string(body) != "keep" {
|
||||
t.Fatalf("target changed to %q", body)
|
||||
}
|
||||
missing := filepath.Join(dir, "fresh")
|
||||
if err := refuseUploadSymlink(missing); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenUploadFileNoFollowRejectsSymlink(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("O_NOFOLLOW is Unix-only")
|
||||
}
|
||||
dir := t.TempDir()
|
||||
target := filepath.Join(dir, "secret")
|
||||
if err := os.WriteFile(target, []byte("keep"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
link := filepath.Join(dir, "link")
|
||||
if err := os.Symlink(target, link); err != nil {
|
||||
t.Skipf("symlink: %v", err)
|
||||
}
|
||||
if f, err := openUploadFileNoFollow(link); err == nil {
|
||||
_ = f.Close()
|
||||
t.Fatal("openUploadFileNoFollow accepted a symlink")
|
||||
}
|
||||
body, err := os.ReadFile(target)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if string(body) != "keep" {
|
||||
t.Fatalf("target changed to %q", body)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUniqueUploadPathSkipsDanglingSymlink(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
dangling := filepath.Join(dir, "note.txt")
|
||||
if err := os.Symlink(filepath.Join(dir, "nonexistent"), dangling); err != nil {
|
||||
t.Skipf("symlink: %v", err)
|
||||
}
|
||||
got, err := uniqueUploadPath(dir, "note.txt")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if filepath.Base(got) != "note-1.txt" {
|
||||
t.Fatalf("got %s, want note-1.txt", got)
|
||||
}
|
||||
}
|
||||
+23
-1
@@ -2,6 +2,7 @@ package server
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
@@ -340,12 +341,15 @@ func (s *Server) wsUpload(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func saveUpload(hdr *multipart.FileHeader, dest string) error {
|
||||
if err := refuseUploadSymlink(dest); err != nil {
|
||||
return err
|
||||
}
|
||||
src, err := hdr.Open()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer src.Close()
|
||||
out, err := os.Create(dest)
|
||||
out, err := openUploadFileNoFollow(dest)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -354,6 +358,24 @@ func saveUpload(hdr *multipart.FileHeader, dest string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// refuseUploadSymlink rejects a destination that is already a symlink. os.Create
|
||||
// follows one, including a dangling link that Stat reports as missing, so an
|
||||
// agent that can write the uploads directory could aim the server's write at
|
||||
// another path. Lstat sees the link itself.
|
||||
func refuseUploadSymlink(dest string) error {
|
||||
fi, err := os.Lstat(dest)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
if fi.Mode()&os.ModeSymlink != 0 {
|
||||
return fmt.Errorf("refusing to write through a symlink")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// sanitizeFilename strips characters unsafe for a Content-Disposition filename token.
|
||||
func sanitizeFilename(name string) string {
|
||||
name = strings.ReplaceAll(name, "\"", "")
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package traffic
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSpillBlobIsOwnerOnly(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
tr := &Traffic{dir: dir}
|
||||
body := bytes.Repeat([]byte("a"), maxInlineBody+1)
|
||||
got := tr.spill(body, "text/plain")
|
||||
if got.hash == "" {
|
||||
t.Fatal("expected a spilled blob")
|
||||
}
|
||||
blobDir := filepath.Join(dir, "_blobs", "sha256", got.hash[:2])
|
||||
blobPath := filepath.Join(blobDir, got.hash+".bin")
|
||||
info, err := os.Stat(blobPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
dirInfo, err := os.Stat(blobDir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if runtime.GOOS == "windows" {
|
||||
return
|
||||
}
|
||||
if info.Mode().Perm() != 0o600 {
|
||||
t.Fatalf("blob mode %o, want 0600", info.Mode().Perm())
|
||||
}
|
||||
if dirInfo.Mode().Perm() != 0o700 {
|
||||
t.Fatalf("blob dir mode %o, want 0700", dirInfo.Mode().Perm())
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenTightensExistingBlobPerms(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("POSIX file permissions not enforced on Windows")
|
||||
}
|
||||
dir := t.TempDir()
|
||||
blobsRoot := filepath.Join(dir, "_blobs")
|
||||
shaDir := filepath.Join(blobsRoot, "sha256")
|
||||
bucket := filepath.Join(shaDir, "ab")
|
||||
if err := os.MkdirAll(bucket, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, d := range []string{blobsRoot, shaDir, bucket} {
|
||||
if err := os.Chmod(d, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
blob := filepath.Join(bucket, "abcdef.bin")
|
||||
if err := os.WriteFile(blob, []byte("secret-body"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.Chmod(blob, 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
tr, err := Open(dir, "127.0.0.1:0")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer tr.Close()
|
||||
|
||||
for _, d := range []string{blobsRoot, shaDir, bucket} {
|
||||
info, err := os.Stat(d)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if info.Mode().Perm() != 0o700 {
|
||||
t.Fatalf("%s mode %o, want 0700", d, info.Mode().Perm())
|
||||
}
|
||||
}
|
||||
info, err := os.Stat(blob)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if info.Mode().Perm() != 0o600 {
|
||||
t.Fatalf("%s mode %o, want 0600", blob, info.Mode().Perm())
|
||||
}
|
||||
}
|
||||
@@ -330,24 +330,30 @@ func (e *vm) execRange(s *ast.RangeStmt, sc *env) (flowSignal, any) {
|
||||
var items []kvPair
|
||||
switch x := e.eval(s.X, sc).(type) {
|
||||
case []byte:
|
||||
e.alloc(int64(len(x)) * 32)
|
||||
for i, v := range x {
|
||||
items = append(items, kvPair{int64(i), int64(v)})
|
||||
}
|
||||
case []any:
|
||||
e.alloc(int64(len(x)) * 32)
|
||||
for i, v := range x {
|
||||
items = append(items, kvPair{int64(i), v})
|
||||
}
|
||||
case []string:
|
||||
e.alloc(int64(len(x)) * 32)
|
||||
for i, v := range x {
|
||||
items = append(items, kvPair{int64(i), v})
|
||||
}
|
||||
case string:
|
||||
e.alloc(int64(len(x)) * 32)
|
||||
for i, r := range x {
|
||||
items = append(items, kvPair{int64(i), int64(r)})
|
||||
}
|
||||
case map[string]any:
|
||||
e.alloc(int64(len(x)) * 32)
|
||||
items = sortedMapPairs(x)
|
||||
case map[string][]string:
|
||||
e.alloc(int64(len(x)) * 32)
|
||||
items = sortedMapPairs(x)
|
||||
case nil:
|
||||
return flowNone, nil
|
||||
|
||||
@@ -204,6 +204,25 @@ func OnResponse(req *Request, resp *Response) error {
|
||||
}
|
||||
|
||||
func TestResourceBoundsMemoryStepTimeoutPanicAndRegexp(t *testing.T) {
|
||||
t.Run("range_over_body_stopped_by_memory_budget", func(t *testing.T) {
|
||||
src := `package hook
|
||||
func OnRequest(req *Request) error {
|
||||
for _, b := range req.Body {
|
||||
_ = b
|
||||
}
|
||||
return nil
|
||||
}`
|
||||
prog, err := Compile("request", src)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
body := make([]byte, 256<<10)
|
||||
err = prog.RunRequest(context.Background(), &Request{Body: body}, RunOptions{MaxMemory: 64 << 10})
|
||||
if !errors.Is(err, ErrMemoryLimit) {
|
||||
t.Fatalf("err = %v, want ErrMemoryLimit", err)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("make_100MiB_stopped_by_memory_budget", func(t *testing.T) {
|
||||
src := `package hook
|
||||
func OnRequest(req *Request) error {
|
||||
|
||||
+2
-2
@@ -63,7 +63,7 @@ func (t *Traffic) spillRawDir(data []byte, previewCap int) (preview []byte, blob
|
||||
sum := sha256.Sum256(data)
|
||||
h := hex.EncodeToString(sum[:])
|
||||
blobDir := filepath.Join(t.dir, "_blobs", "sha256", h[:2])
|
||||
if err := os.MkdirAll(blobDir, 0o755); err != nil {
|
||||
if err := os.MkdirAll(blobDir, 0o700); err != nil {
|
||||
log.Printf("[traffic/socks5] failed to create blob directory: %v", err)
|
||||
return append([]byte(nil), data[:previewCap]...), ""
|
||||
}
|
||||
@@ -96,7 +96,7 @@ func writeBlobAtomic(blobDir, blobPath, hash string, data []byte) error {
|
||||
_ = tmp.Close()
|
||||
return err
|
||||
}
|
||||
if err := tmp.Chmod(0o644); err != nil {
|
||||
if err := tmp.Chmod(0o600); err != nil {
|
||||
_ = tmp.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
+45
-3
@@ -295,11 +295,16 @@ type Traffic struct {
|
||||
|
||||
// Open initializes the traffic tree, blob store and SQLite index under dir.
|
||||
func Open(dir, addr string) (*Traffic, error) {
|
||||
for _, d := range []string{dir, filepath.Join(dir, "_index"), filepath.Join(dir, "_blobs"), filepath.Join(dir, "_ca")} {
|
||||
for _, d := range []string{dir, filepath.Join(dir, "_index"), filepath.Join(dir, "_ca")} {
|
||||
if err := os.MkdirAll(d, 0o755); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
blobsRoot := filepath.Join(dir, "_blobs")
|
||||
if err := os.MkdirAll(blobsRoot, 0o700); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tightenBlobPerms(blobsRoot)
|
||||
// busy_timeout is a per-connection setting, so it belongs in the DSN rather
|
||||
// than in a one-off Exec: the pool opens connections on demand, and an Exec
|
||||
// only configures whichever one happened to serve it — leaving every other
|
||||
@@ -847,6 +852,38 @@ type storedBody struct {
|
||||
// reader can identify them without fetching the blob. Either way, text bodies
|
||||
// are handed to the full-text index in full (up to maxIndexBody) — indexing is
|
||||
// independent of where the bytes end up.
|
||||
// tightenBlobPerms restricts existing spilled blob directories to 0700 and
|
||||
// regular blob files to 0600 on startup so pre-existing 0755/0644 artifacts
|
||||
// from earlier versions do not stay world-readable.
|
||||
func tightenBlobPerms(root string) {
|
||||
_ = filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
if d.Type()&os.ModeSymlink != 0 {
|
||||
return nil
|
||||
}
|
||||
info, err := d.Info()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
if d.IsDir() {
|
||||
if info.Mode().Perm() != 0o700 {
|
||||
if err := os.Chmod(path, 0o700); err != nil {
|
||||
log.Printf("[traffic] failed to restrict blob directory %s: %v", path, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if info.Mode().IsRegular() && info.Mode().Perm() != 0o600 {
|
||||
if err := os.Chmod(path, 0o600); err != nil {
|
||||
log.Printf("[traffic] failed to restrict blob %s: %v", path, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (t *Traffic) spill(body []byte, contentType string) storedBody {
|
||||
return t.spillAt(body, contentType, maxInlineBody)
|
||||
}
|
||||
@@ -873,16 +910,21 @@ func (t *Traffic) spillAt(body []byte, contentType string, maxInline int) stored
|
||||
// One bucket level (256 buckets) is enough to keep any single directory small;
|
||||
// the store only ever holds bodies above maxInlineBody, deduplicated by hash.
|
||||
blobDir := filepath.Join(t.dir, "_blobs", "sha256", h[:2])
|
||||
if err := os.MkdirAll(blobDir, 0o755); err != nil {
|
||||
if err := os.MkdirAll(blobDir, 0o700); err != nil {
|
||||
log.Printf("[traffic] failed to create blob directory: %v", err)
|
||||
return storedBody{inline: clipBytes(body, blobPreview), index: indexText()}
|
||||
}
|
||||
if err := os.Chmod(blobDir, 0o700); err != nil {
|
||||
log.Printf("[traffic] failed to restrict blob directory: %v", err)
|
||||
}
|
||||
blobPath := filepath.Join(blobDir, h+".bin")
|
||||
if _, err := os.Stat(blobPath); os.IsNotExist(err) {
|
||||
if err := os.WriteFile(blobPath, body, 0o644); err != nil {
|
||||
if err := os.WriteFile(blobPath, body, 0o600); err != nil {
|
||||
log.Printf("[traffic] failed to write blob %s: %v", h, err)
|
||||
return storedBody{inline: clipBytes(body, blobPreview), index: indexText()}
|
||||
}
|
||||
} else if err := os.Chmod(blobPath, 0o600); err != nil {
|
||||
log.Printf("[traffic] failed to restrict blob %s: %v", h, err)
|
||||
}
|
||||
sb := storedBody{hash: h, index: indexText()}
|
||||
if text {
|
||||
|
||||
@@ -57,7 +57,7 @@ update_local(){
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
info "Rebuilding frontend static assets…"
|
||||
( cd web && npm ci --ignore-scripts && npm run build:static )
|
||||
rm -rf server/webui/dist && cp -r web/out server/webui/dist
|
||||
rm -rf server/webui/dist && mkdir -p server/webui && cp -r web/out server/webui/dist
|
||||
info "Recompiling the embedded single binary…"
|
||||
CGO_ENABLED=0 go build -tags embedui -trimpath -o artex ./cmd/artex
|
||||
else
|
||||
|
||||
@@ -139,6 +139,9 @@ export default function SetupPage() {
|
||||
>
|
||||
{loading ? t("Saving...") : t("Set password and sign in")}
|
||||
</Button>
|
||||
<p className="rounded-md border bg-muted/40 px-3 py-2 text-xs text-muted-foreground">
|
||||
{t("Traffic capture is off by default. Enable it in System settings after setup if you need provable HTTP findings — captured traffic is required for findings to prove goals.")}
|
||||
</p>
|
||||
</form>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -572,7 +572,9 @@ export default function DashboardPage() {
|
||||
<span>{t("Recording")}</span>
|
||||
</>
|
||||
) : (
|
||||
<span>{t("Capture is off")}</span>
|
||||
<Link href="/system/settings" className="text-amber-500 hover:underline">
|
||||
{t("Capture is off · required for provable findings")}
|
||||
</Link>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -1164,19 +1166,29 @@ export default function DashboardPage() {
|
||||
</Badge>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between rounded-lg border bg-muted/20 px-3 py-2">
|
||||
<div className="text-[10px] text-muted-foreground">{t("Traffic capture")}</div>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={cn(
|
||||
"text-[10px]",
|
||||
settings?.traffic_capture
|
||||
? "border-violet-500/30 bg-violet-500/10 text-violet-400"
|
||||
: "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
{settings?.traffic_capture ? t("On") : t("Off")}
|
||||
</Badge>
|
||||
<div className="rounded-lg border bg-muted/20 px-3 py-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="text-[10px] text-muted-foreground">{t("Traffic capture")}</div>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={cn(
|
||||
"text-[10px]",
|
||||
settings?.traffic_capture
|
||||
? "border-violet-500/30 bg-violet-500/10 text-violet-400"
|
||||
: "border-amber-500/30 bg-amber-500/10 text-amber-500",
|
||||
)}
|
||||
>
|
||||
{settings?.traffic_capture ? t("On") : t("Off")}
|
||||
</Badge>
|
||||
</div>
|
||||
{settings && !settings.traffic_capture && (
|
||||
<p className="mt-1.5 text-[10px] leading-relaxed text-amber-500">
|
||||
{t("Traffic capture is off: findings stay recorded, but captured HTTP traffic is required for provable findings.")}{" "}
|
||||
<Link href="/system/settings" className="underline">
|
||||
{t("Enable in settings")}
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{activeProfile && (
|
||||
|
||||
@@ -320,16 +320,23 @@ export default function SystemSettingsPage() {
|
||||
)}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="flex items-center justify-between gap-4">
|
||||
<Label htmlFor="traffic-capture" className="text-sm font-normal text-muted-foreground">
|
||||
{trafficCapture ? t("On · recording traffic and injecting proxy") : t("Off · no recording, no proxy injection")}
|
||||
</Label>
|
||||
<Switch
|
||||
id="traffic-capture"
|
||||
checked={trafficCapture}
|
||||
disabled={!loaded || saving}
|
||||
onCheckedChange={toggleTraffic}
|
||||
/>
|
||||
<CardContent className="space-y-2.5">
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<Label htmlFor="traffic-capture" className="text-sm font-normal text-muted-foreground">
|
||||
{trafficCapture ? t("On · recording traffic and injecting proxy") : t("Off · no recording, no proxy injection")}
|
||||
</Label>
|
||||
<Switch
|
||||
id="traffic-capture"
|
||||
checked={trafficCapture}
|
||||
disabled={!loaded || saving}
|
||||
onCheckedChange={toggleTraffic}
|
||||
/>
|
||||
</div>
|
||||
{loaded && !trafficCapture && (
|
||||
<p className="rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-600 dark:text-amber-400">
|
||||
{t("Traffic capture is off: findings stay recorded, but captured HTTP traffic is required for provable findings.")}
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
|
||||
@@ -2709,5 +2709,9 @@
|
||||
"Hashes": "Özetler",
|
||||
"Masked (HMAC)": "Maskeli (HMAC)",
|
||||
"Resulting request": "Ortaya çıkan istek",
|
||||
"Resulting response": "Ortaya çıkan yanıt"
|
||||
"Resulting response": "Ortaya çıkan yanıt",
|
||||
"Traffic capture is off by default. Enable it in System settings after setup if you need provable HTTP findings — captured traffic is required for findings to prove goals.": "Trafik yakalama varsayılan olarak kapalıdır. Kanıtlanabilir HTTP bulguları gerekiyorsa kurulumdan sonra Sistem ayarlarından etkinleştirin — bulguların hedefleri kanıtlaması için yakalanmış trafik gereklidir.",
|
||||
"Capture is off · required for provable findings": "Yakalama kapalı · kanıtlanabilir bulgular için gerekli",
|
||||
"Traffic capture is off: findings stay recorded, but captured HTTP traffic is required for provable findings.": "Trafik yakalama kapalı: bulgular kaydedilmeye devam eder ancak kanıtlanabilir bulgular için yakalanmış HTTP trafiği gereklidir.",
|
||||
"Enable in settings": "Ayarlardan etkinleştir"
|
||||
}
|
||||
|
||||
@@ -2709,5 +2709,9 @@
|
||||
"Hashes": "哈希",
|
||||
"Masked (HMAC)": "已脱敏 (HMAC)",
|
||||
"Resulting request": "结果请求",
|
||||
"Resulting response": "结果响应"
|
||||
"Resulting response": "结果响应",
|
||||
"Traffic capture is off by default. Enable it in System settings after setup if you need provable HTTP findings — captured traffic is required for findings to prove goals.": "流量捕获默认关闭。如需可证明的 HTTP 漏洞发现,请在初始化后前往系统设置开启——漏洞证明目标需要已捕获的 HTTP 流量。",
|
||||
"Capture is off · required for provable findings": "捕获已关闭 · 可证明漏洞所需",
|
||||
"Traffic capture is off: findings stay recorded, but captured HTTP traffic is required for provable findings.": "流量捕获已关闭:漏洞仍会被记录,但证明目标需要已捕获的 HTTP 流量。",
|
||||
"Enable in settings": "前往设置开启"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user