Skip to content

Reject non-finite --min-age in cleanup-grid-sessions.py - #5883

Merged
Eugene (OEvgeny) merged 1 commit into
mainfrom
OEvgeny/dev-cleanup-min-age-finite
Oct 17, 2026
Merged

Eugene (OEvgeny) merged 1 commit into
mainfrom
OEvgeny/dev-cleanup-min-age-finite

Conversation

@OEvgeny

Copy link
Copy Markdown
Collaborator

Fixes #

Changelog Entry

Not required, development only.

Description

Follow-up to #5880, from this review comment.

cleanup-grid-sessions.py --min-age uses type=float, so it accepts nan and inf. The old check only rejected negative values:

  • --min-age nan passed, and because age < nan is always false, the script deleted every session with a known start time, including young sessions of other runs on a shared grid.
  • --min-age inf (or 1e400) passed and kept every session, which is never what the caller wants.

The script now rejects any value that is not a finite number of seconds, zero or more, before it contacts the grid.

Specific Changes

  • cleanup-grid-sessions.py: validate --min-age with math.isfinite() in addition to the negative check, with the error --min-age must be a finite number of seconds, zero or more

Verified against a fake grid status server on a local port (one 10-second-old session, one 1000-second-old session, one with unknown start time), logging every request:

  • nan, NaN, inf, -inf, Infinity, 1e400, -1, -0.5: exit code 2 with the error, no HTTP request

  • 0, 400, 400 --dry-run, --dry-run, and no option: same output and requests as before

  • I have added tests and executed them locally

  • I have updated CHANGELOG.md

  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

@OEvgeny
Eugene (OEvgeny) marked this pull request as ready for review October 17, 2026 04:34
Copilot AI balanced review requested due to automatic review settings October 17, 2026 04:34
@OEvgeny
Eugene (OEvgeny) enabled auto-merge (squash) October 17, 2026 04:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused validation change addresses the unsafe inputs, with reported verification confirming rejection before grid access and preserved valid behavior.

No open issues 🎉

What changed in this PR

Hardens the Selenium Grid cleanup script so invalid age thresholds cannot cause unintended session cleanup.

Changes:

  • Rejects non-finite and negative --min-age values before contacting the grid.
  • Provides a clearer validation error while preserving valid inputs and defaults.
File Description
.github/​skills/​webchat-html-tests/​scripts/​cleanup-grid-sessions.py Adds finite, nonnegative age validation using math.isfinite().

Review effort: Balanced

@OEvgeny
Eugene (OEvgeny) merged commit df1f574 into main Oct 17, 2026
44 of 61 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the OEvgeny/dev-cleanup-min-age-finite branch October 17, 2026 05:41
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