Skip to content

Commit

Permalink
docs:更新安全编码
Browse files Browse the repository at this point in the history
  • Loading branch information
dablelv committed Jul 28, 2024
1 parent e3a0778 commit 03677de
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 第五篇:安全编码/安全编码.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ func main() {
fmt.Println(array)
}
```

# 2.文件操作
## 路径穿越检查
在进行文件操作时,如果对外部传入的文件名未做限制,可能导致任意文件读取或者任意文件写入,严重可能导致意外代码被执行。
Expand Down Expand Up @@ -316,6 +317,7 @@ func main() {
fmt.Println(string(output))
}
```
# 4.敏感数据保护
## 敏感信息访问
禁止将敏感信息硬编码在程序中,既可能会将敏感信息暴露给攻击者,也会增加代码管理和维护的难度。
Expand Down Expand Up @@ -376,6 +378,7 @@ dlv --listen=:2345 --headless=true --apiversion=2 debug test.go
// good
dlv debug test.go
```
# 5.加密解密
## 不得硬编码密码/密钥
在进行用户登录、加解密等操作时,不得在代码里硬编码密钥或密码,可通过变换算法或者配置等方式设置密码或者密钥。
Expand Down Expand Up @@ -415,6 +418,7 @@ crypto/des, crypto/md5, crypto/sha1, crypto/rc4 等
// good
crypto/rsa, crypto/aes 等
```

# 6.并发保护
## 禁止在闭包中直接调用循环变量
在循环中启动协程,当协程中使用到了循环的索引值,由于多个协程同时使用同一个变量会产生数据竞争,造
Expand Down

0 comments on commit 03677de

Please sign in to comment.