Skip to content

Conversation

@mostlygeek
Copy link
Contributor

Update the /clients/ endpoint to require the allow_admin_ui capability grant added in #47.

Updates #78

@mostlygeek mostlygeek self-assigned this Oct 6, 2025
req := httptest.NewRequest("DELETE", "/clients/test-client-1", nil)
rr := httptest.NewRecorder()

s.serveDeleteClient(rr, req, "test-client-1")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to ServeHTTP to use app cap middleware.

Update the /clients/ endpoint to require the allow_admin_ui
capability grant added in #47.

Updates #78

Signed-off-by: Benson Wong <benson@tailscale.com>
@mostlygeek mostlygeek force-pushed the mostlygeek/client-app-cap branch from 59b3a3e to d081ba3 Compare October 6, 2025 17:57
rr := httptest.NewRecorder()

s.serveGetClientsList(rr, req)
s.ServeHTTP(rr, req)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to ServeHTTP to use app cap middleware.

rr := httptest.NewRecorder()

s.serveNewClient(rr, req)
s.ServeHTTP(rr, req)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to ServeHTTP to use app cap middleware.

// Register /clients/ endpoint
// Migrated from legacy/tsidp.go:684
mux.HandleFunc("/clients/", s.serveClients)
mux.HandleFunc("/clients/", s.addGrantAccessContext(s.serveClients))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add middleware handler to inject the App Cap grant into r.Context

@mostlygeek mostlygeek requested a review from remyguercio October 6, 2025 17:59
Copy link
Contributor

@remyguercio remyguercio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and I agree that consolidation of endpoints to prevent misalignments like this is the path forward.

@mostlygeek mostlygeek merged commit 24192a3 into main Oct 6, 2025
2 checks passed
@mostlygeek mostlygeek deleted the mostlygeek/client-app-cap branch October 6, 2025 18:30
@awly
Copy link
Member

awly commented Oct 16, 2025

@mostlygeek could you also add some tests that make sure that all non-public endpoints check the grants?

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

Successfully merging this pull request may close these issues.

3 participants