Skip to content

[surfacers/probestatus] Emit status page start time in RFC3339 - #1412

Merged
manugarg merged 1 commit into
cloudprober:mainfrom
erik-bessegato:fix-status-starttime-format
Aug 18, 2026
Merged

manugarg merged 1 commit into
cloudprober:mainfrom
erik-bessegato:fix-status-starttime-format

Conversation

@erik-bessegato

Copy link
Copy Markdown
Contributor

Description

The status page embeds the prober start time in a Javascript variable:

<script>
  var startTime = '{{.StartTime}}';

It was rendered with Go's default time.Time format, so the page emits e.g.

var startTime = '2026-08-13 23:03:32.686 \u002b0200 CEST';

new Date() cannot parse that, so setupGraphEndpoint() produces an Invalid
Date and dateToValStr() throws RangeError: Invalid time value on
toISOString(). The throw propagates out of $(document).ready(...), so the
three init calls after setupGraphEndpoint() never run:

$(document).ready(function () {
  setupGraphEndpoint();      // throws
  setupGraphDuration();      // never runs
  showDebugInfo();           // never runs
  generateProbeSelectors();  // never runs
});

Visible effects on every load of /status:

  • the probe selector is never rendered (#probe-selector stays empty, which is
    why it shows as an empty blue strip under "Success Ratio")
  • the graph duration input has no change handler, so picking a duration does
    nothing
  • ?debug=1 has no effect

This is not timezone-specific; 0001-01-01 00:00:00 +0000 UTC is not parseable
by Date() either.

Measured on a running cloudprober before the change, on /status:

document.querySelectorAll('.probe-checkbox').length   // 0
document.getElementById('graph-endtime').getAttribute('min')   // null
window.allProbes   // ['public_web_endpoints', 'a_very_long_probe_name...']

The probe names are present in the page; only the code that renders them is
skipped. Calling generateProbeSelectors() by hand in the console then yields
3 checkboxes.

Fix

Render the value as RFC3339 so Date() can parse it.

Also make dateToValStr() return null for an Invalid Date instead of
throwing, so no single unparseable timestamp can abort the rest of the page
setup. This matters because setupGraphEndpoint() has a second call site that
reached the same throw:

let dt = new Date(params.get('graph_endtime') * 1000);
if (dt) {                        // an Invalid Date is truthy, so this is not a guard
  $('#graph-endtime').val(dateToValStr(dt));
}

/status?graph_endtime=abc reproduced the identical breakage (0 probe
checkboxes, same RangeError) even with the RFC3339 change applied. With this
patch the bad parameter is ignored and the page initialises normally.

Tests

TestStatusPageStartTime renders the page and asserts the embedded value
parses as RFC3339 and refers to the same instant, for a UTC, an east-of-UTC and
a west-of-UTC start time. It fails on all three subtests if the Format call
is reverted, and also fails if the timestamp is correctly formatted but wrong.

Note the east-of-UTC case covers html/template escaping + to \u002b in a
script context, which is valid inside the JS string literal and parses fine in
the browser.

Verification

Built and run against live probes; /status now renders the probe selector,
?graph_duration=6h and ?debug=1 both take effect, the min attribute is
set on the endtime picker, and the console is clean.

The status page embeds the prober start time in a Javascript variable,
which setupGraphEndpoint() passes to new Date(). It was rendered with
Go's default time format (e.g. "2026-08-13 23:03:32.686 +0200 CEST"),
which Date() cannot parse. dateToValStr() then threw a RangeError on
the resulting Invalid Date, aborting $(document).ready() and leaving
setupGraphDuration(), showDebugInfo() and generateProbeSelectors()
unexecuted: the probe selector never rendered, the graph duration
input stayed inert and ?debug=1 had no effect.

Render it as RFC3339, and make dateToValStr() return null on an
Invalid Date so that no unparseable timestamp can abort the page setup.
The graph_endtime parameter reached the same throw with a value like
?graph_endtime=abc, as its "if (dt)" check is true for an Invalid Date.
@manugarg

Copy link
Copy Markdown
Contributor

@erik-bessegato You've found a timezone specific bug. I couldn't reproduce it myself but AI found the reason:

Prober timezone	Emitted string	new Date() in V8
UTC	... +0000 UTC	✅ parses
America/New_York	... -0400 EDT	✅ parses
America/Los_Angeles	... -0700 PDT	✅ parses
Europe/London	... +0100 BST	❌ Invalid
Europe/Bucharest	... +0300 EEST	❌ Invalid
Asia/Kolkata	... +0530 IST	❌ Invalid
Australia/Sydney	... +1000 AEST	❌ Invalid
V8 accepts zone abbreviations it recognizes (UTC, GMT, EDT, EST, PST…) and rejects ones it doesn't 

@manugarg
manugarg merged commit 5db29ae into cloudprober:main Aug 18, 2026
11 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
cloudprober 0.14.5

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>A small, mostly housekeeping release: Cloudprober now builds with Go 1.26.6 (clearing CVE-2026-39821 from container scans), authoritative DNS servers get first-class probing support, and installing Cloudprober is down to a single command.

## 🔒 Security & Toolchain

