Repository navigation
Pre-release review fixes: socket and websocket - #21
Merged
Merged
Conversation
- utcp_socket: response_byte_format accepts every name 0.1.1 accepted via Encoding.getByName; the str() request format change is marked Breaking. - utcp_websocket: a URL variable resolving to an insecure address fails discovery with a result and calls with UtcpSecurityException; the parse-time URL check is marked Breaking. - utcp: registerManual returns a failure when substitution makes the manual template invalid.
…st, trim changelogs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes four pre-release audit findings in
utcp_socketandutcp_websocket. Follow-up to #4.response_byte_formatagain accepts every name 0.1.1 accepted throughEncoding.getByName(us,cp367,ibm367,csascii,iso646-us,iso-ir-6,ansi_x3.4-1968,csisolatin1,ibm819,iso-ir-100,iso_8859-1:1987,csutf8, …), plus Python's remaining aliases for those charsets. Lookup now ignores every non-alphanumeric character, so names with.and:resolve as they do in Python.str()request format change is marked Breaking: ({n: 1, flag: true}sends1 True, not1 true).${WS_URL}→ws://evil.example/ws),registerManualnow returns a failedRegisterManualResultand calls throwUtcpSecurityException. Before this, both threw aFormatException. A literal insecure URL in a document still fails at parse time.ws://${HOST}:8765/wswithHOST=localhostnow fails at client creation, as in Python). The inaccurate "the check when connecting stays" is gone.Where the WebSocket URL check runs
flowchart TD A[Document parsed: WebSocketCallTemplate.fromJson] --> B{Literal scheme in url?} B -- "no, e.g. ${WS_URL}" --> C[Accepted for now] B -- yes --> D{"wss://, or ws:// to loopback,<br/>with each ${VAR} read as remote?"} D -- no --> E["FormatException at parse:<br/>client creation fails"] D -- yes --> C C --> F[Client substitutes variables and re-parses] F --> G{Substituted url secure?} G -- no, discovery --> H["RegisterManualResult.failure<br/>(new: was thrown)"] G -- no, tool call --> I["UtcpSecurityException<br/>(new: was FormatException)"] G -- yes --> J[Connect: ensureSecureWebSocketUrl<br/>also covers templates built in code]How
InsecureWebSocketUrlException, which is both aFormatException(so document parsing still fails) and aUtcpSecurityException(so a refused call fails like any other security rejection). It is not exported: the package hides it.utcp,UtcpClientcatches aFormatExceptionfrom the substitute-and-reparse step during discovery and returnsRegisterManualResult.failureinstead of throwing. This applies to every transport, so it lives inutcp; the websocket package cannot see that its input was substituted.utcp.utcp's Unreleased section has Breaking: entries, sotool/prepare_release.dartwill raiseutcp_websocket'sutcpconstraint past^0.2.0whenutcpis bumped to a new minor.Verification
Every new test fails without its fix: the socket alias test, the
utcpclient discovery test, and the websocket parse, discovery and call tests.dart format,dart analyze --fatal-infos, anddart testpass inutcp,utcp_socket,utcp_websocket,utcp_conformanceand the root.