Repository navigation
release: v0.0.5 - #12
Merged
Merged
Conversation
The settings endpoints were only behind `fleetbase.protected`, so any logged-in user could read the system Valhalla API key (including the VALHALLA_API_KEY env fallback) or change the system host that every organization falls back to. - admin-settings (GET/POST) now require a system administrator. - settings (organization override) require `fleet-ops view routing-settings` or `fleet-ops update routing-settings` to read and `fleet-ops update routing-settings` to save, matching the Fleet-Ops routing settings page these forms live on. - Responses replace `api_key` with `has_api_key` (and `has_environment_api_key` on the admin endpoint). On save, a blank or missing key keeps the stored key and `clear_api_key` removes it; the env key is no longer copied into the database. - The admin and organization settings forms use a password field, show whether a key is saved, and offer "Remove the saved API key". - Adds PHPUnit coverage for both endpoints and re-enables the test step in PHP CI (laravel/framework as a dev dependency; phpunit instead of pest 1, which cannot find a non-default vendor dir).
The server calls the organization's Valhalla host itself, so anyone who can edit routing settings could make it request loopback, private network or cloud metadata addresses (SSRF). - HostPolicy accepts only http(s) URLs without credentials whose host is, and resolves only to, public addresses (explicit IPv4/IPv6 blocklist: loopback, RFC 1918, CGNAT, link-local/metadata, multicast, reserved, IPv4-mapped, NAT64, unique local, ...). - POST settings returns 422 for a host that fails the policy. - At request time an organization override whose host fails the policy is ignored as a whole (host and key), so values saved before this change fall back to the system server. - VALHALLA_ALLOW_PRIVATE_HOSTS=true lets self-hosted installs use private hosts. System (admin) settings are not checked.
…dmin Valhalla panel When the system Valhalla host is routing.fleetbase.io (or a subdomain), the admin panel (rendered in Admin -> Fleet-Ops -> Routing) shows the key's plan and today's usage from the gateway's GET /usage. It links to Fleetbase Cloud to get a free key, upgrade, or manage the subscription. It says when the key is missing, refused, over today's quota, on the free fallback after a paid plan ended, or the service can't be reached. - GET valhalla/int/v1/admin-hosted-status (system administrators only): HostedRouting::status() with the saved host and key, then the environment. It never returns the key or the account. - config valhalla.hosted (VALHALLA_HOSTED_DOMAIN, VALHALLA_HOSTED_CONSOLE_URL, VALHALLA_HOSTED_TIMEOUT). - Tests: HostedRoutingStatusTest, 20 cases (41 total with SettingsAuthorizationTest). Builds on #9 (settings authorization). Co-Authored-By: Claude <noreply@anthropic.com>
…time - HostedRouting::status() reads the install registration core-api records in system.hosted-routing. When the saved key is the one it issued (same last four characters) and the gateway does not report it as claimed (owner != company), the status adds install_key, the admin email, email_verified (plan != routing_unverified) and claim_url, which also becomes upgrade_url. - Usage passes the gateway's owner through. - Panel: Upgrade opens the claim link, Manage subscription is hidden until the key is claimed, a note explains the key stays the same, and an unconfirmed email is pointed out (500 vs 2,500 routes a day). - 5 new PHPUnit cases (46 total). Co-Authored-By: Claude <noreply@anthropic.com>
…mmunity servers - Valhalla::DEFAULT_BASE_URI = https://valhalla.routing.fleetbase.io replaces https://valhalla1.openstreetmap.de as the default in config, the client, Utils and the admin settings controller. - A host set to the OpenStreetMap community servers (valhalla1/2.openstreetmap.de), in the organization or system settings or the environment, counts as unset and resolves to the default. This is the same rule as Fleet-Ops' ValhallaClient (fleetops#406). Their usage policy does not allow production traffic. - The admin form shows the server actually in use and saves the default when no host is sent. - The browser's Leaflet routing control (L.Routing.Valhalla) now posts to this extension's server proxy (valhalla/int/v1/route) by default, so it uses the configured server and key: no key in the browser, no CORS. A caller that passes its own serviceUrl keeps the old direct GET. - Tests: DefaultHostTest (11 cases); 56 in total. The hosted server needs a key. An install without one gets 401 from the proxy, and Fleet-Ops falls back to straight-line estimates. The admin panel says 'Get a free key', and fleetbase/core-api#325 mints one at install. Co-Authored-By: Claude <noreply@anthropic.com>
…ed when resolving the server Restacked on #10. resolveBaseUri() reads the organization host directly to skip the OSM community servers, so it now applies #10's organizationOverrideAllowed() too: an organization override whose host fails HostPolicy falls back to the system server, as resolveSetting() does. Co-Authored-By: Claude <noreply@anthropic.com>
- Version 0.0.5 in composer.json, package.json and extension.json; RELEASE.md. - Release CI like Fleet-Ops: Ember and PHP CI run on PRs into release/v* and dev-v*, the Ember CI lints, and actions/checkout@v4 in the PHP CI. - pnpm-workspace.yaml with Fleet-Ops' allowBuilds list: pnpm 11 stopped every Ember CI install on main with ERR_PNPM_IGNORED_BUILDS. Co-Authored-By: Claude <noreply@anthropic.com>
fix: restrict Valhalla settings endpoints and never return the API key
fix: reject organization Valhalla hosts that point at private addresses
feat(valhalla): Fleetbase Hosted Routing as the default server, with plan and usage in the admin panel
…min panel Renamed from 'Fleetbase Hosted Routing'. The bordered block with buttons becomes one small grey line: the name, the plan, today's usage (e.g. 'Community (free) · 120 / 2,500 routes today'), and Upgrade/Manage links (or 'Get a free key'). A second small line shows only what needs action: a missing, refused or over-quota key, the free fallback after a paid plan ended, or an unconfirmed install email. The install-key explanation moved to the Upgrade link's tooltip. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Release v0.0.5. Merging this PR into
maintagsv0.0.5throughrelease.yml. The tag then triggerscreate-release.yml(GitHub Release from RELEASE.md) and the publish jobs inember.yml: npm, the GitHub registry, the Fleetbase registry and QA.Included
Merge these into this branch first, in order (each is stacked on the one before):
After #9 merges, retarget #10 to this branch, then #11 after #10. I checked that all three merge cleanly on top of this branch: 89 PHP tests pass on the combined result.
On this branch
composer.json,package.jsonandextension.json, plusRELEASE.md. The tag step refuses to tag unless all four agree.ember.ymlandserver.ymlrun on PRs intorelease/v*anddev-v*, not onlymain;actions/checkout@v4.pnpm-workspace.yamlwith Fleet-Ops'allowBuildslist. pnpm 11 stopped every Ember CI install onmainwithERR_PNPM_IGNORED_BUILDS, so a tag would not have published. Locally with pnpm 11.0.9,pnpm install --frozen-lockfile,pnpm run lintandpnpm run buildall pass.Co-Authored-By: Claude noreply@anthropic.com