knadh / niltalk

Instant, disposable, single-binary web based live chat server. Go + VueJS.
GNU Affero General Public License v3.0
947 stars 118 forks source link

dubious check in redis store #19

Closed clementauger closed 3 years ago

clementauger commented 3 years ago

hey,

in the redis store GetSession method, the statement that verifies that the retrieved handle form redis is not empty is dubious.

In the case the user has not provided an username, which he might do, then the session he opened can never be retrieved.

See this line https://github.com/knadh/niltalk/blob/master/store/redis/redis.go#L164

I have not run manual testing to check for it, though i had to remove the corresponding statement in the memory store i have written.

So i guess this applies to the redis store too.

knadh commented 3 years ago

Ah yes. There should not be a session without a handle in the first place. A handle should be auto-generated if one's not specificied here: https://github.com/knadh/niltalk/blob/master/handlers.go#L115