Skip to content

feat: added registry_url query param to /osm/api/registry-info endpoint#311

Open
sissl0 wants to merge 1 commit into
j3ssie:mainfrom
sissl0:main
Open

feat: added registry_url query param to /osm/api/registry-info endpoint#311
sissl0 wants to merge 1 commit into
j3ssie:mainfrom
sissl0:main

Conversation

@sissl0

@sissl0 sissl0 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

The /osm/api/registry-info endpoint previously could only return info about the embedded registry. Custom registry sources could only be configured at install time via the registry_url field in the POST body of /osm/api/registry-install.
This PR exposes registry_url as a query parameter on the GET endpoint so callers can point the info endpoint at a custom registry URL or local file path without making a separate install request. The description and docs were adjusted as well.
The customHeaders field for LoadRegistry was not implemented, only pathOrURL.
Implemented for both registry modes:

  • direct-fetch (default) : Replaces the full binary list source (URL or file path)
  • nix-build : Used as a metadata overlay — desc, tags, version, repo_link for each tool

Changes

pkg/server/handlers/install.go

  • GetRegistryInfo: updated swagger annotation — added registry_url query param with dual-mode description.
  • getDirectFetchRegistry: already read registry_url from the query; no logic change.
  • getNixBuildRegistry: now reads registry_url from the query and passes it to installer.LoadRegistry for the metadata overlay. The field is included in the JSON response.

docs/api-swagger/swagger.yaml

  • Added registry_url query parameter entry to GET /osm/api/registry-info with the dual-mode description.

docs/api-swagger/swagger.json

  • Same change as swagger.yaml (JSON counterpart).

docs/api-swagger/docs.go

  • Same change as swagger.yaml (Go-embedded counterpart).

docs/api/install.mdx

  • Updated registry_url row in the Query Parameters table to describe both modes.
  • Added a registry_url usage example under the Nix-Build Mode section.
  • Added registry_url field to the Nix-Build Response Fields table.

test/e2e/api_test.go

  • Added imports: net/url, path/filepath, runtime.
  • Added helper getPresetRegistryPath — resolves the path to public/presets/registry-metadata-direct-fetch.json relative to the test file.
  • Rewrote testRegistryEndpoint with four sub-cases:
    1. Default embedded registry (direct-fetch, no registry_url).
    2. Local preset file via registry_url in direct-fetch mode — verifies registry_url is echoed back and binaries contains known entries (amass, nuclei).
    3. Nix-build mode without registry_url — verifies nix_installed, categories, and registry_url fields are present.
    4. Nix-build mode with preset registry_url — verifies registry_url is echoed back.

Affected Files

pkg/server/handlers/install.go
docs/api-swagger/swagger.yaml
docs/api-swagger/swagger.json
docs/api-swagger/docs.go
docs/api/install.mdx
test/e2e/api_test.go

Test Output

The build was successful and tests returned no errors.

go test -v -run 'TestAPI_AllEndpoints/Registry' ./test/e2e/ -timeout 120s 2>&1
=== RUN   TestAPI_AllEndpoints
    api_test.go:220: 2026-06-11T22:27:34+02:00 INFO ==> Step: Running API E2E tests
    api_test.go:227: 2026-06-11T22:27:34+02:00 INFO ==> Step: Step 1: Starting Redis
    api_test.go:228: 2026-06-11T22:27:34+02:00 INFO Starting Redis container for API tests
    api_test.go:228: 2026-06-11T22:27:36+02:00 INFO Waiting for Redis on port 6399...
    api_test.go:228: 2026-06-11T22:27:36+02:00 INFO ✓ Redis is ready
    api_test.go:232: 2026-06-11T22:27:36+02:00 INFO ==> Step: Step 2: Cleaning and seeding database
    api_test.go:233: 2026-06-11T22:27:46+02:00 INFO Cleaning database...
    api_test.go:233: 2026-06-11T22:27:46+02:00 INFO Seeding database with sample data...
    api_test.go:233: 2026-06-11T22:27:46+02:00 INFO ✓ Database seeded successfully
    api_test.go:236: 2026-06-11T22:27:46+02:00 INFO ==> Step: Step 3: Starting API server
    api_test.go:239: 2026-06-11T22:27:46+02:00 INFO Starting API server on port 37945
    api_test.go:239: 2026-06-11T22:27:46+02:00 INFO Waiting for API server at http://localhost:37945/health...
    api_test.go:239: 2026-06-11T22:27:47+02:00 INFO ✓ API server is ready
    api_test.go:243: 2026-06-11T22:27:47+02:00 INFO ==> Step: Step 4: Running API endpoint tests
=== RUN   TestAPI_AllEndpoints/Registry
=== NAME  TestAPI_AllEndpoints
    api_test.go:487: 2026-06-11T22:27:47+02:00 INFO Testing registry endpoint
    api_test.go:492: 2026-06-11T22:27:47+02:00 INFO Testing default registry (embedded)
    api_test.go:501: 2026-06-11T22:27:47+02:00 INFO Testing registry_url with preset file (direct-fetch)
    api_test.go:514: 2026-06-11T22:27:47+02:00 INFO Testing registry_mode=nix-build (no custom registry_url)
    api_test.go:524: 2026-06-11T22:27:47+02:00 INFO Testing registry_mode=nix-build with preset registry_url for metadata
    api_test.go:531: 2026-06-11T22:27:47+02:00 INFO ✓ Registry endpoint OK
    api_test.go:305: 2026-06-11T22:27:47+02:00 INFO ✓ All API E2E tests passed!
    api_test.go:115: 2026-06-11T22:27:47+02:00 INFO Stopping API server
    api_test.go:45: 2026-06-11T22:27:47+02:00 INFO Stopping Redis container
--- PASS: TestAPI_AllEndpoints (13.74s)
    --- PASS: TestAPI_AllEndpoints/Registry (0.02s)

@sissl0 sissl0 changed the title Added registry_url query param to /osm/api/registry-info endpoint feat: added registry_url query param to /osm/api/registry-info endpoint Jun 11, 2026
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.

1 participant