Repository navigation
Conversation
liotur
force-pushed
the
secrets-env-vars-7642
branch
from
October 12, 2026 07:27
193e933 to
fe5275b
Compare
…ent variable Maven logs the plugin configuration unmasked when run with -X, so an ossIndexPassword passed on the command line or in the pom ends up in the build log. The NVD API key already avoids this through nvdApiKeyEnvironmentVariable; add ossIndexPasswordEnvironmentVariable that works the same way. A directly configured ossIndexPassword still wins, and the environment variable takes precedence over ossIndexServerId, matching the NVD API key precedence. Also document nvdApiKeyEnvironmentVariable in the Maven configuration page, where it was missing, and point ossIndexPassword users at the safer alternatives. Relates to dependency-check#7642
liotur
force-pushed
the
secrets-env-vars-7642
branch
from
October 12, 2026 07:30
fe5275b to
5c06157
Compare
This branch has not been deployed
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.
Description of Change
Maven logs the plugin configuration unmasked when run with
-X, so anossIndexPasswordpassed with-Dor set in the pom ends up in the build log. The NVD API key already hasnvdApiKeyEnvironmentVariablefor this. This addsossIndexPasswordEnvironmentVariableto the Maven plugin, which works the same way and uses the same precedence:ossIndexPassword>ossIndexPasswordEnvironmentVariable>ossIndexServerId.ossIndexUsernameis still applied alongside it for legacy OSS Index tokens. If the named variable is unset or empty, the server id is not used as a fallback; that deliberately mirrors the NVD handling.aikebah asked for this option on #7631 and also noted that
nvdApiKeyEnvironmentVariablewas missing from the Maven configuration page, so this adds that row too. As he suggested there, theossIndexPassworddocs now steer users to the server id or the environment variable instead of setting the password directly.NVD already has this option, so this adds it for OSS Index only. As aikebah suggested on #7640, the user/password settings for on-prem services (Nexus, Artifactory, NVD datafeed mirrors, the database) are left for separate changes. This is also Maven only: Ant and the CLI don't have the NVD environment variable option either, and the Gradle plugin lives in its own repository. I've marked #7642 as related rather than fixed, so you can decide whether it should stay open for those.
Related issues
Have test cases been added to cover the new functionality?
Yes. Three unit tests in
BaseDependencyCheckMojoTestrunpopulateSettings()and check that the variable is read, that it takes precedence overossIndexServerId, and that a directly setossIndexPasswordtakes precedence over it. The first two fail without the change; the third guards the existing behavior.mvn -pl maven -Dtest=BaseDependencyCheckMojoTest testpasses (9/9) on JDK 25, and so do the rest of themavenmodule's unit tests (20/20).