Monitoring Dashboard¶
create_dashboard_app(broker: Any, *, auth_token: str | None = None) -> Any
¶
Create an ASGI dashboard application.
SECURITY (M8): by default this app has NO authentication and exposes
broker topology (queue/exchange/routing-key names, consumer counts).
Bind the server to loopback (127.0.0.1, not 0.0.0.0) by default,
and mount it behind authn (OIDC/reverse proxy) plus network restriction
for anything beyond local access — never expose it publicly.
For a lightweight built-in guard, pass auth_token: when set, every
route requires an Authorization: Bearer <auth_token> header
(compared in constant time via hmac.compare_digest, not a plain
string !=, which would leak timing information about the token) and
returns 401 otherwise. When unset (default), all requests pass
through and a startup warning is logged reminding you not to expose the
dashboard publicly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
broker
|
Any
|
A rabbitkit broker instance (SyncBroker or AsyncBroker). |
required |
auth_token
|
str | None
|
Optional bearer token. When set, all routes require
|
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A Starlette application. |
Raises:
| Type | Description |
|---|---|
ImportError
|
If starlette is not installed. |
Source code in src/rabbitkit/dashboard/app.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |