Commit Graph
635 Commits
Author SHA1 Message Date
Ahmed Allam 7028b54a84 fix(context): bound the complete retrieval response by the caller's limit
The continuation hint was reserved only against the global page cap, so a
small caller-supplied limit bounded content alone and the appended hint pushed
the complete response past the requested maximum. Reserve the hint out of the
effective ceiling (min of limit and the global cap) so content plus hint always
honours the caller's limit, flooring content so pages still make progress.
2026-07-26 00:43:15 +00:00
Ahmed Allam 95410e9e12 fix(context): normalize a mid-character read offset to the next boundary
An arbitrary offset landing inside a multi-byte character is now advanced to
the next character boundary before reading, instead of trimming leading
continuation bytes after the read. This keeps every page on a real boundary
(no replacement characters) and guarantees forward progress, so an offset
inside the final character can't yield an empty page with an unchanged
continuation offset.
2026-07-26 00:35:42 +00:00
Ahmed Allam 65fa698b09 fix(context): reserve continuation-hint bytes within the retrieval page ceiling
A full non-final retrieval page consumed the entire byte budget and then
appended the pagination hint, so the returned result (which bypasses the
result-bounding wrapper) exceeded the ceiling. Reserve the hint's bytes out
of the page budget so content plus hint always fits.
2026-07-26 00:26:09 +00:00
Ahmed Allam e5a46b92fd fix(context): skip partial leading char on mid-character read offset
read_tool_output accepts arbitrary byte offsets; one landing inside a
multi-byte character previously decoded to a replacement character. Trim the
orphaned leading continuation bytes (their lead byte is on an earlier page)
so every accepted offset returns valid UTF-8, without affecting forward
paging offsets.
2026-07-26 00:16:02 +00:00
Ahmed Allam cc57e7a29b fix(context): page stored output by byte offset so no single line overflows
The line-based pager always kept at least one whole line, so a stored line
larger than the page byte ceiling was returned in full and could overflow
history (retrieval bypasses the result-bounding wrapper). Page by byte
offset instead: every page is bounded by the byte budget even inside one
oversized line, a partial UTF-8 char at the window edge is dropped and
re-read on the next page, and paging forward reconstructs the output
byte-for-byte.
2026-07-26 00:16:02 +00:00
Ahmed Allam 1070ef5510 test(context): assert spill preview honours the byte budget
bound_and_store's notice carries the output_id and is longer than the
plain truncation notice, so reserve for it explicitly and cover that the
spilled preview stays within max_bytes.
2026-07-26 00:16:02 +00:00
Ahmed Allam 08670033e3 fix(context): page retrieval by byte budget without dropping content
Bounding a retrieval page with a destructive head+tail preview and then
advancing the offset past those lines could permanently lose the elided
output the store exists to preserve. Instead honour the page byte budget
by returning fewer whole lines and advancing the offset only by lines
actually returned, so paging forward reconstructs the full output.
2026-07-26 00:16:02 +00:00
Ahmed Allam 90d0dfb4f0 fix(context): keep tool-output retrieval reliable and stream pages
Exempt read_tool_output from result-bounding so paging a large stored
output isn't re-spilled under a new id, byte-cap each page in place, and
stream the requested window with islice instead of loading the whole
file per page.
2026-07-26 00:16:02 +00:00
Ahmed Allam 1da3140d84 feat(context): spill oversized tool output to disk with a retrieval tool
Truncating a large tool result to a head+tail preview loses the middle,
which may hold the one line that matters (a buried match, a stack frame, a
credential). Instead of dropping it, persist the full output and let the
agent page back to it on demand.

- output_store.py: bound_and_store() writes the complete output to a
  per-scan store and embeds an output_id in the truncation notice;
  read_stored_output() serves it back in validated, paginated chunks
  (output_id is a 32-char hex token, guarding against path traversal).
- read_tool_output tool: lets the agent retrieve any elided output by id,
  paging via offset/limit.
- factory.py: bounded tool results now spill via bound_and_store; the new
  tool is registered for every scan agent.
- runner.py: point the store at the run's .state/tool-output directory so
  spilled output lives beside the rest of the scan state.

Falls back to a plain head+tail preview if the spill write fails.
2026-07-26 00:16:02 +00:00
Ahmed Allam 4eedfc64b4 fix(context): cap summary output at model limit; safe token upper bound
- Clamp the summary request's max_tokens to the model's output limit so a
  large STRIX_CONTEXT_SUMMARY_TOKENS can't get the request rejected (which
  left the overflowing session uncompacted). Applied consistently to the
  input-budget reservation and the request itself.
