FA-7581 / WebSocket and browser transport policies / Open access
Websocket upgrade requires both upgrade and connection tokens · case 01
Websocket upgrade requires both upgrade and connection tokens.
ROOT CAUSE
The faulty implementation uses `upgrade.lower() == "websocket"` for the websocket-upgrade-requires-both-upgrade-and-connection-tokens decision.
VERIFIED REPAIR
Apply the explicit websocket-upgrade-requires-both-upgrade-and-connection-tokens contract, including the tested boundary and negative cases.
Unsuccessful approach: The attempted repair uses `"upgrade" in connection` and still violates a separate fixture.
Case contract
Bounded offline decision model: websocket upgrade requires both upgrade and connection tokens. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.
Why this case matters
This deterministic websocket and browser transport policies model isolates the websocket-upgrade-requires-both-upgrade-and-connection-tokens policy at a network component boundary.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(upgrade, connection):
return upgrade.lower() == "websocket"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('websocket', []), False)", "check('fixture 2', solve('other', ['upgrade']), False)", "check('fixture 3', solve('WebSocket', ['Upgrade']), True)", "check('fixture 4', solve('websocket', ['keep-alive', 'upgrade']), True)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | False | False | Passed |
| fixture 3 | True | True | Passed |
| fixture 4 | True | True | Passed |
| fixture 1 | True | False | Failed |
SHA-256 / 93acf246b104fe3a043d551e69b69681285338a9202ca0aeddb942d609b3f69d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(upgrade, connection):
return "upgrade" in connection
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('websocket', []), False)", "check('fixture 2', solve('other', ['upgrade']), False)", "check('fixture 3', solve('WebSocket', ['Upgrade']), True)", "check('fixture 4', solve('websocket', ['keep-alive', 'upgrade']), True)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | True | False | Failed |
| fixture 3 | False | True | Failed |
| fixture 4 | True | True | Passed |
| fixture 1 | False | False | Passed |
SHA-256 / e1597b661844860a6eb7c9d12b73eb325955c84aba044f2dec461770333cf1f7
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(upgrade, connection):
return upgrade.lower() == "websocket" and "upgrade" in {x.lower() for x in connection}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('websocket', []), False)", "check('fixture 2', solve('other', ['upgrade']), False)", "check('fixture 3', solve('WebSocket', ['Upgrade']), True)", "check('fixture 4', solve('websocket', ['keep-alive', 'upgrade']), True)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | False | False | Passed |
| fixture 3 | True | True | Passed |
| fixture 4 | True | True | Passed |
| fixture 1 | False | False | Passed |
SHA-256 / ae354d56a91850496c17791bf4e74f7d79210a0a81eb82650ffc8187077a3dd0
Verification & scope
Bounded deterministic policy model over validated inputs; not a complete protocol stack or an interoperability claim. The five variants rotate the same explicit fixture set. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:38:13.420399+00:00.
Case digest / 17fbcc932d451951c498633349e75db63bc3ae17cda17dd7ef00525ec5df477e