Repository navigation
security: pass 2 batch 1 - dashboard XSS, readonly writes, rate limiting, fetch queue exposure, OSM tile policy - #10
Merged
Conversation
…-limit the API, gate the fetch queue
H1: escape collection names in the beacon node cards and the coverage labels
that reach the dashboard through another nodes registration and coverage data.
M1: escape the STAC-derived strings and error text the admin console renders,
at the call sites, keeping the deliberate bold log lines intact.
M2: a readonly session no longer satisfies AccessLevel::Write, and
/api/admin/activity requires the admin role with a capped limit.
M3: attach the rate limiter to the router; stop trusting X-Forwarded-For and
accept X-Real-IP only from the local ingress; exempt static assets, /api/health
and key-authenticated /api/chunks requests.
M4/L6: /api/fetch/queue and /{id} require write access; remote queue calls
encode the status filter and no longer read a refusal as an empty list.
… maps Use the exact bare-host tile URL instead of the forbidden s subdomain rotation, set referrerPolicy so the Referer is sent (the vhost inherits a same-origin policy from ssl.conf, and Leaflet sets the attribute on each tile image), and show the required OpenStreetMap attribution - the coverage map had attributionControl disabled, so the credit goes into its legend.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
Pass 2, batch 1 of the security review (
earthgrid-security-report.md): the small, independently shippable findings. One commit per topic.ecde913- security batch 1sensorLabel()escapes its result so the coverage keys that reach the tooltip, the detail panel and both coverage tables through another node's coverage data cannot inject markup either.item.id,item.tile,item.datetime, the tile list, the date range) and every remote error/message at the call site, so the deliberately bold log lines still render.readonlysession no longer satisfiesAccessLevel::Write, and/api/admin/activityrequires the admin role with its limit capped at 500.X-Forwarded-Foris no longer read at all - the first value is client-settable and made the limiter bypassable with one header - andX-Real-IPis honoured only when the peer is the local ingress (loopback or the bridge address)./health,/api/health,/,/assets/*are exempt, as are/api/chunks/*requests presenting the grid key, so inter-node transfers are not throttled.GET /api/fetch/queueand/{id}require write access (the console's session cookie and the grid key both still work; anonymous callers now get 401). The remote queue client encodes its status filter and reports a refused or malformed response instead of treating it as an empty list.89da263- OpenStreetMap tile usage policyBoth embedded maps requested
https://{s}.tile.openstreetmap.org/..., which is the rotation the policy forbids, and sent noRefererbecause the vhost inheritsReferrer-Policy: same-originfromssl.conf. Since the vhost header is shared by every service it is not touched here: the layer now uses the exact policy URL, setsreferrerPolicy: 'strict-origin-when-cross-origin'(Leaflet sets the attribute on each tile image, which overrides the document policy) and shows the required attribution - the coverage map hadattributionControl: false, so the credit goes into its legend. The CARTO dark/light layers are untouched and still serve their keyless watermark; replacing them is a separate decision.Verification
cargo build --releaseclean, zero warnings;cargo test187 passed, 0 failed, 1 ignored, plus 2 ignored doc-tests.node --checkon every<script>block ofui.htmlandbeacon.html.GET /api/fetch/queue401, the same request with the grid key 200 listing 99 jobs,/dashboard200, node still present in/api/beacon/nodes, one queued fetch completed1/1with no error, and a real OpenStreetMap tile now returns ~53 KB of imagery instead of the 6.9 KB block notice.Known residuals (not addressed here)
/api/chunks/*exemption does not cover them. LAN peers stay exempt via the LAN rule; public peers would be throttled. This belongs with the replication work (report H4 / Cluster 1).showAlert()sinks and the coverage plugin paths are unchanged.