- Replace the tokenizer-unavailable fallback with the UTF-8 byte length, a
  guaranteed upper bound on tokens for byte-level BPE, so budget checks can
  never under-count dense history.
2026-07-26 00:15:49 +00:00
Ahmed Allam 2163a66b78 fix(context): over-estimate tokens when no tokenizer is available
The chars/4 fallback under-counts dense text (code, base64, CJK), which
could let a summary request be packed past the real context window and get
rejected. Use a conservative ~3-chars/token estimate instead so budget
checks never under-count.
2026-07-26 00:04:13 +00:00
Ahmed Allam 16cbd516c8 refactor(context): detect overflow via LiteLLM's typed error only
Drop the brittle substring matching for context-overflow detection. LiteLLM
already normalises every provider's overflow error to
ContextWindowExceededError and maintains the provider-specific matching
upstream, so is_context_overflow just checks that type.
2026-07-25 23:48:47 +00:00
Ahmed Allam dd35af6181 fix(context): skip compaction when the window can't fit a summary request
When instructions, the reserved summary output, and any prior checkpoint
already consume the model's context window, the summary-input budget is
zero. Previously a doomed summary request was still submitted (and
rejected). Skip summarization in that case and log, rather than issue a
request guaranteed to overflow.
2026-07-25 23:46:27 +00:00
Ahmed Allam 739e969914 fix(context): never floor summary input above the model's remaining room
The 1,000-token floor on summary-input room could exceed the space
actually left after instructions, the reserved summary output, and any
existing checkpoint. On a small window the summary request then overflowed
and returned nothing, leaving the oversized session uncompacted. Clamp to
the real room instead so the request always fits.
2026-07-25 23:46:27 +00:00
Ahmed Allam 8fd871249c fix(context): bound the compaction summary input to the model window
Head+tail-truncate the serialized history before the summary request so a
very large head cannot itself overflow the model context and abort the
recovery it is meant to perform.
2026-07-25 23:46:27 +00:00
Ahmed Allam a73300f840 feat(context): model-aware conversation compaction for long scans
Restore cumulative history compaction (removed in the SDK migration) so a
long scan no longer replays an ever-growing transcript until it overflows
the model's context window and the run fails.

- strix/llm/context_budget.py: resolve the model's real input/output token
  limits from LiteLLM metadata (128k gpt-4o, 272k gpt-5, 1M claude-sonnet-4,
  131k deepseek), with a large configurable fallback for unmapped models and
  a chars/4 token-count fallback.
- strix/llm/compaction.py: provider-agnostic compaction via litellm. Keeps a
  security-focused structured summary (objective, findings, credentials,
  payloads, URLs/paths, work state, dead ends, next move), keeps the most
  recent turns by token budget, and snaps the summary boundary so no tool
  call is separated from its result. Both triggers: proactive before each
  run and reactive compact-and-retry on a real context-overflow error.
- Wire both triggers into the agent run loop next to the existing image
  recovery; add replace_session_items() with restore-on-failure.

Env-tunable via STRIX_CONTEXT_* (auto-compact on by default).
2026-07-25 23:46:27 +00:00
Ahmed Allam 95046a6cea fix(context): reject tool-output byte ceilings below the notice size
A configured tool_output_max_bytes smaller than the truncation notice
itself can't fit a bounded preview, so a persisted result could exceed the
ceiling. Enforce a config floor (ge=1024) so nonsensical values are
rejected at load time instead of being worked around at runtime.
2026-07-25 23:46:11 +00:00
Ahmed Allam aac59de1e5 fix(context): reserve notice budget so bounded output honors max_bytes
The head+tail slices could each take half of max_bytes, then the
truncation notice and its separators were appended on top, so the value
persisted to history could exceed the configured maximum. Reserve an
upper bound for the notice (and separators) out of the byte budget before
slicing so the whole joined result stays within max_bytes.
2026-07-25 23:06:40 +00:00
Ahmed Allam ce358aa879 fix(context): bound native filesystem tool output in Responses mode
Chat-completions mode converts filesystem CustomTools to FunctionTools
(which bounds their result), but the Responses-API path kept them native
and unbounded, so a large read_file could still exhaust the context
window. Always configure the Filesystem capability to head+tail bound
tool output in both modes.
2026-07-25 22:50:50 +00:00
Ahmed Allam dab93bcc12 fix(context): clamp shell output cap and count byte-trimmed dropped lines
Treat tool_output_max_tokens as a ceiling so an explicit model-supplied
cap can't exceed it, and derive the truncation notice's dropped-line
count from the lines actually kept after the byte-trim pass. Also cast
the pygments fallback lexer so it satisfies the resolve_lexer return
type under the pre-commit mypy hook.
2026-07-25 22:32:56 +00:00
Ahmed Allam 3b8980c47b feat(context): bound per-tool output before it enters agent history
Cap the size of every tool result so a single verbose command (recursive
find, noisy scanner, full page dump) can't pin the conversation near the
model's context window for the rest of a scan.

