Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appdaemon dashboard authentication cookie set not conform to RFC 6265 #2205

Open
mickaelmarin opened this issue Feb 14, 2025 · 1 comment
Open
Labels
bug Something isn't working

Comments

@mickaelmarin
Copy link

mickaelmarin commented Feb 14, 2025

What happened?

I found a problem with the cookie that is settled in the http.py file in logon_response function, the cookie adcreds is randomly conform to the RFC6265. If the cookie conform the double quote are not present that surounded the token and the auth in websocket not work.

thanks

Version

0.16.7

Installation type

Home Assistant add-on

Relevant log output

Relevant code in the app or config file that caused the issue

hashed = bcrypt.hashpw(str.encode(self.password), bcrypt.gensalt(self.work_factor))

Anything else?

No response

@mickaelmarin mickaelmarin added the bug Something isn't working label Feb 14, 2025
@mickaelmarin
Copy link
Author

mickaelmarin commented Feb 15, 2025

For my need I replace hashed = bcrypt.hashpw(str.encode(self.password), bcrypt.gensalt(self.work_factor)) in logon_response

By hashed = await self.valid_rfc6265_token()

AND I added this function above logon_response function:

async def valid_rfc6265_token(self):
   RFC6265_TOKEN_PATTERN = r"^[a-zA-Z0-9!#$%&'*+\-.^_`|~]+$" 

   while True:
     hashed = bcrypt.hashpw(str.encode(self.password), \
                       bcrypt.gensalt(self.work_factor)).decode("utf-8")
     if not re.fullmatch(RFC6265_TOKEN_PATTERN, hashed):
       break

     return hashed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant