Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running tool w/out BOTH username & API token silently ignores the other input parameter #8

Open
mcallaghan-bsm opened this issue Jun 22, 2020 · 0 comments

Comments

@mcallaghan-bsm
Copy link

see https://github.com/fabiano/dotnet-ossindex/blob/master/DotNetOSSIndex/Program.cs#L210

            if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(ApiToken))
            {
                var bytes = Encoding.UTF8.GetBytes($"{Username}:{ApiToken}");
                var value = Convert.ToBase64String(bytes);

                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", value);
            }
$ dotnet-ossindex --help
A .NET Core global tool to check the packages for known vulnerabilities.

Usage: dotnet ossindex [options] <Path>

Arguments:
  Path                        The path to a .sln, .csproj or .vbproj file

Options:
  -u|--username <USERNAME>    OSS Index Username
  -a|--api-token <API_TOKEN>  OSS Index API Token
  -?|-h|--help                Show help information

It wasn't clear to us that BOTH the username and the token were required, so when we were making requests, we started only supplying the token; and the tool didn't complain or reject;

As a precaution, it would be great if the tool does sanity check here; something like:

            if (!string.IsNullOrEmpty(Username) || !string.IsNullOrEmpty(ApiToken))
           >> ERROR, must supply both `--api-token` and `--username`
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

No branches or pull requests

1 participant