exec: context+timeout, find ldconfig via PATH (gosec G204, NixOS) - #684
Open
randomizedcoder wants to merge 1 commit into
Open
exec: context+timeout, find ldconfig via PATH (gosec G204, NixOS)#684randomizedcoder wants to merge 1 commit into
randomizedcoder wants to merge 1 commit into
Conversation
- Exec interface: Command → CommandContext.
- Validate() takes context; ldconfig call gets 10s timeout.
- Fall back to PATH lookup when /sbin/ldconfig{,real} are absent.
- Fixes NixOS where /sbin/ldconfig is not always present.
- #nosec G204 on the wrapper (generic by design).
- Add internal/pkg/exec/README.md policy.
- Regenerate exec mock.
- Update prerequisites tests.
Signed-off-by: randomizedcoder dave.seddon.ca@gmail.com <dave.seddon.ca@gmail.com>
randomizedcoder
added a commit
to randomizedcoder/dcgm-exporter
that referenced
this pull request
Jun 20, 2026
Map each finding addressed in the report to its upstream PR (NVIDIA/dcgm-exporter NVIDIA#681 NVIDIA#682 NVIDIA#683 NVIDIA#684 NVIDIA#685 NVIDIA#686 NVIDIA#687 NVIDIA#688 NVIDIA#689 NVIDIA#690 NVIDIA#691 NVIDIA#692 NVIDIA#693 NVIDIA#694). Signed-off-by: randomizedcoder dave.seddon.ca@gmail.com <dave.seddon.ca@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What: make the exec wrapper context-aware and find ldconfig via PATH.
Why: subprocess timeouts protect the daemon from hung children; PATH lookup makes the prereq check work on NixOS, where
/sbin/ldconfigis not always present.How:
Exec.Command→CommandContext;Validate(ctx); 10 sWithTimeoutindcgmlib_rule;exec.LookPathfallback when/sbin/ldconfig{,real}are absent.Tested by: updated prerequisites suite (passes a context; stubs
/sbin/ldconfig.realstat so tests are deterministic on NixOS hosts).Found by:
// #nosec G204and documented in the newinternal/pkg/exec/README.md.NixOS context: on NixOS
/sbin/ldconfigdoes not exist unless symlinked viasystemd.tmpfiles.rules. The PATH fallback removes the need for that workaround.