- New ContextSettings config group with env-tunable caps.
- Default the SDK shell tools' max_output_tokens so exec_command /
  write_stdin truncate head+tail instead of returning unbounded output.
- Bound Strix's own FunctionTool/CustomTool results (line + UTF-8 byte
  head+tail preview with a truncation notice) and cap error strings.
2026-07-25 22:31:31 +00:00
Ahmed Allam 8157ccba27 refactor(reports): fold fence helpers into report writer 2026-07-25 13:09:57 -07:00
Ahmed Allam 95d2e5fba9 fix(reports): safe-fence code-location snippets in markdown copy 2026-07-25 13:09:57 -07:00
Ahmed Allam 21243486e2 fix(reports): safe-fence markdown PoC export and share fence helpers 2026-07-25 13:09:57 -07:00
Ahmed Allam 97ed7e79a1 fix(reports): auto-detect PoC language with Python fallback 2026-07-25 13:09:57 -07:00
Ahmed Allam 31c18f8f75 fix(reports): strip markdown code fence from poc_script_code before rendering 2026-07-25 13:09:57 -07:00
Ahmed Allam f23fadfbff Rename root agent to Strix 2026-07-25 11:40:05 -07:00
08126eb518 feat(dedupe): add dedicated deduplication model (#823)
Co-authored-by: oyasumi <oyasumi@kantilabs.xyz>
Co-authored-by: Ahmed Allam <ahmed39652003@gmail.com>
2026-07-25 06:29:39 -07:00
Utku Tugrul d4f4697533 runtime: resolve staged local-dir path to avoid symlink rejection on macOS (#857) 2026-07-25 05:45:31 -07:00
dvir arad 57304b0084 docs(cli): document exit code 1 and clarify exit 0 semantics
The Exit Codes table in the CLI reference only listed 0 and 2, but the
CLI also exits with 1 on fatal errors (missing environment variables,
Docker unavailable, invalid config file, diff-scope resolution failure,
or an unhandled exception). It also implied exit 0 means no
vulnerabilities were found, which is only true in headless mode -
interactive runs always exit 0 regardless of findings.

Document exit code 1 and clarify the two cases for exit 0.
2026-07-25 05:29:13 -07:00
cd8270c98b Sign in with a ChatGPT subscription for inference (#854)
Co-authored-by: Jonathan Singer <jonathansinger@Jonathans-MacBook-Pro.local>
Co-authored-by: Jonathan Singer <jonathansinger@Mac-3004.lan>
Co-authored-by: Ahmed Allam <ahmed39652003@gmail.com>
2026-07-24 15:41:19 -07:00
Ahmed Allam 93af2b94a2 chore(deps): bump setuptools to 83.0.0 (GHSA-h35f-9h28-mq5c) 2026-07-24 07:08:50 -07:00
Tim HainesandClaude Opus 4.8 960caf86aa Pin release-workflow actions to commit SHAs + least-privilege token (#862)
Every `uses:` in build-release.yml was a mutable tag; the `release` job has
`contents: write` and publishes the binaries users install, so a compromised
action could tamper the release. Action tag-hijacking keeps recurring
(aquasecurity/trivy-action, 75 tags, Mar 2026 TeamPCP; tj-actions, 2025;
codfish/semantic-release-action, Jun 2026) and SHA-pinned workflows were immune
each time. Pin all six actions to the commit each @major resolves to today
(concrete version in a trailing comment; setup-uv's annotated tag dereferenced
to its commit, not the tag object, so Dependabot tracks it). Also add a
top-level `permissions: contents: read` (the release job keeps its explicit
write) and `persist-credentials: false` on the build checkout.

actionlint passes. Pairs with #860 (Dependabot github-actions keeps the pins
current).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 15:22:28 -04:00
yoni 7e02b8d8da Quit after scan instead of hosting local viewer
Remove the post-scan local viewer hosting step so the run exits directly
instead of blocking with 'Hosting the local viewer. Press Ctrl-C to stop.'
Drop the 'View in web' link (and 'Reopen' variant) from the completion
panel, which now always shows 'View  strix view <run_name>'.
2026-07-22 14:29:11 -07:00
alex s 137a42c3e3 fix(deps): cap cryptography <49 to keep Intel macOS universal2 wheel (#859)
cryptography 49.x ships arm64-only macOS wheels (no universal2), forcing the
Intel macOS (macos-x86_64) release runner to build from sdist under
`uv sync --frozen`. Pin to 48.0.1, which still clears GHSA-537c-gmf6-5ccf
(fixed in 48.0.1) and provides a macosx_10_9_universal2 wheel.
2026-07-22 16:56:15 -04:00
alex s 473b3c4af1 chore(deps): bump cryptography to 49.0.0 and pyasn1 to 0.6.4 (#856)
Resolves GHSA-537c-gmf6-5ccf (vulnerable OpenSSL in cryptography wheels,
fixed in 48.0.1) and CVE-2026-59885 / CVE-2026-59886 (pyasn1 DoS via
OBJECT IDENTIFIER / REAL decoding, fixed in 0.6.4).
2026-07-22 16:33:06 -04:00
alex s d1a73a24f8 feat(cli): update notifications + self-update (strix --update) (#807)
* feat(cli): update notifications + self-update (strix --update)

* fix(update): verify release checksum, clean up staged binary, roll back Windows rename on failure

* feat(update): 3-way pre-scan prompt (update now / not now / skip this version) + package-manager upgrade

* fix(update): never show update prompt/notice in non-interactive runs
2026-07-22 16:29:03 -04:00
Ahmed Allam a2f5e3acb6 chore: release v1.3.1 v1.3.1 2026-07-22 11:47:02 -07:00
Ahmed Allam e8c2564595 sandbox: bump install.sh pre-pull tag to 1.1.0 (match runtime default) 2026-07-22 11:40:23 -07:00
Ahmed Allam 78594e1645 sandbox: bump default inner-sandbox image to 1.1.0 2026-07-22 11:40:23 -07:00
Ahmed Allam 8ec54d9e2b chore: release v1.3.0 (#849) v1.3.0 2026-07-22 09:21:24 -07:00
Ahmed Allam 1f7373714b Local viewer: prominent scan switcher + rename to "pentest" terminology (#848) 2026-07-22 09:17:52 -07:00
Ahmed Allam ef07bad945 Local viewer: UI polish and a Feedback & support tab (#847) 2026-07-22 08:34:52 -07:00
seanturner83 89a707ff51 sandbox: shrink image 7.2GB → 3.8GB (cache cleanup, multi-stage Go build, drop ZAP) (#474) 2026-07-22 07:25:38 -07:00
Ahmed Allam 59f49a1fa2 fix(prompt): make root agent orchestrate-only and fold fixing into reporting 2026-07-22 02:56:49 -07:00
alex s 2bb730c366 fix(container): keep /app/.venv/bin on the login-shell PATH so python3 finds preinstalled libs (#839) 2026-07-21 23:49:44 -04:00
Ahmed Allam 48b4821f69 chore: release v1.2.0 v1.2.0 2026-07-21 09:05:04 -07:00
yoni-at-strix f600f99103 Local run viewer: email reports, run history, and the platform suite (#813) 2026-07-21 08:13:03 -07:00
alex s 6a3e0597ce docs(skills): add Active Directory / Kerberos domain testing skill (#825)
* docs(skills): add Active Directory / Kerberos domain testing skill

* docs(skills): fix AD skill collector package + split invalid pipx install
2026-07-21 10:59:28 -04:00
alex s ad27f0c67e docs(reporting): add CVSS calibration guidance to reduce severity inf… (#821)
* docs(reporting): add CVSS calibration guidance to reduce severity inflation

The create_vulnerability_report tool documents the cvss_breakdown format but
gives no guidance on choosing metric values, so findings are frequently
over-rated. Add a concise calibration block covering the most common
inflation mistakes: scoring scenarios that presuppose the attacker already
holds a stolen secret as unauthenticated (PR:N) criticals, using C:H/I:H for
single-user or read-only/enumeration impact, folding a chained worst case
into one vector, and ignoring adversary-in-the-middle or user-interaction
prerequisites.

* docs(reporting): drop 'one weakness per report' calibration bullet
2026-07-21 09:17:22 -04:00