Part of the pilot P0 (#338), item D (submodules). Stacked on #346.
Why
Firmware repositories pull their HAL, RTOS or protocol stack in as submodules. They were never fetched, so a scan missed code the product ships and did not say so.
What
New pipeline/git_submodules.rs, GitOps::update_submodules(repo_path, origin_url):
checks out submodules recursively, up to 3 levels, after clone/fetch; called by the scan pipeline and by ingest (classification);
relative URLs (../hal.git) are resolved against the parent remote the way git does, and cannot climb above the host;
every URL goes through reject_ssh_url and check_remote (net guard plus DNS check) with redirects off, like the main remote;
the checked URL is written to submodule.<name>.url in the local config, so libgit2 fetches exactly that URL;
the repository's token goes only to the main remote's host; other hosts are fetched anonymously.
A refused or failed submodule is left out and recorded:
a git_submodules skipped stage on the scan run ("not checked out, so not scanned: hal (git@…): SSH git URLs are not supported …");
a submodule_skipped fact at ingest;
the dashboard labels the stage "Git-Submodule".
Verification
Unit tests:
relative URL resolution (../, ./, ../../, above the host, absolute);
an SSH submodule and a private-address submodule are both reported and not fetched.
clippy with the CI flags; fmt.
Real-world check (local agent image built from this branch): onboarded https://github.com/libopencm3/libopencm3-template (its libopencm3 submodule is on GitHub) as a git target and scanned it:
the run completed with no skipped stage;
libopencm3/ was checked out in both the scan clone and the ingest clone (COPYING.GPL3, Makefile, … present).
Still to do on staging: a submodule on the same private host as the main repository, so the token is reused for it.
Part of the pilot P0 (#338), item D (submodules). **Stacked on #346.**
## Why
Firmware repositories pull their HAL, RTOS or protocol stack in as submodules. They were never fetched, so a scan missed code the product ships and did not say so.
## What
- New `pipeline/git_submodules.rs`, `GitOps::update_submodules(repo_path, origin_url)`:
- checks out submodules recursively, up to 3 levels, after clone/fetch; called by the scan pipeline and by ingest (classification);
- relative URLs (`../hal.git`) are resolved against the parent remote the way git does, and cannot climb above the host;
- every URL goes through `reject_ssh_url` and `check_remote` (net guard plus DNS check) with redirects off, like the main remote;
- the checked URL is written to `submodule.<name>.url` in the local config, so libgit2 fetches exactly that URL;
- the repository's token goes only to the main remote's host; other hosts are fetched anonymously.
- A refused or failed submodule is left out and **recorded**:
- a `git_submodules` skipped stage on the scan run ("not checked out, so not scanned: hal (git@…): SSH git URLs are not supported …");
- a `submodule_skipped` fact at ingest;
- the dashboard labels the stage "Git-Submodule".
## Verification
- Unit tests:
- relative URL resolution (`../`, `./`, `../../`, above the host, absolute);
- an SSH submodule and a private-address submodule are both reported and not fetched.
- clippy with the CI flags; fmt.
- **Real-world check (local agent image built from this branch):** onboarded `https://github.com/libopencm3/libopencm3-template` (its `libopencm3` submodule is on GitHub) as a git target and scanned it:
- the run **completed** with no skipped stage;
- `libopencm3/` was checked out in both the scan clone and the ingest clone (`COPYING.GPL3`, `Makefile`, … present).
- Still to do on staging: a submodule on the same private host as the main repository, so the token is reused for it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
Firmware repositories pull their HAL, RTOS or protocol stack in as
submodules. They were never fetched, so a scan of such a repository
missed code the product ships and did not say so.
- Submodules are checked out after the clone or fetch, recursively up to
three levels, for the scan and for classification.
- Each URL (relative ones resolved as git does) must pass the same checks
as the main remote: HTTPS only, a public host, no redirects. The URL
that was checked is written to the local config, so it is the one
fetched.
- The repository's token is offered only to the main remote's host; a
submodule elsewhere is fetched anonymously.
- A submodule that is refused or fails is left out and recorded: a
`git_submodules` skipped stage on the scan run (with a German label in
the dashboard) and a `submodule_skipped` fact at ingest.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of the pilot P0 (#338), item D (submodules). Stacked on #346.
Why
Firmware repositories pull their HAL, RTOS or protocol stack in as submodules. They were never fetched, so a scan missed code the product ships and did not say so.
What
pipeline/git_submodules.rs,GitOps::update_submodules(repo_path, origin_url):../hal.git) are resolved against the parent remote the way git does, and cannot climb above the host;reject_ssh_urlandcheck_remote(net guard plus DNS check) with redirects off, like the main remote;submodule.<name>.urlin the local config, so libgit2 fetches exactly that URL;git_submodulesskipped stage on the scan run ("not checked out, so not scanned: hal (git@…): SSH git URLs are not supported …");submodule_skippedfact at ingest;Verification
../,./,../../, above the host, absolute);https://github.com/libopencm3/libopencm3-template(itslibopencm3submodule is on GitHub) as a git target and scanned it:libopencm3/was checked out in both the scan clone and the ingest clone (COPYING.GPL3,Makefile, … present).🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
7c7657d90bto7c638c1068