Repository navigation
fix(security): keep SkillSpector's nv_build model registry for Build scans - #288
Conversation
rng1995
left a comment
There was a problem hiding this comment.
Reviewed the diff plus the SkillSpector bridge in security.py, and verified the claim against a real SkillSpector install (pinned c7958a3, v2.12.0). No P1/P2 findings.
Verified: with the child env this code now builds (SKILLSPECTOR_PROVIDER=nv_build, OPENAI_API_KEY, OPENAI_BASE_URL=https://integrate.api.nvidia.com/v1, no NVIDIA_INFERENCE_KEY), is_llm_available() is (True, None), get_chat_model() returns a ChatOpenAI pointed at the Build URL, and get_max_output_tokens('openai/gpt-oss-120b') is 16384. The explicit SKILLSPECTOR_PROVIDER=nv_build path takes the same route and no extra credential is forwarded. Tests in test_security.py (nv_build / skillspector_child / public_nvidia) pass, 12 passed.
P3 (non-blocking, no change made): test_nv_build_child_environment_applies_skillspector_build_output_cap uses pytest.importorskip('skillspector'). SkillSpector is not a dependency of the project venv (CI installs it only in the separate /opt/skillspector venv), so that test is skipped in the normal Tests jobs and only the env-mapping asserts run there. I ran it manually against an installed SkillSpector and it passes. Consider a note or a CI job that runs it so the registry behavior is actually guarded.
Reviewed with Claude Code.
cafb7e3 to
cbb8a7a
Compare
…scans `--llm` security scans on the nv_build provider ran SkillSpector with SKILLSPECTOR_PROVIDER=openai. SkillSpector looks up token budgets in the active provider's model registry, and its OpenAI registry does not list Build-hosted models, so it fell back to a 128,000-token context and a 32,000-token output budget. Build models with a smaller output cap, such as openai/gpt-oss-120b (16,384 tokens), were asked for more output than SkillSpector's own Build registry allows, which can exceed what the endpoint accepts and leave the LLM security stage incomplete. An explicit SKILLSPECTOR_PROVIDER=nv_build, which the docs list as supported, was rewritten to openai the same way. Map nv_build to SkillSpector's nv_build provider. The child environment still carries no nv_build credential, so SkillSpector sends requests through its OPENAI_API_KEY/OPENAI_BASE_URL fallback with the public Build endpoint, exactly as before; only the budget metadata changes. Models the Build registry does not list keep the same 32,000-token default. Update the two routing tests that pinned openai, add a test for the explicit nv_build override, and add a check that runs an installed SkillSpector against the bridged environment (skipped when SkillSpector is not installed). Update the SkillSpector bridge docs and CHANGELOG. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
cbb8a7a to
36400f2
Compare
Summary
nv_buildprovider to SkillSpector's ownnv_buildprovider (SKILLSPECTOR_PROVIDER=nv_build) instead ofopenaiwhen SkillEvaluator bridges--llmsecurity scans. SkillSpector then sizes requests from its NVIDIA Build model registry.OPENAI_API_KEY/OPENAI_BASE_URLfallback: yourNVIDIA_API_KEYgoes out asOPENAI_API_KEY, and the base URL is the public Build endpoint. Only the token-budget metadata changes.SKILLSPECTOR_PROVIDER=nv_build. The docs already list that value as supported, but until now it was rewritten toopenaitoo.docs/environment-variables.mdx,docs/configuration.mdx) and add a CHANGELOG "Fixed" entry.Why
SkillSpector reads token budgets from the active provider's model registry. With
SKILLSPECTOR_PROVIDER=openai, Build-hosted models are not in that registry. SkillSpector then falls back to a 128,000-token context and a 32,000-token output budget. Itsnv_buildregistry caps models such asopenai/gpt-oss-120banddeepseek-ai/deepseek-v4-flash-0731at 16,384 output tokens. So an NVIDIA Build user who points--llmsecurity at one of these models gets requests for twice the model's output cap. Those requests can exceed what the endpoint accepts and leave the LLM security stage incomplete.I checked SkillSpector 2.11.2 and 2.12.0 offline (2.13.3 afterwards, see below), with dummy
OPENAI_*values and no network:SKILLSPECTOR_PROVIDER=openai(before)SKILLSPECTOR_PROVIDER=nv_build(after)openai/gpt-oss-120bdeepseek-ai/deepseek-v4-flash-0731z-ai/glm-5.2nvidia/nemotron-3-super-120b-a12b(default, not in either registry)I re-ran the same check with SkillSpector v2.13.3, the latest release:
SKILLSPECTOR_PROVIDER=nv_buildselectsNvBuildProviderand capsopenai/gpt-oss-120bat 16,384, whileSKILLSPECTOR_PROVIDER=openaistill does not select it, so the fix is still needed. In all three versionsis_llm_available()returns(True, None)withSKILLSPECTOR_PROVIDER=nv_build. The chat model is stillChatOpenAIpointed at the public Build endpoint. The default model's budget does not change. On GitHub, SkillSpector v2.9.5 and v2.9.6, the oldest versions this validator accepts, have the samenv_buildOpenAI fallback and the samegpt-oss-120bcap.Kept from public
NVIDIA_API_KEYis still never forwarded under its own name, and no second NVIDIA credential name reaches SkillSpector. The existing assertions for this stay as they are.SKILLSPECTOR_MODEL, then an explicitSKILL_EVAL_LLM_MODEL, then SkillSpector's per-provider default, which deliberately does not follow the chat default. The fix does not fall back to the chat default model.SKILLSPECTOR_PROVIDERvalues are unchanged.Tests
tests/validators/test_security.py:nv_buildrouting tests now expectSKILLSPECTOR_PROVIDER=nv_build. Credential and base-URL assertions are unchanged.test_explicit_nv_build_skillspector_provider_keeps_build_registry. With an explicitSKILLSPECTOR_PROVIDER=nv_buildand ambientOPENAI_*, it checks that the child getsnv_build, the requested model, and the Build key and endpoint, and thatNVIDIA_API_KEYis not forwarded.test_nv_build_child_environment_applies_skillspector_build_output_cap. It runs an installed SkillSpector in a fresh process with the bridged environment. It checks that the metadata provider isNvBuildProvider, that the LLM is available through the OpenAI fallback, and that the output budget foropenai/gpt-oss-120bdoes not exceed the Build registry cap. The test is skipped when SkillSpector is not installed, which includes CI.AssertionError: OpenAIProvider).nv_build,skillspector_childandpublic_nvidiatests all pass (12 passed).main. The only conflict was the CHANGELOG, next to the new entry from fix(quality): report the 5,000-token skill budget as advisory #272, and both entries are kept.pytest tests/validators: 2527 passed, 2 skipped (the SkillSpector-backed test, and one test that needs a case-sensitive filesystem).pyteston the security, OSS packaging/boundary/source-hygiene, provider config/routing and CI change-classifier tests: 871 passed, 1 skipped.ruff checkpasses on the changed Python files.ruff format --checkreports the same pre-existing drift asmainand none in the changed lines; CI runs onlyruff check.scripts/check_oss_boundary.py: passed.🤖 Generated with Claude Code