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

channels-stats reports published_messages and stored_messages for other instances #292

Open
blazczak opened this issue Dec 28, 2020 · 1 comment

Comments

@blazczak
Copy link

I have multiple server instances defined in /etc/nginx/sites-available and enabled in /etc/nginx/sites-enabled, running on different ports for separation of concerns. Standard configurations, say:

instance A:

server { 
	listen 5601; 

	location /channels-stats {
		# activate channels statistics mode for this location
		push_stream_channels_statistics;

		# query string based channel path
		push_stream_channels_path                    $arg_id;
	}
	
	location /pub {
		# activate publisher (admin) mode for this location
		push_stream_publisher admin;

		# query string based channel path
		push_stream_channels_path                    $arg_id;

(...)

instance B:

server { 
	listen 5602; 

	location /channels-stats {
		# activate channels statistics mode for this location
		push_stream_channels_statistics;

		# query string based channel path
		push_stream_channels_path                    $arg_id;
	}
	
	location /pub {
		# activate publisher (admin) mode for this location
		push_stream_publisher admin;

		# query string based channel path
		push_stream_channels_path                    $arg_id;

(...)

After publishing messages to either server instance, when I send a request for channel stats to instance B curl -s -v --no-buffer 'http://XXX.XXX.XXX.XXX:5602/channels-stats', I receive numbers which are amalgamations of the amount of published_messages and stored_messages for both server instances (instance A + instance B). For example, if I publish 1000 messages to instance A and 500 to instance B, the numbers returned by the query against instance B are 1500, not 500. The names of the channels used to publish are different between server instances.

The numbers for published_messages and stored_messages should only be reported for the instance being queried, not for all instances on the nginx host, as this may leak information.

@wandenberg
Copy link
Owner

@blazczak sorry for the late response.
I see your point but so far this is how the stats of the module works.
They are "of the module" not of the server. It might be a feature for the future. (Happy to receive pull requests on this).
About the security and leaking information, I agree, but the stats feature was not intended to be publicly shared, the same goes for the events channel. I recommend you to move the stats location to an internal server, or protect it somehow.

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

No branches or pull requests

2 participants