Skip to content

fix(core): treat a cloned repository as a source-aware (white-box) scan - #1470

Open
samirhvbr wants to merge 2 commits into
usestrix:mainfrom
samirhvbr:fix/whitebox-repository-targets
Open

samirhvbr wants to merge 2 commits into
usestrix:mainfrom
samirhvbr:fix/whitebox-repository-targets

Conversation

@samirhvbr

Copy link
Copy Markdown

Fixes #884. Supersedes #885, which no longer applies to main.

Problem

A repository target is cloned into the sandbox workspace and collected into local_sources exactly like a local_code target (collect_local_sources), but the two white-box checks only looked at type == "local_code":

  • runner.py decided is_whitebox inline, so scanning a GitHub repo (alone or beside a domain) ran with is_whitebox=False: coordination/source_aware_whitebox and custom/source_aware_sast were not preloaded for the root agent, and the first is internal so it cannot be loaded on demand;
  • interface/utils.py:is_whitebox_scan fed telemetry, which recorded the scan as black-box.

The docs describe this invocation as white-box testing. As the issue bisects, it regressed in 1e641e5, which replaced bool(args.local_sources) with the local_code check.

Fix

One is_whitebox_scan(targets_info) that says "source is in front of the agent": a local_code target, or a repository target that was cloned (details["cloned_repo_path"]). The runner and scan setup both use it, and the second copy is removed. A repository that was not cloned still does not count.

It lives in a new dependency-free strix/core/targets.py rather than core/inputs.py: scan_setup imports core.inputs lazily inside a function on purpose (it pulls in the agents SDK), so importing the predicate from there at module level would change that.

Tests

  • tests/test_scan_targets.py: each target mix (none, web only, local directory, cloned repository, repository that was not cloned, repository beside a domain in either order, missing details).
  • tests/test_runner_root_prompt.py: through the real run_strix_scan, the root agent is built with is_whitebox=True for a cloned repository and for a repository beside a domain.

On main the two repository cases of the runner test fail while the local_code and web-only controls pass; with the change everything passes. ruff, mypy and bandit are clean on the touched files and the 617 neighbouring scan-setup/CLI/runner/target/resume tests pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TavwVMH7PvrD68JTDfd6Hb

A `repository` target is cloned into the sandbox workspace and collected into
`local_sources` exactly like a `local_code` target, but the two white-box checks
only looked at `type == "local_code"`. Scanning a GitHub repo, alone or beside
a domain, therefore ran with is_whitebox=False: the source-aware skills were
not preloaded for the root agent (coordination/source_aware_whitebox is not
loadable on demand) and telemetry recorded the scan as black-box. The docs
describe this invocation as white-box testing. Regressed in 1e641e5, which
replaced `bool(args.local_sources)` with the `local_code` check.

Add one `is_whitebox_scan` in a dependency-free `strix.core.targets` (the
interface layer imports it before the agents SDK may be imported, so it cannot
live in core.inputs) and use it from both the runner and scan setup. A
repository that was not cloned still does not count, as it has no source.

Tests: unit cases for each target mix, and a runner-level case asserting the
root agent is built with is_whitebox=True for a cloned repository (it fails on
main for the repository cases and passes for the local_code and web controls).

Fixes usestrix#884. Supersedes usestrix#885, which no longer applies to main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TavwVMH7PvrD68JTDfd6Hb
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Expands whitebox scan detection to include cloned repositories.

The PR appears safe to merge, with a non-blocking gap in telemetry test coverage.

Findings

  1. P2 Telemetry result lacks a test ▶
Fix with agent prompt
### Issue 1
tests/test_scan_targets.py:43
The new tests check what `is_whitebox_scan` returns and what the runner passes to the agent, but neither checks what `telemetry_start` reports after cloning a repository. Add a test for that reported value. Otherwise, a later change to scan setup could label cloned-repository scans as black-box while these tests still pass.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Cloned repositories now count as white-box scans for root-agent setup and scan telemetry. The shared check still excludes repositories that were not cloned.

  • Cloned repositories now count as white-box scans.

Reviews (1) · Last reviewed commit: "fix(core): treat a cloned repository as ..."

def test_source_in_front_of_the_agent_makes_the_scan_whitebox(
targets: list[dict[str, Any]] | None, *, expected: bool
) -> None:
assert is_whitebox_scan(targets) is expected

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Telemetry result lacks a test

The new tests check what is_whitebox_scan returns and what the runner passes to the agent, but neither checks what telemetry_start reports after cloning a repository. Add a test for that reported value. Otherwise, a later change to scan setup could label cloned-repository scans as black-box while these tests still pass.

Knowledge Base Used: CLI launch and scan setup

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/test_scan_targets.py
Line: 43

Comment:
**Telemetry result lacks a test**

The new tests check what `is_whitebox_scan` returns and what the runner passes to the agent, but neither checks what `telemetry_start` reports after cloning a repository. Add a test for that reported value. Otherwise, a later change to scan setup could label cloned-repository scans as black-box while these tests still pass.

**Knowledge Base Used:** [CLI launch and scan setup](https://app.greptile.com/strix-org-3/-/custom-context/knowledge-base/usestrix/strix/-/docs/cli-launch-and-scan-setup.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

samirhvbr pushed a commit to samirhvbr/strix that referenced this pull request Oct 6, 2026
Bump to 1.7.0+shvia.22 and add the FORK.md row plus the four contributions
(usestrix#1469 dedupe lock, usestrix#1470 whitebox repository targets, usestrix#1471 test isolation from
the real home, usestrix#1472 trust fields in the PDF report). CLAUDE.md now says the suite
no longer writes the real ~/.strix, and that `import litellm` loads the current
directory's .env unless LITELLM_MODE=PRODUCTION.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TavwVMH7PvrD68JTDfd6Hb
Review feedback on usestrix#1470: the tests covered is_whitebox_scan and the runner, but not what
telemetry_start reports. Assert the is_whitebox label sent to both sinks for a cloned
repository, one that was not cloned, and a web target. The cloned case fails with the old
rule (type == local_code only).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TavwVMH7PvrD68JTDfd6Hb

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] GitHub repo targets scan as blackbox — source-aware skills not preloaded

1 participant