3.7 KiB
3.7 KiB
phase, plan, subsystem, tags, requires, provides, affects, tech_stack_added, patterns, key_files_created, key_files_modified, decisions, metrics
| phase | plan | subsystem | tags | requires | provides | affects | tech_stack_added | patterns | key_files_created | key_files_modified | decisions | metrics | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 10-osint-code-hosting | 06 | recon/sources |
|
|
|
|
|
|
|
|
Phase 10 Plan 06: HuggingFaceSource Summary
Implements HuggingFaceSource against the Hugging Face Hub API, sweeping both /api/spaces and /api/models for every provider keyword and emitting recon Findings with canonical huggingface.co URLs.
What Changed
- New
HuggingFaceSourceimplementingrecon.ReconSourcewith optionalToken. - Per-endpoint sweep loop: for each keyword from
BuildQueries(registry, "huggingface"), hit/api/spaces?search=...&limit=50then/api/models?search=...&limit=50. - URL normalization: space results mapped to
https://huggingface.co/spaces/{id}, model results tohttps://huggingface.co/{id}. - Rate limit is token-aware:
rate.Every(3600ms)when authenticated (matches 1000/hour),rate.Every(10s)otherwise. - Authorization header only set when
Token != "". - Compile-time assertion
var _ recon.ReconSource = (*HuggingFaceSource)(nil).
Test Coverage
All six TDD assertions in huggingface_test.go pass:
TestHuggingFaceEnabledAlwaysTrue— enabled with and without token.TestHuggingFaceSweepHitsBothEndpoints— exact Finding count (2 keywords × 2 endpoints = 4), both URL prefixes observed,SourceType="recon:huggingface".TestHuggingFaceAuthorizationHeader—Bearer hf_secretsent when token set, header absent when empty.TestHuggingFaceContextCancellation— slow server + 100ms context returns error promptly.TestHuggingFaceRateLimitTokenMode— authenticated rate is strictly faster than unauthenticated rate.
Plus httptest server shared by auth + endpoint tests (hfTestServer).
Deviations from Plan
None — plan executed exactly as written. One minor test refinement: tests pass Limiters: nil instead of constructing a real LimiterRegistry, because the production RateLimit of rate.Every(3600ms) with burst 1 would make four serialized waits exceed a reasonable test budget. The limiter code path is still exercised in production and the rate-mode contract is covered by TestHuggingFaceRateLimitTokenMode.
Commits
45f8782test(10-06): add failing tests for HuggingFaceSource39001f2feat(10-06): implement HuggingFaceSource scanning Spaces and Models