Repository navigation
Closed
Labels
priority/p2-mediumPriority P2: standard workscope/cliCore CLI framework, Typer subcommands, options, and tablestype/bugType bug: the code does not do what it must
Milestone
Description
Problem
The devsecops review session 20261001-224227 (2026-10-02, a path review of the whole repository with local models) raised 563 findings. A triage of every finding against release/v0.2.25 (c279c18) judged 489 false. Each of the 7 defects below was confirmed with code evidence and then upheld by a second agent that tried to refute it. The severities are re-rated; the review's own ratings were inflated.
Inconsistent Documentation for --max-tokens Parameter in devops ai gateway tune (src/devops_cli/docs/generator.py:229, LOW, docs)
- Defect: The doc generator hides defaults that are not sensitive. introspect_param marks a param sensitive when any of
_SENSITIVE_PARAM_KEYWORDS(generator.py:194: SECRET, TOKEN, PASSWORD, KEY, AUTH, ...) is a substring of the param name or envvar (kw in (param.name or "").upper(), :229-232). It then setsdefault_str = "<masked>"(:233-234) for any default value, whatever its type. BecauseMAX_TOKENScontainsTOKEN,devops ai gateway tune --max-tokens(ai_gateway.py:379-381, defaultDEFAULT_GATEWAY_TUNE_MAX_TOKENS: int = 200, defaults.py:112) shows<masked>at docs/commands/ai.md:1578. The same substring rule masks--max-tokens-increase0.20 (ai.md:1726),--valkey-port(VALKEY contains KEY, k8s.md:268),--key-size2048/4096 (tls.md:24,47),--max-tokensfor pack-context (ai.md:280), and resource names--secret/--secret-name(ai.md:1645, k8s.md:433, tls.md:124). The … - Skeptic's ruling: I reproduced this against c279c18 and could not refute it.
DocGenerator.introspect_param(src/devops_cli/docs/generator.py,_SENSITIVE_PARAM_KEYWORDSand theis_sensitiveblock) checks whether a keyword appears anywhere in the uppercased param name or envvar, and masks the default whatever its type. Calling it directly on click.Option(['--max-tokens'], INT, 200), ['--valkey-port'] 6379 and ['--key-size','-k'] 4096 returns<masked>for all three. Ten rows in the committed docs show … - Fix: In
DocGenerator.introspect_param, mask only whendefault_valis astr(never int, float, bool or Path). Match the keywords against whole name tokens (splitparam.nameand envvar on_/-, e.g. TOKEN, SECRET, PASSWORD, APIKEY/API_KEY, AUTH, CREDENTIAL, PASSPHRASE) instead of substrings, so that MAX_TOKENS, VALKEY_PORT and KEY_SIZE no longer match. Optionally, for str defaults whose name matches, show the value when it is a plain resource identifier and mask otherwise. Then rundevops docs generateto regenerate docs/commands/*.md and CLI_REFERENCE.md, editing the generator rather than the .md files. - Regression test: Extend tests/test_docs.py::test_doc_generator_masks_sensitive_param_defaults, or add a parametrized test: introspect_param(click.Option(['--max-tokens'], type=click.INT, default=200)).default == '200', the same for ['--valkey-port'] 6379 -> '6379', ['--key-size','-k'] 4096 -> '4096' and ['--max-tokens-increase'] FLOAT 0.2 -> '0.2'. Keep the existing asserts that
--api-keywith a str default and--authwith envvar DEVOPS_AUTH_TOKEN still return ''. All four new asserts get '' …
Masked Value in Documentation (src/devops_cli/docs/generator.py:229, LOW, docs)
- Defect: introspect_param masks a default whenever a keyword appears anywhere in the parameter name:
_SENSITIVE_PARAM_KEYWORDS = {"SECRET","TOKEN","PASSWORD","KEY",...}(generator.py:194),is_sensitive = any(kw in (param.name or "").upper() ...)and thendefault_str = "<masked>"(:229-234). Ordinary numeric defaults get masked as a result.max_tokenscontains TOKEN (CLI_REFERENCE.md:3070 pack-context, :4332 gateway tune; docs/commands/ai.md:280, 1578).max_tokens_increase(:4478) is masked too.valkey_port, whose real default is DEFAULT_VALKEY_PORT=6379 (config/defaults.py:462), is masked because vaLKEY contains KEY (:839, docs/commands/k8s.md:268), andkey_size(2048/4096) is masked as well (:7358, :7379). Kubernetes Secret names are hidden too (--secret= 'valkey-runs-auth',--secret-name). The generated reference therefore hides real defaults that are not secrets. The only … - Skeptic's ruling: I could not refute this, and I reproduced it on c279c18. DocGenerator.introspect_param sets is_sensitive whenever any of {SECRET, TOKEN, PASSWORD, KEY, AUTH, CREDENTIAL, APIKEY, PASSPHRASE} is a substring of param.name.upper(), then masks every default except the literal strings None, False, True, 0 and ''. click.Option(['--max-tokens'], default=4096), '--valkey-port'=6379, '--key-size'=2048, '--max-tokens-increase'=0.2 and '--secret-name'='homelab-tls' all render as . So does an …
- Fix: In docs/generator.py, mask by value type and by whole-word name matching, not by substring. Never mask int, float, bool or Path defaults. For str defaults, split param.name on '_' and '-' and match whole tokens against {token, secret, password, passphrase, apikey, credential, auth}, plus the bigram api_key. Exempt names ending in _name, _size, _port and _increase, and names whose token is 'secret' when the help text says it names a Kubernetes Secret. Better still, let options opt in through an explicit sensitive marker, such as a set of known param names, or reuse the existing secret sanitizer on the value. Then regenerate docs/CLI_REFERENCE.md and docs/commands/*.md through the docs generator command.
- Regression test: Extend tests/test_docs.py with a parametrised test that calls generator.introspect_param(click.Option([flag], default=value)). It asserts the plain default for ('--max-tokens', 4096) -> '4096', ('--valkey-port', 6379) -> '6379', ('--key-size', 2048) -> '2048', ('--max-tokens-increase', 0.2) -> '0.2' and ('--secret-name', 'homelab-tls') -> 'homelab-tls'. It still asserts '' for ('--api-token', 'abc'), ('--password', 'x') and ('--api-key', 'sk-123'). Add a check that the regenerated …
Ambiguous Rootless Option Default Value (src/devops_cli/docs/generator.py:213, LOW, docs)
- Defect:
--rootless/--rootis a Click on/off pair, not two aliases. docker.py:462-465 definestyper.Option("--rootless/--root", ...)] = True:--rootsets rootless=False, which drops the host UID/GID mapping (docker/sandbox.py:164,262if self.config.rootless ...), so the container runs as the image's default user. The generator merges secondary (off) opts into the same list as aliases (flags = raw_opts + sec_opts, generator.py:213) and joins them with commas (", ".join(...), :481). docs/commands/docker.md:167 therefore renders| --rootless, --root | boolean | True | Run container with host user UID/GID |, in the same format used for real aliases (e.g.--auto-sync, --reindex, -s). The reviewer itself took them for aliases.--keyless, --keyed(docker.md:191) is ambiguous in the same way. Nothing tells a reader that--rootturns off the UID/GID mapping. - Skeptic's ruling: Confirmed. docker.py:462-465 declares
typer.Option("--rootless/--root")with a default of True. That is a Click on/off pair:--rootsets rootless=False, which skips the host UID/GID mapping at docker/sandbox.py:164 and :262.introspect_parambuildsflags = raw_opts + sec_opts, and the renderer joins all flags with ', ' (generator.py:481), the same way it joins real aliases such as--key-size,-k. Calling introspect_param on the option returns flags ['--rootless', '--root'] with … - Fix: Add
off_flags: list[str]to ParamDoc, filled fromparam.secondary_opts, and stop merging it intoflags. In_render_command_markdown, render on/off pairs as`--rootless` / `--root`, or append 'Disable with--root.' to the description, and keep comma-joining for true aliases only. Regenerate the docs withdevops docs generateso that docker.md, test.md, pr.md, gh.md and CLI_REFERENCE.md are updated. - Regression test: New test in tests/test_docs.py: introspect_param(click.Option(['--rootless/--root'], default=True, help='x')) should give flags == ['--rootless'] and off_flags == ['--root']. The rendered markdown for a command carrying this option should not contain '
--rootless,--root' and should contain '--rootless/--root', or the disable hint. Today flags == ['--rootless', '--root'] and the comma-joined form is rendered.
Missing Environment Variable for telemetry.enabled (src/devops_cli/telemetry/tracer.py:1299, LOW, docs)
- Defect: The proposed variable doesn't exist, but the doc row is still false. docs/CONFIGURATION.md:46 shows
| enabled | bool | True | - | - |because the generator (docs/generator.py:778) reads the env column from OPTION_TO_ENV_VAR (config/env.py:98-175), which has no telemetry.* key. At runtime get_tracer() readsenv_enabled = os.getenv("DEVOPS_TELEMETRY_ENABLED")(tracer.py:1299) and endpoint overrides DEVOPS_OTEL_ENDPOINT, OTEL_EXPORTER_OTLP_ENDPOINT and DEVOPS_CLI_OTEL_ENDPOINT (tracer.py:1295-1297). These names sit outside the DEVOPS_CLI_ registry and appear in neither docs/ENV_VARS.md nor CONFIGURATION.md. Only an error string mentions DEVOPS_TELEMETRY_ENABLED (commands/telemetry.py:389). The nested form doesn't work either: with DEVOPS_CLI_TELEMETRY__ENABLED=false, load_settings() still returned telemetry.enabled=True, because Settings.model_validate (settings.py:843) skips … - Skeptic's ruling: Confirmed at c279c18, and I could not refute it. The generated row docs/CONFIGURATION.md:46 shows
enabled | bool | True | - | -. The generator fills the env column from OPTION_TO_ENV_VAR (docs/generator.py ~778), and config/env.py has no telemetry.enabled or telemetry.endpoint key. The page header says env overrides areDEVOPS_CLI_*. At runtime get_tracer() (telemetry/tracer.py:1294-1299) reads unregistered names: DEVOPS_TELEMETRY_ENABLED for enabled, and DEVOPS_OTEL_ENDPOINT > … - Fix: Add TELEMETRY_ENABLED and TELEMETRY_ENDPOINT to config/options.py and map them in config/env.py to DEVOPS_CLI_TELEMETRY_ENABLED and DEVOPS_CLI_TELEMETRY_ENDPOINT, with EnvVarSpec descriptions. In get_tracer(), take enabled and endpoint from load_settings(), whose _apply_env_overrides already applies registered variables. Keep OTEL_EXPORTER_OTLP_ENDPOINT only as the OTel-standard fallback. Delete the DEVOPS_TELEMETRY_ENABLED, DEVOPS_OTEL_ENDPOINT and DEVOPS_CLI_OTEL_ENDPOINT reads with no shim (pre-1.0). Update commands/telemetry.py:389, tests/conftest.py:386, tests/test_telemetry_collector_export.py:87 and the generator.py:913 TELEMETRY.md line. Either drop env_nested_delimiter from Settings or document that it is inert. Regenerate CONFIGURATION.md, ENV_VARS.md and TELEMETRY.md. Coordinate with fix(cli): cli start-up imports no telemetry when the bridge is off, and timing tests stop asserting host speed #858, which changes tracer start-up imports.
- Regression test: tests/test_config_env_overrides.py: monkeypatch.setenv('DEVOPS_CLI_TELEMETRY_ENABLED', 'false'), reset_settings_cache(), reset_tracer(), then assert get_tracer().enabled is False and load_settings().telemetry.enabled is False. Second test: DocGenerator.generate_configuration_docs() contains '
DEVOPS_CLI_TELEMETRY_ENABLED' on the telemetryenabledrow. Optional guard: AST-scan src/ for os.getenv/os.environ.get string literals starting with 'DEVOPS_' and assert each is in ENV_VAR_TO_OPTION or …
Duplicate Cadence B Section Heading (docs/ROUTINE_TASKS.md:164, LOW, docs)
- Defect: Two sections share one cadence label:
### Cadence B: Final Pre-Commit / Pre-PR Validation Stage(line 139) and### Cadence B: Feature & Pull Request Lifecycle(line 164), followed by C, D and E. The finding is wrong that the second section duplicates the first (the content differs), but the lettering is objectively broken: 'Cadence B' names two different procedures. Older task files refer to the sections as 'Cadence B / Feature PR Lifecycle' and 'Cadence C Step 8', so the label is used as an anchor. None of docs: hand-written docs name only commands, options and components that exist #921's listed ROUTINE_TASKS corrections covers the heading. - Skeptic's ruling: Confirmed. docs/ROUTINE_TASKS.md has
### Cadence B: Final Pre-Commit / Pre-PR Validation Stage(line 139) and### Cadence B: Feature & Pull Request Lifecycle(line 164), followed by C (Release, 243), D (Security, 286) and E (Workspace, 335). The original finding is wrong that the second section duplicates the first, since the bodies differ, but one label names two procedures. Task files use these labels as anchors: docs/agent/tasks/task-169 says 'Cadence B / Feature PR Lifecycle', and … - Fix: Relabel line 139 as the final stage of Cadence A, for example
### Cadence A (final stage): Pre-Commit / Pre-PR Validation, or#### Step Nunder Cadence A. That leaves 'Cadence B = Feature & PR Lifecycle' and 'Cadence C = Release' (with Step 8) unchanged, so existing task-file references stay correct. Land it in the same PR as docs: hand-written docs name only commands, options and components that exist #921's ROUTINE_TASKS.md corrections. - Regression test: tests/test_docs_routine_tasks.py: parse docs/ROUTINE_TASKS.md with re.findall(r'^### Cadence ([A-Z]):', text, re.M) and assert the letters are unique and consecutive from 'A'. Today it yields ['A','B','B','C','D','E'] and fails.
Incomplete Tool Definition Example (src/devops_cli/ai/knowledge_base/devops_cli/libraries/fastmcp.md:54-65, LOW, docs)
- Defect: Under the heading 'Declaring an MCP Tool in DevOps CLI', the example has
from devops_cli.commands.k8s import podsand a bodyreturn f"Pods in namespace '{namespace}' retrieved successfully.".devops_cli.commands.k8sexportspods_cmd(commands/k8s/init.py:44, 125, 171), notpods, so the import raises ImportError. The real tools follow a different pattern:_validate_mcp_arg(...)then_run_mcp_cmd(["uv","run","devops",...])(ai/mcp/server.py:274-282). The KB is RAG-retrieved bydevops ai chatand the harness (fix(ai): the knowledge base names only commands, options and components that exist #920), so agents are taught a broken import and the wrong pattern. The finding's proposed fix calls the same nonexistentpods. A separate code defect turned up nearby: the realk8s_podsMCP tool at ai/mcp/server.py:275 validatesnamespacebut then runsdevops k8s statuswithout it, so the argument is ignored. - Skeptic's ruling: Confirmed false doc example. libraries/fastmcp.md:53-65, under the heading "Declaring an MCP Tool in DevOps CLI", has
from devops_cli.commands.k8s import pods. Running that import against the assess tree raisesImportError: cannot import name 'pods' from 'devops_cli.commands.k8s'. The package exportspods_cmd, there is nopodssubmodule, and_K8sModuleonly overrides__setattr__. The example body returns a canned string. Real tools in ai/mcp/server.py follow a different pattern: … - Fix: Replace the example with the real devops-cli pattern:
@mcp.tool() def k8s_pods(namespace: str = "default") -> str: _validate_mcp_arg("namespace", namespace); return _run_mcp_cmd(["uv","run","devops","k8s","pods","-n",namespace], timeout=DEFAULT_MCP_TOOL_FAST_TIMEOUT_SECONDS). Reword "Lazy Tool Execution" to say that tools shell out to thedevopsCLI. Add this to fix(ai): the knowledge base names only commands, options and components that exist #920's correction list. Separately, change ai/mcp/server.pyk8s_podsto rundevops k8s pods -n <namespace>(or-Awhen the namespace is empty) so the argument takes effect. - Regression test: Add a no-network test, tests/test_kb.py::test_kb_python_examples_import_real_symbols. For every ```python fence in src/devops_cli/ai/knowledge_base/**/*.md, parse it with ast. For each
from devops_cli.X import Y, assert that `importlib.import_module('devops_cli.X')` succeeds and that `hasattr(mod, 'Y')` is true or `devops_cli.X.Y` is importable as a submodule. On failure, name the file and line. It fails today on fastmcp.md:56 (`pods`). For the MCP fix, add …
Misleading devops ai review Command Usage for CVE Lookup (docs/cheatsheets/security_and_ssh.md:23, LOW, docs)
- Defect: The finding's main claim is wrong.
devops ai review pathexists (docs/CLI_REFERENCE.md:3263) and does extract dependencies and query live services: _extract_dependencies_and_network_references and then _fetch_vulnerabilities_and_reputations (ai/review/pipeline.py:2123-2130) call OSVClient.query_batch, Shodan and Cloudflare Radar (pipeline.py:1860-1896); reference_extractor.py covers PyPI, npm, crates.io and Go. But the cheatsheet's 'audits against live OSV.dev and NVD APIs' is false for NVD. NVDClient (security/vulnerability_lookup.py:307) is only re-exported (security/init.py:46,60) and never called. The same false NVD claim appears in agent-facing text: the MCP toolsecurity_intel_packagedocstring 'Query OSV.dev and NVD vulnerability databases' (ai/mcp/server.py:801, rendered into MCP_TOOLS.md:142,1558), and scan_osv's docstring and its reply 'No known vulnerabilities found … - Skeptic's ruling: The original claim, that
devops ai review pathdoes no dependency or live lookups, is false. The pipeline extracts dependencies and calls OSVClient.query_batch, Shodan and Cloudflare Radar. But every NVD claim is false. NVDClient (security/vulnerability_lookup.py:307) has no production caller; its only references are re-exports in security/init.py:46,60 and tests/test_vulnerability_lookup.py. False NVD claims appear in user- and agent-facing text: the cheatsheet at … - Fix: Remove 'NVD' from the cheatsheet row, the security_intel_package and scan_osv docstrings, scan_osv's reply, both pipeline.py report headings and the knowledge-base line, then regenerate MCP_TOOLS.md. Delete NVDClient, _parse_nvd_record, their exports and their test (pre-1.0, no shim), unless NVD coverage is wanted, in which case wire it in. In the same change, make query_package return a status the way query_batch's PackageLookupResult does, so scan_osv answers 'OSV lookup failed: ' instead of 'No known vulnerabilities' when the request errors.
- Regression test: tests/test_builtin_tools.py: patch OSVClient.query_package to return []; assert 'NVD' not in scan_osv('requests', '2.0.0') and 'NVD' not in security_intel_package.doc. Patch OSVClient._client.post to raise httpx2.ConnectError; assert scan_osv(...) does not contain 'No known vulnerabilities' and mentions the lookup failure. Docs guard: assert 'NVD' not in docs/cheatsheets/security_and_ssh.md or MCP_TOOLS.md while no code path calls NVDClient. All fail today.
Acceptance criteria
- Each defect above is fixed as its Fix line describes, or the PR says why another fix is better.
- Each has its Regression test: offline, failing on the base revision and passing after the fix.
- Removed code goes without shims (pre-1.0), and docs that described it are corrected.
uv run devops cipasses.
Key questions
- One PR for all of these? Yes (proposed). They share a module area and none needs a design decision; each fix is small.
Metadata
Metadata
Assignees
Labels
priority/p2-mediumPriority P2: standard workscope/cliCore CLI framework, Typer subcommands, options, and tablestype/bugType bug: the code does not do what it must
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(docs): generated docs show non-secret defaults and off switches, …
dan-petty commentedon Oct 3, 2026
Closed by #1074, merged into
release/v0.2.25.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(release): v0.2.25 (#1089)