Skip to content

fix: fail a check or condition whose ${VAR} resolves to blank - #860

Closed
HappyDevs1 wants to merge 2 commits into
mainfrom
fix/blank-reference-checks-fail
Closed

HappyDevs1 wants to merge 2 commits into
mainfrom
fix/blank-reference-checks-fail

Conversation

@HappyDevs1

Copy link
Copy Markdown
Collaborator

Closes #837.

Includes #859's commit (7ace713), because both change condition_holds. Merge #859 first, and this PR's diff drops to its own commit.

Problem

The grammar refuses blank expected text, but a ${VAR} reference gets past it, and an empty value is accepted when it resolves. page shows ${ORDER_ID} with ORDER_ID= then checks actual.contains(""), which is always true. The same holds for counts, url contains and title contains, on record and replay. A data source that returns a blank value turns a check into a silent pass.

Replicated on 0.23.34 against a local page reading "Hello world": recorded assert: page shows ${FP_ORDER} with FP_ORDER=Hello, then flowproof run --var FP_ORDER= gave [PASS] s0001 page shows ${FP_ORDER}.

Fix

  • flowproof-trace: secret::blank_refs(raw, resolved) returns BlankRefs naming the variables when the text is blank only because of its references. Literal text without references is left to the grammar.
  • Replay: check_assertion refuses a blank value_contains (counts included), url_contains or title_contains, so element, surface, framed, url and title checks all fail the step: ${ORDER_ID} is empty, so this check would hold whatever the app shows.
  • Conditions, both polarities: page does not show blank text never holds, so a blank reference would skip its branch as silently as the positive form takes it. Replay's reading_holds returns ReplayError::BlankRefs, which stops the run by name. The recorder's condition_holds fails the recording the same way.
  • Recorder checks: the same refusal for Contains, CountEquals, UrlContains and TitleContains.
  • docs/trace-format.md says so next to "an unset variable fails closed".

Exact forms (shows exactly, url is, attributes, styles) are untouched: blank text there is a real comparison, not one that holds on anything.

Tests

  • blank_refs_names_the_references_that_made_the_text_blank (flowproof-trace).
  • a_condition_whose_reference_is_blank_fails_the_recording: page shows, page does not show, and the element form.
  • a_check_whose_reference_is_blank_fails_by_name: replay fails the step, and recording refuses it.
  • a_when_whose_reference_is_blank_stops_the_replay_by_name.

Not built locally (no disk); CI is the first compile.

Copilot AI balanced review requested due to automatic review settings November 23, 2026 05:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@HappyDevs1

Copy link
Copy Markdown
Collaborator Author

Closing: these commits shipped in #863, which contained them and merged to main. Nothing is left to merge here.

@HappyDevs1 HappyDevs1 closed this Nov 23, 2026
@HappyDevs1
HappyDevs1 deleted the fix/blank-reference-checks-fail branch November 23, 2026 06:10
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.

A ${VAR} that resolves to empty makes "shows" and "url contains" checks pass on any page

2 participants