summaryrefslogtreecommitdiffhomepage
path: root/tsweb/debug.go
AgeCommit message (Collapse)AuthorFilesLines
2024-02-13Revert "tsweb: update ServeMux matching to 1.22.0 syntax (#11090)" (#11125)Patrick O'Doherty1-8/+8
This reverts commit 30c9189ed307df6f2c1567aa7945bde77bb54c52. Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2024-02-13tsweb: update ServeMux matching to 1.22.0 syntax (#11090)Patrick O'Doherty1-8/+8
* tsweb: update ServeMux matching to 1.22.0 syntax Updates #cleanup Go 1.22.0 introduced the ability to use more expressive routing patterns that include HTTP method when constructing ServeMux entries. Applications that attempted to use these patterns in combination with the old `tsweb.Debugger` would experience a panic as Go would not permit the use of matching rules with mixed level of specificity. We now specify the method for each `/debug` handler to prevent incompatibilities. Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2024-02-09Revert "tsweb: update ServeMux matching to 1.22.0 syntax (#11087)" (#11089)Patrick O'Doherty1-1/+1
This reverts commit 291f91d164f1ec60ca77c0cb935a7895ac4cc555. Updates #cleanup This PR needs additional changes to the registration of child handlers under /debug Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2024-02-09tsweb: update ServeMux matching to 1.22.0 syntax (#11087)Patrick O'Doherty1-1/+1
Updates #cleanup Go 1.22.0 introduced the ability to use more expressive routing patterns that include HTTP method when constructing ServeMux entries. Applications that attempted to use these patterns in combination with the old `tsweb.Debugger` would experience a panic as Go would not permit the use of matching rules with mixed level of specificity. Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2024-01-03tsweb: use object-src instead of plugin-types (#10719)Chris Palmer1-1/+1
plugin-types is deprecated, and setting object-src: 'none' is best practice. This should result in no functional change. Fixes #10718 Signed-off-by: Chris Palmer <cpalmer@tailscale.com>
2023-08-23tsweb: clean up pprof handler registration, document why it's thereDavid Anderson1-8/+24
Updates #cleanup Signed-off-by: David Anderson <danderson@tailscale.com>
2023-07-19tsweb: relax CSP for debug handlers (#8649)Andrew Lytvynov1-1/+15
Allow inline CSS for debug handlers to make prototyping easier. These are generally not accessible to the public and the small risk of CSS injection via user content seems acceptable. Also allow form submissions on the same domain, instead of banning all forms. An example of such form is http://webhooks.corp.ts.net:6359/debug/private-nodes/ Updates #3576 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2023-07-11cmd/derper,tsweb: consistently add HTTP security headers (#8579)Andrew Lytvynov1-2/+3
Add a few helper functions in tsweb to add common security headers to handlers. Use those functions for all non-tailscaled-facing endpoints in derper. Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2023-04-11tsweb: move varz handler(s) into separate modulesAnton Tolchanov1-2/+4
This splits Prometheus metric handlers exposed by tsweb into two modules: - `varz.Handler` exposes Prometheus metrics generated by our expvar converter; - `promvarz.Handler` combines our expvar-converted metrics and native Prometheus metrics. By default, tsweb will use the promvarz handler, however users can keep using only the expvar converter. Specifically, `tailscaled` now uses `varz.Handler` explicitly, which avoids a dependency on the (heavyweight) Prometheus client. Updates https://github.com/tailscale/corp/issues/10205 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2023-04-11tsweb: expose native Prometheus metrics in /debug/varzAnton Tolchanov1-1/+1
The handler will expose built-in process and Go metrics by default, which currently duplicate some of the expvar-proxied metrics (`goroutines` vs `go_goroutines`, `memstats` vs `go_memstats`), but as long as their names are different, Prometheus server will just scrape both. This will change /debug/varz behaviour for most tsweb binaries, but notably not for control, which configures a `tsweb.VarzHandler` [explicitly](https://github.com/tailscale/corp/blob/a5b5d5167f1a2b780d313ec6a30e7b96dfa25b2d/cmd/tailcontrol/tailcontrol.go#L779) Updates https://github.com/tailscale/corp/issues/10205 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2023-02-11version: unexport all vars, turn Short/Long into funcsDavid Anderson1-1/+1
The other formerly exported values aren't used outside the package, so just unexport them. Signed-off-by: David Anderson <danderson@tailscale.com>
2023-01-27all: update copyright and license headersWill Norris1-3/+2
This updates all source files to use a new standard header for copyright and license declaration. Notably, copyright no longer includes a date, and we now use the standard SPDX-License-Identifier header. This commit was done almost entirely mechanically with perl, and then some minimal manual fixes. Updates #6865 Signed-off-by: Will Norris <will@tailscale.com>
2022-03-17all: use any instead of interface{}Josh Bleecher Snyder1-4/+4
My favorite part of generics. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-09-02tsweb: restore CPU profiling handlerBrad Fitzpatrick1-0/+5
It was accidentally deleted in the earlier 0022c3d2e (#2143) refactor. Lock it in with a test. Fixes tailscale/corp#2503 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-16tsweb: replace NewMux with a more flexible DebugHandler.David Anderson1-0/+136
Signed-off-by: David Anderson <danderson@tailscale.com>