Rebase and merge #157
Conversation
Disable the AccountID Special validation for RDKB
RDK-60308-[tr69hostif, RFC] RDK Coverity Defect Resolution for Device Management
There was a problem hiding this comment.
Pull request overview
Adjusts RFC/XConf processing to apply certain validation and AccountID-handling logic only when RDKB_SUPPORT is not defined.
Changes:
- Wraps “reject empty config values” logic behind
#if !defined(RDKB_SUPPORT)inprocessXconfResponseConfigDataPart(). - Wraps the AccountID
"Unknown"special-case handling behind#if !defined(RDKB_SUPPORT)inisConfigValueChange().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #if !defined(RDKB_SUPPORT) | ||
| if (newValue.empty()) | ||
| { | ||
| RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] EMPTY value for %s is rejected\n", __FUNCTION__, __LINE__, newKey.c_str()); | ||
| continue; | ||
| } | ||
| #endif |
There was a problem hiding this comment.
The empty-value rejection is now compiled out for RDKB_SUPPORT, but RDKB’s set_RFCProperty() converts non-string types using std::stoi/stoul/stof/etc without any exception handling. If XConf sends an empty string for a numeric/bool parameter, this will throw and can terminate the process. Consider keeping the empty-value guard for RDKB too (at least for non-string params) or adding safe parsing/try-catch with a logged failure + skip update.
| #if !defined(RDKB_SUPPORT) | |
| if (newValue.empty()) | |
| { | |
| RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] EMPTY value for %s is rejected\n", __FUNCTION__, __LINE__, newKey.c_str()); | |
| continue; | |
| } | |
| #endif | |
| if (newValue.empty()) | |
| { | |
| RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] EMPTY value for %s is rejected\n", __FUNCTION__, __LINE__, newKey.c_str()); | |
| continue; | |
| } |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
RDK-60308 [RFC] RDK Coverity Defect Resolution for Device
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: nhanasi <107076221+nhanasi@users.noreply.github.com>
Co-authored-by: nhanasi <107076221+nhanasi@users.noreply.github.com>
Co-authored-by: jbasi196 <JithendraSaiKumar_Basi@comcast.com>
* Update BDD skill * Update rfc_main.cpp * Update rfc_main.cpp --------- Co-authored-by: Hanasi <nhanas001c@cable.comcast.com>
Co-authored-by: jbasi196 <JithendraSaiKumar_Basi@comcast.com>
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
* Update L2_Analysis_Report.md * Update L2_Analysis_Report.md * Create L1_Analysis_Report * Rename L1_Analysis_Report to L1_Analysis_Report.md * Update L1_Analysis_Report.md
RFC release for 1.2.6 tag
Co-authored-by: Hanasi <nhanas001c@cable.comcast.com>
Integrate Openspec skills for RFC (#209)
Integrate openspec skills to rfc
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 77 out of 77 changed files in this pull request and generated 9 comments.
Comments suppressed due to low confidence (1)
rfcMgr/xconf_handler.cpp:118
lenis reused across identity lookups. In theRDKCmodel-number branch,lenis only updated whengetModelNumber()returns a non-empty string; if it returns empty,lenretains its previous value and the code entersif (len)and overwrites_model_numberwith an emptytmpbuf. Resetlenbefore the model-number retrieval so stale values can’t leak across steps.
| @@ -231,30 +170,14 @@ static size_t writeCurlResponse(void *ptr, size_t size, size_t nmemb, string str | |||
| return realsize; | |||
| } | |||
| /** @brief Expose writeCurlResponse for unit testing. */ | ||
| #ifdef GTEST_ENABLE | ||
| size_t (*getWriteCurlResponse(void))(void *ptr, size_t size, size_t nmemb, std::string stream) { | ||
| return &writeCurlResponse; | ||
| } | ||
| #endif |
| #ifdef RDKC | ||
| _partner_id = getPartnerIdFromFile(); | ||
| #else |
| if not content.strip(): | ||
| dev_props.write("LABSIGNED_ENABLED=true\n") | ||
| return |
| finally: | ||
| if device_properties_existed: | ||
| if os.path.exists(DEVICE_PROPERTIES): | ||
| with open(DEVICE_PROPERTIES, "w") as f: | ||
| f.write(original_content) |
| ## Platform Variants | ||
|
|
||
| ### RDK-V / RDK-C | ||
| - Uses `WDMP_STATUS` return type via `wdmp-c` library | ||
| - Full set: `getRFCParameter`, `setRFCParameter`, `isRFCEnabled`, `isFileInDirectory` | ||
| - `setRFCParameter` sends HTTP POST to `http://127.0.0.1:11999` | ||
|
|
||
| ### RDK-B (`RDKB_SUPPORT`) | ||
| - Simplified `int` return type | ||
| - `setRFCParameter` not exposed from this library (rfcMgr applies directly) | ||
| - `MAX_PARAM_LEN` applies identically |
| B->>sem: sem_post | ||
| ``` | ||
|
|
||
| The semaphore name is `"localstore"` (`/sem.localstore` on Linux). It is opened with `O_CREAT` and initial count 1 each call, so no persistent initialization is required. |
| /** | ||
| * @file mtlsUtils.h | ||
| * @brief mTLS certificate retrieval and state-red recovery utilities. | ||
| * | ||
| * If not stated otherwise in this file or this component's LICENSE file the |
| MIT License | ||
|
|
||
| Copyright (c) YEAR COPYRIGHT HOLDER | ||
|
|
L1 Coverage Report from Develop
…214) * Update gtest_main.cpp * Update gtest_rfcapi.cpp * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| #elif defined(RDKC) | ||
| { | ||
| std::string mac = getEstbMacAddress(); | ||
| if (!mac.empty()) { | ||
| strncpy(tmpbuf, mac.c_str(), sizeof(tmpbuf) - 1); |
| memset(tmpbuf, '\0', sizeof(tmpbuf)); | ||
| #ifdef RDKC | ||
| { | ||
| std::string model = getModelNumber(); | ||
| if (!model.empty()) { | ||
| strncpy(tmpbuf, model.c_str(), sizeof(tmpbuf) - 1); | ||
| tmpbuf[sizeof(tmpbuf) - 1] = '\0'; | ||
| len = strlen(tmpbuf); | ||
| } | ||
| } | ||
| #else | ||
| len = GetModelNum( tmpbuf, sizeof(tmpbuf) ); | ||
| #endif |
| #ifdef RDKC | ||
| _partner_id = getPartnerIdFromFile(); | ||
| #else |
| @@ -231,30 +170,14 @@ static size_t writeCurlResponse(void *ptr, size_t size, size_t nmemb, string str | |||
| return realsize; | |||
| size_t (*getWriteCurlResponse(void))(void *ptr, size_t size, size_t nmemb, std::string stream) { | ||
| return &writeCurlResponse; | ||
| } |
| finally: | ||
| if device_properties_existed: | ||
| if os.path.exists(DEVICE_PROPERTIES): | ||
| with open(DEVICE_PROPERTIES, "w") as f: | ||
| f.write(original_content) |
| assert grep_log_file(LOG_FILE, FEATURE_NAME_VALUE), f"Expected '{FEATURE_NAME_VALUE}' in log file." | ||
| assert grep_log_file(LOG_FILE, RFC_PARAM), f"Expected '{RFC_PARAM}' in log file." | ||
| assert grep_log_file(LOG_FILE, XCONF_RESP_RECEIVED_ACTID_UNKNOWN), f"Expected '{XCONF_RESP_RECEIVED_ACTID_UNKNOWN}' in log file." | ||
| assert grep_log_file(LOG_FILE, XCONF_RESP_CMP_MSG), f"Expected '{XCONF_RESP_CMP_MSG}' in log file." | ||
| assert grep_log_file(LOG_FILE, ACTID_REPLACE_AUTHSERVICE), f"Expected '{ACTID_REPLACE_AUTHSERVICE}' in log file." | ||
| assert grep_log_file(LOG_FILE, ACTID_UPDATE), f"Expected '{ACTID_UPDATE}' in log file." |
| | `WDMP_ERR_DEFAULT_VALUE` | Value returned from defaults file | | ||
| | `WDMP_FAILURE` | Key not found in any store | | ||
|
|
||
| **Returns (RDKB):** `SUCCESS` (0) or `FAILURE` (-1) |
|
|
||
| MIT License | ||
|
|
||
| Copyright (c) YEAR COPYRIGHT HOLDER |
| ### RDK-V / RDK-C | ||
| - Uses `WDMP_STATUS` return type via `wdmp-c` library | ||
| - Full set: `getRFCParameter`, `setRFCParameter`, `isRFCEnabled`, `isFileInDirectory` | ||
| - `setRFCParameter` sends HTTP POST to `http://127.0.0.1:11999` | ||
|
|
||
| ### RDK-B (`RDKB_SUPPORT`) | ||
| - Simplified `int` return type | ||
| - `setRFCParameter` not exposed from this library (rfcMgr applies directly) |
RFC 1.2.7 release update
* Update L2-tests.yml * Update L2-tests.yml * Update L2-tests.yml * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Update L2-tests.yml * Update L2-tests.yml * Update L2-tests.yml * Update L2-tests.yml --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 80 out of 80 changed files in this pull request and generated 9 comments.
Comments suppressed due to low confidence (1)
rfcapi/rfcapi.cpp:169
- writeCurlResponse() takes the response buffer by value (string stream), so CURLOPT_WRITEDATA (a pointer to std::string) is never updated. This leaves
responseempty and can break JSON parsing in getRFCParameter()/setRFCParameter().
| /** @brief Expose writeCurlResponse for unit testing. */ | ||
| #ifdef GTEST_ENABLE | ||
| size_t (*getWriteCurlResponse(void))(void *ptr, size_t size, size_t nmemb, std::string stream) { | ||
| return &writeCurlResponse; | ||
| } | ||
| #endif |
| finally: | ||
| if device_properties_existed: | ||
| if os.path.exists(DEVICE_PROPERTIES): | ||
| with open(DEVICE_PROPERTIES, "w") as f: | ||
| f.write(original_content) |
| . /etc/include.properties | ||
|
|
||
| if [ "$BUILD_TYPE" != "prod" ] && [ -f /opt/rfc.properties ]; then | ||
| . /opt/rfc.properties | ||
| else | ||
| . /etc/rfc.properties | ||
| fi | ||
| . /etc/rfc.properties |
| /** | ||
| * @brief Retrieve an RFC parameter value (RDKB / RDKC — int return path). | ||
| * @param[in] pcParameterName TR181 parameter name. | ||
| * @param[out] pstParamData Filled with the retrieved name/value/type. | ||
| * @return SUCCESS (0) or FAILURE (1). | ||
| */ |
| | `WDMP_ERR_DEFAULT_VALUE` | Value returned from defaults file | | ||
| | `WDMP_FAILURE` | Key not found in any store | | ||
|
|
||
| **Returns (RDKB):** `SUCCESS` (0) or `FAILURE` (-1) |
| ### RDK-V / RDK-C | ||
| - Uses `WDMP_STATUS` return type via `wdmp-c` library | ||
| - Full set: `getRFCParameter`, `setRFCParameter`, `isRFCEnabled`, `isFileInDirectory` | ||
| - `setRFCParameter` sends HTTP POST to `http://127.0.0.1:11999` | ||
|
|
||
| ### RDK-B (`RDKB_SUPPORT`) | ||
| - Simplified `int` return type | ||
| - `setRFCParameter` not exposed from this library (rfcMgr applies directly) | ||
| - `MAX_PARAM_LEN` applies identically |
| /** | ||
| * @file mtlsUtils.h | ||
| * @brief mTLS certificate retrieval and state-red recovery utilities. | ||
| * |
| MIT License | ||
|
|
||
| Copyright (c) YEAR COPYRIGHT HOLDER | ||
|
|
| TEST(rfcapiTest, writeCurlResponse) { | ||
| const char* input = "MockCurlData"; | ||
| size_t size = 1; | ||
| size_t nmemb = strlen(input); | ||
| std::string response; | ||
| size_t written = getWriteCurlResponse()((void*)input, size, nmemb, response); | ||
| EXPECT_EQ(written, nmemb); | ||
| } |
No description provided.