mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
make orbit and device ping paths unversioned (#7933)
This commit is contained in:
parent
84903deffb
commit
b9927eade4
5 changed files with 10 additions and 9 deletions
|
|
@ -307,7 +307,7 @@ type Service interface {
|
|||
// ListDevicePolicies lists all policies for the given host, including passing / failing summaries
|
||||
ListDevicePolicies(ctx context.Context, host *Host) ([]*HostPolicy, error)
|
||||
|
||||
// DisableAuthForPing is used by the /orbit_ping and /device_ping endpoints
|
||||
// DisableAuthForPing is used by the /orbit/ping and /device/ping endpoints
|
||||
// to bypass authentication, as they are public
|
||||
DisableAuthForPing(ctx context.Context)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/fleetdm/fleet/v4/server/fleet"
|
||||
|
|
@ -131,7 +132,7 @@ func TestClientCapabilities(t *testing.T) {
|
|||
|
||||
var req http.Request
|
||||
bc.setClientCapabilitiesHeader(&req)
|
||||
require.Equal(t, c.expected, req.Header.Get(fleet.CapabilitiesHeader))
|
||||
require.ElementsMatch(t, strings.Split(c.expected, ","), strings.Split(req.Header.Get(fleet.CapabilitiesHeader), ","))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -506,11 +506,11 @@ func attachFleetAPIRoutes(r *mux.Router, svc fleet.Service, config config.FleetC
|
|||
|
||||
ne.WithCustomMiddleware(
|
||||
errorLimiter.Limit("ping_device", desktopQuota),
|
||||
).HEAD("/api/_version_/fleet/device_ping", devicePingEndpoint, devicePingRequest{})
|
||||
).HEAD("/api/fleet/device/ping", devicePingEndpoint, devicePingRequest{})
|
||||
|
||||
ne.WithCustomMiddleware(
|
||||
errorLimiter.Limit("ping_orbit", desktopQuota),
|
||||
).HEAD("/api/_version_/fleet/orbit_ping", orbitPingEndpoint, orbitPingRequest{})
|
||||
).HEAD("/api/fleet/orbit/ping", orbitPingEndpoint, orbitPingRequest{})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5569,13 +5569,13 @@ func (s *integrationTestSuite) TestOSVersions() {
|
|||
}
|
||||
|
||||
func (s *integrationTestSuite) TestPingEndpoints() {
|
||||
s.DoRaw("HEAD", "/api/latest/fleet/orbit_ping", nil, http.StatusOK)
|
||||
s.DoRaw("HEAD", "/api/fleet/orbit/ping", nil, http.StatusOK)
|
||||
// unauthenticated works too
|
||||
s.DoRawNoAuth("HEAD", "/api/latest/fleet/orbit_ping", nil, http.StatusOK)
|
||||
s.DoRawNoAuth("HEAD", "/api/fleet/orbit/ping", nil, http.StatusOK)
|
||||
|
||||
s.DoRaw("HEAD", "/api/latest/fleet/device_ping", nil, http.StatusOK)
|
||||
s.DoRaw("HEAD", "/api/fleet/device/ping", nil, http.StatusOK)
|
||||
// unauthenticated works too
|
||||
s.DoRawNoAuth("HEAD", "/api/latest/fleet/device_ping", nil, http.StatusOK)
|
||||
s.DoRawNoAuth("HEAD", "/api/fleet/device/ping", nil, http.StatusOK)
|
||||
}
|
||||
|
||||
// this test can be deleted once the "v1" version is removed.
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ func (oc *OrbitClient) GetConfig(orbitNodeKey string) (json.RawMessage, error) {
|
|||
}
|
||||
|
||||
func (oc *OrbitClient) Ping() error {
|
||||
verb, path := "HEAD", "/api/latest/fleet/orbit_ping"
|
||||
verb, path := "HEAD", "/api/fleet/orbit/ping"
|
||||
err := oc.request(verb, path, nil, nil)
|
||||
|
||||
if err == nil || errors.Is(err, notFoundErr{}) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue