Skip to content

Commit 3250e2e

Browse files
committed
feat: hash the password
1 parent 76567a7 commit 3250e2e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

components/whatsapp_waha/main.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Dict, List, Optional, Any, TypedDict
33
import yaml
44
import base64
5+
import bcrypt
56

67
from ilio import write
78

@@ -178,8 +179,11 @@ def create_whatsapp_waha(
178179

179180
# Create basic auth secret if enabled
180181
if basic_auth_enabled and username and password:
182+
# Hash the password using bcrypt (compatible with nginx basic auth)
183+
hashed_password = bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode()
184+
181185
# Create htpasswd-like string: username:hashed_password
182-
auth_string = f"{username}:{password}"
186+
auth_string = f"{username}:{hashed_password}"
183187
auth_base64 = base64.b64encode(auth_string.encode()).decode()
184188

185189
# Create secret manifest

scripts/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
ilio==0.4.0
22
PyYAML==6.0.1
3+
bcrypt==4.3.0

0 commit comments

Comments
 (0)