Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4026932

Browse files
committed
Fix insecure PINs for HomeKit server
1 parent45cbbaf commit4026932

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎pkg/hap/helpers.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,17 @@ type JSONCharacter struct {
7171
Eventany`json:"ev,omitempty"`
7272
}
7373

74+
// 4.2.1.2 Invalid Setup Codes
75+
constinsecurePINs="00000000 11111111 22222222 33333333 44444444 55555555 66666666 77777777 88888888 99999999 12345678 87654321"
76+
7477
funcSanitizePin(pinstring) (string,error) {
7578
s:=strings.ReplaceAll(pin,"-","")
7679
iflen(s)!=8 {
7780
return"",errors.New("hap: wrong PIN format: "+pin)
7881
}
82+
ifstrings.Contains(insecurePINs,s) {
83+
return"",errors.New("hap: insecure PIN: "+pin)
84+
}
7985
// 123-45-678
8086
returns[:3]+"-"+s[3:5]+"-"+s[5:],nil
8187
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp