Skip to content

Limit the lenght of User Name#2764

Open
HunsupJung wants to merge 1 commit intomainfrom
fix/limit-length-user-name
Open

Limit the lenght of User Name#2764
HunsupJung wants to merge 1 commit intomainfrom
fix/limit-length-user-name

Conversation

@HunsupJung
Copy link
Collaborator

@HunsupJung HunsupJung commented Feb 6, 2026

Type of Change

  • WWST Certification Request
    • If this is your first time contributing code:
      • I have reviewed the README.md file
      • I have reviewed the CODE_OF_CONDUCT.md file
      • I have signed the CLA
    • I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com
  • Bug fix
  • New feature
  • Refactor

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have verified my changes by testing with a device or have communicated a plan for testing
  • I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior

Description of Change

Summary of Completed Tests

Signed-off-by: Hunsup Jung <hunsup.jung@samsung.com>
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Test Results

   71 files    485 suites   0s ⏱️
2 518 tests 2 514 ✅ 0 💤 4 ❌
4 332 runs  4 328 ✅ 0 💤 4 ❌

For more details on these failures, see this check.

Results for commit 120f200.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

File Coverage
All files 71%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-lock/src/new-matter-lock/init.lua 64%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-lock/src/lock_utils.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-lock/src/init.lua 92%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 120f200

Comment on lines +1277 to +1280
local userNameMatter = userName
if #userNameMatter > NAME_MAX_L then
userNameMatter = string.sub(userNameMatter, 1, NAME_MAX_L)
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
local userNameMatter = userName
if #userNameMatter > NAME_MAX_L then
userNameMatter = string.sub(userNameMatter, 1, NAME_MAX_L)
end
local userName = string.sub(command.args.userName, 1, NAME_MAX_L)

the sub will only limit the userName input if it is too long, so no need for the extra check, or the extra variable


local INITIAL_CREDENTIAL_INDEX = 1
local ALL_INDEX = 0xFFFE
local NAME_MAX_L = 10
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
local NAME_MAX_L = 10
-- maximum as defined by the Matter specification
local MAX_USER_NAME_LENGTH = 10

if userIdx == 0 then
userIdx = nil
else
userTypeMatter = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

curious, why should this be nil if userIdx > 0?

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.

2 participants