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

🐛 Prevent caching presence broadcasts rejected by middleware #634

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

alecgibson
Copy link
Collaborator

The Agent stores the most recent presence broadcast sent by a client. However, it eagerly stores this before running the receivePresence middleware, which may actually decide that the presence broadcast is invalid (eg malformed, unauthorized, etc.).

This means that the latest cached presence state may not be "legal".

This change moves the caching inside the trigger() call, so we only store presence values that have "passed" the middleware.

@coveralls
Copy link

coveralls commented Dec 1, 2023

Coverage Status

coverage: 97.501%. remained the same
when pulling cfcf5c0 on receive-presence-middleware
into cf33697 on master.

The `Agent` stores the most recent presence broadcast sent by a client.
However, it eagerly stores this before running the `receivePresence`
middleware, which may actually decide that the presence broadcast is
invalid (eg malformed, unauthorized, etc.).

This means that the latest cached presence state may not be "legal".

This change moves the caching inside the `trigger()` call, so we only
store presence values that have "passed" the middleware.
@alecgibson alecgibson force-pushed the receive-presence-middleware branch from df34bad to cfcf5c0 Compare December 5, 2023 18:12
@alecgibson alecgibson merged commit 54e891b into master Dec 5, 2023
8 checks passed
@alecgibson alecgibson deleted the receive-presence-middleware branch December 5, 2023 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants