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

use default un/pw if none supplied in environment #290

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions OdbDesignLib/App/BasicRequestAuthentication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,19 @@
crow::response BasicRequestAuthentication::VerifyCredentials(const std::string& username, const std::string& password)
{
// 500 - Internal Server Error
auto validUsername = std::getenv(USERNAME_ENV_NAME);

Check warning on line 43 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (windows-2022, x64-release)

'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

Check warning on line 43 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (windows-2022, x64-release)

'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
if (validUsername == nullptr) return crow::response(500, "Failed retrieving credentials");
if (validUsername == nullptr) //return crow::response(500, "Failed retrieving credentials");
{
// default username if none supplied in environment
validUsername = "odb";

Check warning on line 47 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (ubuntu-22.04, linux-release)

ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Check warning on line 47 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (macos-12, macos-release)

ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]

Check warning on line 47 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (ubuntu-22.04, linux-release)

ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Check warning on line 47 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (macos-12, macos-release)

ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
}

auto validPassword = std::getenv(PASSWORD_ENV_NAME);

Check warning on line 50 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (windows-2022, x64-release)

'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

Check warning on line 50 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (windows-2022, x64-release)

'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
if (validPassword == nullptr) return crow::response(500, "Failed retrieving credentials");
if (validPassword == nullptr) //return crow::response(500, "Failed retrieving credentials");
{
// default password if none supplied in environment
validPassword = "plusplus";

Check warning on line 54 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (ubuntu-22.04, linux-release)

ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Check warning on line 54 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (macos-12, macos-release)

ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]

Check warning on line 54 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (ubuntu-22.04, linux-release)

ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Check warning on line 54 in OdbDesignLib/App/BasicRequestAuthentication.cpp

View workflow job for this annotation

GitHub Actions / CMake-Multi-Platform-Build (macos-12, macos-release)

ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
}

// 403 - Forbidden
if (username != validUsername ||
Expand Down
Loading