上线时的一些安全问题
2022-07-07 本文已影响0人
aq_wzj
1. nginx的版本不要泄露
server_tokens off;
2. nginx返回头添加禁止iframe
的东西
add_header X-Frame-Options SAMEORIGIN;
3. 接口限制一下跨域的问题
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = False
CORS_ORIGIN_WHITELIST = (
"http://test1.example.com",
"https://test1.example.com",
"http://test2.example.com",
"https://test2.example.com",
)
4. Cookie设置secure
response.set_cookie("sessionid", session_id, domain=".example.com", secure=True)
5. 发送验证码的一分钟重复发送时候,手机号前面有$1$
等字符就是两个手机号,就会出现短信轰炸。需要对手机号做个正则校验
re.compile("^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$").search(phone)
