Skip to content

Conversation

@madhubabutt
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings January 13, 2026 14:09
@madhubabutt madhubabutt requested a review from a team as a code owner January 13, 2026 14:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds account ID validation functionality to the RFC module by porting the getAccountID script logic. The implementation validates that account IDs are exactly 32 characters long and contain only alphanumeric characters, hyphens, and underscores before accepting them.

Changes:

  • Added validate_account_id() function to validate account ID format
  • Added validation check in GetAccountID() to reject invalid account IDs
  • Defined KEY_LEN constant (32) for account ID length validation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
rfcMgr/rfc_common.cpp Implements the validate_account_id function with regex-based validation for account ID format
rfcMgr/rfc_common.h Declares the validate_account_id function and defines KEY_LEN constant
rfcMgr/rfc_xconf_handler.cpp Integrates validation into GetAccountID() to reject invalid account IDs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 826 to 827
RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Invalid characters in newly received accountId: %s\n", __FUNCTION__, __LINE__,tempbuf);
_accountId="Unknown";
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation. The code inside this else-if block uses extra indentation (12 spaces or 3 tabs) compared to the surrounding if-else blocks which use standard indentation (8 spaces or 2 tabs). This should match the indentation of lines 821-822 and 831-833.

Suggested change
RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Invalid characters in newly received accountId: %s\n", __FUNCTION__, __LINE__,tempbuf);
_accountId="Unknown";
RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Invalid characters in newly received accountId: %s\n", __FUNCTION__, __LINE__,tempbuf);
_accountId="Unknown";

Copilot uses AI. Check for mistakes.
else if(!validate_account_id(tempbuf))
{
RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Invalid characters in newly received accountId: %s\n", __FUNCTION__, __LINE__,tempbuf);
_accountId="Unknown";
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after assignment operator. Should be "_accountId = "Unknown";" instead of "_accountId="Unknown";" for consistency with the coding style used elsewhere in the codebase (see line 833).

Copilot uses AI. Check for mistakes.
}
else if(!validate_account_id(tempbuf))
{
RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Invalid characters in newly received accountId: %s\n", __FUNCTION__, __LINE__,tempbuf);
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message states "Invalid characters" but this validation also fails if the length is incorrect (not 32 characters). The error message should be more accurate, such as "Invalid accountId format (expected 32 alphanumeric characters, hyphens, or underscores)" to reflect both validation criteria.

Suggested change
RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Invalid characters in newly received accountId: %s\n", __FUNCTION__, __LINE__,tempbuf);
RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Invalid accountId format (expected 32 alphanumeric characters, hyphens, or underscores): %s\n", __FUNCTION__, __LINE__, tempbuf);

Copilot uses AI. Check for mistakes.
Comment on lines 286 to 294
bool validate_account_id(const std::string& accountId)
{
static const std::regex has_valid("[a-zA-Z0-9_-]");
static const std::regex has_invalid("[!@#$%^&*()_+]");

// Must be exactly KEY_LEN
if (accountId.length() != KEY_LEN)
return false;

return std::regex_search(accountId, has_valid) &&
!std::regex_search(accountId, has_invalid);
}
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new validation function validate_account_id lacks test coverage. Given that this function performs security-critical validation of account IDs and the repository has a gtest infrastructure in place (test/rfcTest.cpp), tests should be added to verify the function correctly validates valid account IDs and rejects invalid ones (wrong length, special characters, etc.).

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add L1

Comment on lines 286 to 294
bool validate_account_id(const std::string& accountId)
{
static const std::regex has_valid("[a-zA-Z0-9_-]");
static const std::regex has_invalid("[!@#$%^&*()_+]");

// Must be exactly KEY_LEN
if (accountId.length() != KEY_LEN)
return false;

return std::regex_search(accountId, has_valid) &&
!std::regex_search(accountId, has_invalid);
}
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing include directive for regex. The validate_account_id function uses std::regex and std::regex_search but the required header is not included in this file. This will cause compilation errors.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed to ensure build failure

@nhanasi
Copy link
Contributor

nhanasi commented Jan 13, 2026

@madhubabutt - please address commentds

Copilot AI review requested due to automatic review settings January 14, 2026 15:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rdkcmf-jenkins
Copy link
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/rfc/148/rdk/components/generic/rfc

  • Commit: d66c9c7

Report detail: gist'

Copilot AI review requested due to automatic review settings January 16, 2026 13:37
@rdkcmf-jenkins
Copy link
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/rfc/148/rdk/components/generic/rfc

  • Commit: dad264c

Report detail: gist'

@rdkcmf-jenkins
Copy link
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/rfc/148/rdk/components/generic/rfc

  • Commit: d69359c

Report detail: gist'

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rdkcmf-jenkins
Copy link
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/rfc/148/rdk/components/generic/rfc

  • Commit: d69359c

Report detail: gist'

for (char c : str)
{
if(!std::isalnum(c))
if(!std::isalnum(c) && c != '_' && c != '-')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need length check and special char check also
similar to https://github.com/rdkcentral/sysint/blob/develop/lib/rdk/getAccountId.sh

Copilot AI review requested due to automatic review settings January 20, 2026 15:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 20, 2026 15:10
Copilot AI review requested due to automatic review settings January 20, 2026 15:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 20, 2026 15:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 22, 2026 12:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 22, 2026 12:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

run_l2.sh:57

  • The test_rfc_factory_reset.py test has been moved to run before test_rfc_trigger_reboot.py. If test execution order is significant (e.g., if tests share state or depend on specific sequences), ensure this reordering doesn't break the test suite.
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rfc_factory_reset.json test/functional-tests/tests/test_rfc_factory_reset.py

pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rfc_trigger_reboot_unknown_accountid.json test/functional-tests/tests/test_rfc_trigger_reboot.py

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 22, 2026 14:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

run_l2.sh:55

  • This line references test_rfc_factory_reset.py which doesn't exist in the repository. This will cause the test execution to fail. Either the test file needs to be added or this line should be removed.
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rfc_factory_reset.json test/functional-tests/tests/test_rfc_factory_reset.py

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Successfully merging this pull request may close these issues.

4 participants