- **Go 1.26.6** — Cloudprober now builds with Go 1.26.6, which addresses [CVE-2026-39821](https://nvd.nist.gov/vuln/detail/CVE-2026-39821). Most deployments were never exposed (the issue needs an attacker-controlled hostname to be parsed), but the published binaries and images now come back clean from container scanners ([#1426](cloudprober/cloudprober#1426), [#1427](cloudprober/cloudprober#1427)).
  - **Note for library users:** `go.mod` now declares `go 1.26.6` (was `1.25.12`), so importing Cloudprober as a Go module requires a 1.26.6+ toolchain. Binary and container users are unaffected.
- **install.sh hardening** — All downloads in the installer now pin `--proto =https --proto-redir =https`, so a redirect can't silently drop the transfer to plain HTTP ([#1405](cloudprober/cloudprober#1405)).
- **Dependency bumps** — Docs-site dependencies updated for Dependabot alerts: postcss, fast-uri, js-yaml, brace-expansion, linkify-it ([#1393](cloudprober/cloudprober#1393), [#1408](cloudprober/cloudprober#1408), [#1422](cloudprober/cloudprober#1422)).

## 🌐 DNS: Probing Authoritative Servers

Two changes that together make Cloudprober a proper fit for monitoring authoritative nameservers, rather than just resolvers ([#1193](cloudprober/cloudprober#1193)):

- **`recursion_desired` option** — The DNS probe now lets you control the RD flag on outgoing queries. It defaults to `true`, so existing configs behave exactly as before; set it to `false` to query an authoritative server the way a real resolver would ([#1395](cloudprober/cloudprober#1395)).
- **New `dns_validator`** — Validate the response itself, starting with an `authoritative` criterion that asserts the AA flag matches what you expect ([#1396](cloudprober/cloudprober#1396)):

  ```
  validator {
    name: "authoritative"
    dns_validator {
      authoritative: true
    }
  }
  ```

  The DNS probe now hands the full `*dns.Msg` to validators via `Input.Response`, the same way the HTTP probe passes HTTP responses. `Input.ResponseBody` still carries just the answer section, so existing regex validators are unaffected.

## 📦 Installation

- **One-line installer** — `curl -sSL https://cloudprober.org/install.sh | sh` is now the primary install method. It detects your platform, resolves the latest version from the `/releases/latest` redirect (no GitHub API rate limits), verifies the SHA-256 checksum, and installs to `/usr/local/bin` or `~/.local/bin`. `VERSION` and `INSTALL_DIR` override the defaults ([#1403](cloudprober/cloudprober#1403)).
- **tar.gz archives and checksums** — Releases now ship `.tar.gz` archives for Linux and macOS alongside the existing zips (Windows stays zip-only), plus a `cloudprober-<version>-checksums.txt` with SHA-256 sums for every archive ([#1402](cloudprober/cloudprober#1402)).

## 🐛 Bug Fixes

- **Browser probe: S3 artifact storage with IRSA** — A partial AWS SDK for Go v2 upgrade left the STS client incompatible with the newer SDK core's retry middleware, so the startup `HeadBucket` check failed with `failed to refresh cached credentials … not found: Retry` whenever credentials came from IAM Roles for Service Accounts. The full AWS SDK v2 module family (core, config, credentials, IMDS, CloudWatch, S3, STS, SSO) is now on mutually compatible versions. Thanks @aholden85! ([#1416](cloudprober/cloudprober#1416), [#1417](cloudprober/cloudprober#1417))
- **Probestatus: status page start time** — The prober start time was embedded in the page using Go's default `time.Time` format, which `new Date()` can't parse. That threw a `RangeError` out of the document-ready handler and took the rest of the page's setup down with it. It's now emitted as RFC3339. Thanks @erik-bessegato! ([#1412](cloudprober/cloudprober#1412))
- **Probestatus: deferred chart load** — The status page called c3's `chart.load()` with no arguments, which throws on every page load. Fixed, so the charts render as intended. Thanks @erik-bessegato! ([#1413](cloudprober/cloudprober#1413))
- **Example config validation** — `tools/test_example_configs.sh` globbed `examples/**/*.cfg` without enabling `globstar`, so bash quietly matched only one level deep and seven nested example configs were never validated by CI. With globstar on, one of them turned out to be broken: `examples/targets/file/cloudprober.cfg` used `//` comments, which textproto rejects. Both fixed ([#1421](cloudprober/cloudprober#1421)).

## 📚 Docs

- New dual-stack (IPv4 + IPv6) probing example ([#1420](cloudprober/cloudprober#1420)).
- New FAQ entry on using a custom CA with BROWSER probes (`ERR_CERT_AUTHORITY_INVALID`) ([#1418](cloudprober/cloudprober#1418)).
- CONTRIBUTING now asks for a linked issue and a real use case with pull requests ([#1415](cloudprober/cloudprober#1415)).
- README updated with a Live Demo link, and blog/Slack shortlinks added ([#1398](cloudprober/cloudprober#1398)).

## 🎉 New Contributors

Welcome to @aholden85 and @erik-bessegato, both first-time contributors in this release!

**Full Changelog:** https://github.com/cloudprober/cloudprober/compare/v0.14.4...v0.14.5</pre>
  <p>View the full release notes at <a href="https://github.com/cloudprober/cloudprober/releases/tag/v0.14.5">https://github.com/cloudprober/cloudprober/releases/tag/v0.14.5</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!17779
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.

2 participants