diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..869fdfe2b --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). + + diff --git a/common/redisreply.cpp b/common/redisreply.cpp index c1b0de834..8b83aa59d 100644 --- a/common/redisreply.cpp +++ b/common/redisreply.cpp @@ -340,6 +340,19 @@ string RedisReply::formatReply(string command, const char* str, size_t len) { return string("True"); } + + if (command == "PING") + { + // In redis-py, result for PING was hard coded: https://github.com/redis/redis-py/blob/bedf3c82a55b4b67eed93f686cb17e82f7ab19cd/redis/client.py#L796 + if (result == "PONG") + { + return string("True"); + } + else + { + return string("False"); + } + } return result; } diff --git a/pyext/swsscommon.i b/pyext/swsscommon.i index 49af0a656..cbbf8a4e2 100644 --- a/pyext/swsscommon.i +++ b/pyext/swsscommon.i @@ -142,6 +142,12 @@ T castSelectableObj(swss::Selectable *temp) %template(CastSelectableToRedisSelectObj) castSelectableObj; %template(CastSelectableToSubscriberTableObj) castSelectableObj; +// Handle object ownership issue with %newobject: +// https://www.swig.org/Doc4.0/SWIGDocumentation.html#Customization_ownership +// %newobject must declared before %include header files +%newobject swss::DBConnector::pubsub; +%newobject swss::DBConnector::newConnector; + %include "schema.h" %include "dbconnector.h" %include "sonicv2connector.h" diff --git a/tests/cli_ut.cpp b/tests/cli_ut.cpp index 283809b61..d354eb787 100755 --- a/tests/cli_ut.cpp +++ b/tests/cli_ut.cpp @@ -249,12 +249,20 @@ TEST(sonic_db_cli, test_cli_help) TEST(sonic_db_cli, test_cli_ping_cmd) { - char *args[2]; + char *args[3]; args[0] = "sonic-db-cli"; args[1] = "PING"; auto output = runCli(2, args); EXPECT_EQ("PONG\n", output); + + // When ping with DB name, result should be 'True' + args[0] = "sonic-db-cli"; + args[1] = "TEST_DB"; + args[2] = "PING"; + + output = runCli(3, args); + EXPECT_EQ("True\n", output); } TEST(sonic_db_cli, test_cli_save_cmd)