mustflow 2.116.0 → 2.116.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/core/source-anchors.js +11 -0
  2. package/package.json +1 -1
  3. package/templates/default/i18n.toml +72 -6
  4. package/templates/default/locales/en/.mustflow/skills/INDEX.md +37 -11
  5. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/SKILL.md +477 -0
  6. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-diagnostics-abi-linker-checklist.md +778 -0
  7. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-generators-properties-checklist.md +501 -0
  8. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-test-strategy-differential-checklist.md +498 -0
  9. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/debug-symbol-symbolication-checklist.md +412 -0
  10. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/ir-design-ssa-pass-pipeline-checklist.md +759 -0
  11. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/miscompile-reduction-ir-checklist.md +434 -0
  12. package/templates/default/locales/en/.mustflow/skills/cross-platform-filesystem-safety/SKILL.md +55 -36
  13. package/templates/default/locales/en/.mustflow/skills/cross-platform-filesystem-safety/references/path-containment-handle-checklist.md +251 -0
  14. package/templates/default/locales/en/.mustflow/skills/file-upload-security-review/SKILL.md +133 -32
  15. package/templates/default/locales/en/.mustflow/skills/file-upload-security-review/references/file-upload-parser-ssrf-resource-checklist.md +306 -0
  16. package/templates/default/locales/en/.mustflow/skills/formal-verification-review/SKILL.md +310 -0
  17. package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-concurrency-model-checking-smt-checklist.md +457 -0
  18. package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-contracts-modeling-checklist.md +434 -0
  19. package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-memory-bounds-ci-checklist.md +509 -0
  20. package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/SKILL.md +439 -0
  21. package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/references/fuzz-harness-campaign-checklist.md +379 -0
  22. package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/references/fuzz-oracle-triage-ci-checklist.md +307 -0
  23. package/templates/default/locales/en/.mustflow/skills/idempotency-integrity-review/SKILL.md +48 -28
  24. package/templates/default/locales/en/.mustflow/skills/idempotency-integrity-review/references/operation-ordering-stale-write-checklist.md +259 -0
  25. package/templates/default/locales/en/.mustflow/skills/input-boundary-validation-review/SKILL.md +329 -0
  26. package/templates/default/locales/en/.mustflow/skills/input-boundary-validation-review/references/input-boundary-security-checklist.md +319 -0
  27. package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/SKILL.md +306 -0
  28. package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/references/input-session-state-checklist.md +298 -0
  29. package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/references/remote-input-transport-interaction-checklist.md +328 -0
  30. package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/SKILL.md +353 -0
  31. package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-diagnostics-recovery-checklist.md +267 -0
  32. package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-execution-closure-performance-checklist.md +428 -0
  33. package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-gc-verification-checklist.md +457 -0
  34. package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-semantics-runtime-checklist.md +391 -0
  35. package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/SKILL.md +294 -0
  36. package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/references/modal-loop-reentrancy-checklist.md +290 -0
  37. package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/references/nested-modal-state-lifetime-checklist.md +297 -0
  38. package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/SKILL.md +252 -0
  39. package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/dns-network-resolution-checklist.md +394 -0
  40. package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/language-symbol-resolution-checklist.md +282 -0
  41. package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/module-package-loader-resolution-checklist.md +352 -0
  42. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/SKILL.md +103 -17
  43. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/cst-ast-lowering-checklist.md +260 -0
  44. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/lexer-tokenization-checklist.md +397 -0
  45. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/tree-serialization-compatibility-checklist.md +164 -0
  46. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/tree-traversal-rewrite-checklist.md +209 -0
  47. package/templates/default/locales/en/.mustflow/skills/race-condition-review/SKILL.md +68 -11
  48. package/templates/default/locales/en/.mustflow/skills/race-condition-review/references/race-reproduction-memory-model-checklist.md +268 -0
  49. package/templates/default/locales/en/.mustflow/skills/routes.toml +151 -0
  50. package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/SKILL.md +343 -0
  51. package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/references/session-auth-stream-resume-checklist.md +413 -0
  52. package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/references/session-handoff-protocol-checklist.md +485 -0
  53. package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/SKILL.md +267 -0
  54. package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/references/admission-decision-recovery-checklist.md +308 -0
  55. package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/references/two-phase-transition-checklist.md +229 -0
  56. package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/SKILL.md +300 -0
  57. package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/references/ui-affinity-event-loop-checklist.md +277 -0
  58. package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/references/ui-dispatch-lifecycle-checklist.md +292 -0
  59. package/templates/default/manifest.toml +115 -1
@@ -0,0 +1,319 @@
1
+ # Input Boundary Security Checklist
2
+
3
+ Use this reference after selecting `input-boundary-validation-review`. It supplies ledgers and
4
+ format-specific review prompts; the skill remains the procedure and command-authority boundary.
5
+
6
+ ## Contents
7
+
8
+ 1. Representation ledger
9
+ 2. Field identity policy
10
+ 3. Decoder and transport policy
11
+ 4. Parser and schema policy
12
+ 5. Unicode and identifier policy
13
+ 6. Structured sink policy
14
+ 7. Format-specific parser limits
15
+ 8. Shared resource budget
16
+ 9. Boundary test matrix
17
+ 10. Primary anchors
18
+
19
+ ## 1. Representation ledger
20
+
21
+ Record every representation that can affect meaning, identity, authority, cost, or execution.
22
+
23
+ | Stage | Representation | Owner | Operation | Rejected conditions | Limit and unit | Forwarded value |
24
+ | --- | --- | --- | --- | --- | --- | --- |
25
+ | Transport | wire bytes | server or protocol adapter | framing and content coding | malformed framing, unsupported coding | wire bytes | bounded body stream |
26
+ | Expansion | decoded bytes | decompressor or container adapter | decompression or extraction | checksum, ratio, size, nesting | expanded bytes and ratio | bounded byte stream |
27
+ | Character | Unicode scalars | strict decoder | charset decode | malformed UTF-8, BOM, surrogate | scalar and byte counts | immutable text |
28
+ | Component | component text | URL, form, or escape decoder | one component decode | malformed or recursive escape | decoded component bytes | decoded field |
29
+ | Identity | canonical key | field policy | normalization and folding | disallowed script or control | code points and graphemes | canonical key plus display value |
30
+ | Syntax | parsed value | one parser | full parse | duplicate, trailing data, recovery | tokens, nodes, depth | immutable tree or DTO |
31
+ | Semantics | domain value | domain validator | range and relation checks | invalid state or combination | domain-specific | validated value |
32
+ | Authority | authorized operation | policy owner | actor-resource-action decision | deny, missing context, stale version | decision deadline | bound decision |
33
+ | Effect | structured sink input | repository or adapter | bind or compile | unmapped grammar slot | query, argv, path, output budget | side effect |
34
+
35
+ For every row, answer:
36
+
37
+ - Can another layer repeat the operation?
38
+ - Can a raw or earlier representation bypass the forwarded value?
39
+ - Can the operation change length, equality, separators, grammar characters, or resource identity?
40
+ - Does failure reject, repair, replace, truncate, ignore, choose a default, or continue with a
41
+ warning?
42
+ - Does validation inspect the exact immutable value later authorized and executed?
43
+
44
+ A matching function name in two services does not prove matching behavior. Compare library,
45
+ version, options, locale, Unicode data, collation, duplicate policy, and error handling.
46
+
47
+ ## 2. Field identity policy
48
+
49
+ Define policy by field role rather than applying one global sanitizer.
50
+
51
+ | Field role | Raw retained? | Normalization | Case policy | Script or character policy | Uniqueness owner | Display policy |
52
+ | --- | --- | --- | --- | --- | --- | --- |
53
+ | Opaque server id | normally no client normalization | none beyond format | exact | narrow protocol alphabet | database or registry | canonical id |
54
+ | Username or handle | audit raw only if policy permits | declared NFC or NFKC profile | declared full fold or exact | identifier profile, mixed-script rule | canonical-key unique index | original safe display |
55
+ | Human name | preserve | normally NFC | locale-aware display only | broad text with control policy | no identity inference | escaped and bidi-isolated |
56
+ | Email-like identity | product-specific profile | component-specific | domain and local rules differ | explicit internationalization policy | canonical-key constraint | preserve meaningful spelling |
57
+ | Hostname | optional raw for audit | selected IDNA or UTS #46 profile | profile-owned | label and script checks | canonical ASCII A-label | safe Unicode display separately |
58
+ | Filename label | preserve as metadata | platform-independent display policy | do not infer storage identity | control, separator, bidi policy | server storage key | encoded download label |
59
+ | Enum or sort field | no | none | exact unless contract says otherwise | closed application enum | code map | localized label |
60
+ | Free text | preserve | usually NFC only if required | preserve | reject only unsafe controls for the context | not an identity key | output-context encoding |
61
+
62
+ Check these invariants:
63
+
64
+ - Canonicalization is deterministic and idempotent.
65
+ - The canonical key is computed before uniqueness, cache lookup, authorization, signing, and storage
66
+ decisions that depend on equality.
67
+ - Compatibility normalization is restricted to fields whose semantics permit distinctions to be
68
+ erased.
69
+ - Confusable skeletons are collision or review signals, not replacement usernames.
70
+ - Default-ignorable, joining, variation, and bidi characters are governed by field and language
71
+ context rather than globally deleted.
72
+ - Database collation, application comparison, cache keys, and downstream services agree or use the
73
+ same stored canonical key.
74
+
75
+ ## 3. Decoder and transport policy
76
+
77
+ Inventory all possible decoders:
78
+
79
+ - HTTP framing and chunking;
80
+ - content transfer and content coding;
81
+ - compression and archive layers;
82
+ - declared or default charset;
83
+ - UTF-8 or UTF-16 decoding;
84
+ - percent, form, JSON, XML, HTML, shell, or language escapes;
85
+ - base64, quoted-printable, multipart, protobuf, and custom envelopes;
86
+ - URL component parsing and IDNA conversion.
87
+
88
+ For each decoder:
89
+
90
+ 1. Name the exact input and output type.
91
+ 2. Reject malformed encoding rather than replacing, skipping, or guessing.
92
+ 3. Decide whether BOM is permitted and where.
93
+ 4. Bound input, output, ratio, nesting, and work before materialization.
94
+ 5. Reject trailing bytes or concatenated streams unless the format explicitly supports them.
95
+ 6. Prevent a later proxy, router, framework, database, filesystem, or client from decoding the value
96
+ again under another policy.
97
+
98
+ Test malformed percent escapes, encoded separators, mixed separators, double encoding, invalid UTF-8,
99
+ overlong forms, truncated multibyte sequences, unexpected BOMs, embedded NUL, lone surrogate input,
100
+ and a chunk boundary inside each multibyte or escaped sequence.
101
+
102
+ ## 4. Parser and schema policy
103
+
104
+ Use one row per externally controlled format.
105
+
106
+ | Concern | Required decision |
107
+ | --- | --- |
108
+ | Parser | implementation, version, dialect, and option source |
109
+ | Full consumption | EOF required, document count, trailing whitespace policy |
110
+ | Recovery | disabled, or exact compatible cases that remain external-contract safe |
111
+ | Duplicate names | reject before map binding; explicitly model genuine multi-value fields |
112
+ | Unknown fields | reject, preserve, or ignore under one versioned forward-compatibility contract |
113
+ | Coercion | exact accepted input types and every permitted conversion |
114
+ | Numbers | lexical length, integer and fraction digits, exponent, finite range, precision model |
115
+ | Strings | raw bytes, decoded scalar count, normalized length, allowed controls |
116
+ | Containers | maximum depth, keys, elements, attributes, aliases, and total nodes |
117
+ | Polymorphism | closed discriminator map; no client-selected runtime class |
118
+ | External resources | resolver, include, schema, entity, import, and network policy |
119
+ | Side effects | none until complete syntax and semantic acceptance |
120
+
121
+ Danger signs:
122
+
123
+ - gateway validates the first duplicate while the application uses the last;
124
+ - query parser turns one occurrence into a scalar and two into an array;
125
+ - schema validator coerces a string but business code reads the original raw value;
126
+ - security gate uses strict JSON while a downstream service accepts comments, trailing commas, or
127
+ multiple documents;
128
+ - a generic map erases duplicate names before the validator sees them;
129
+ - unknown enum or schema version becomes `DEFAULT`;
130
+ - validation timeout or parser warning falls through to an allow path;
131
+ - deserialization chooses a runtime class from `$type`, `@class`, tag, or user-owned discriminator;
132
+ - a parsed DTO is discarded and the raw string is reparsed for execution.
133
+
134
+ ## 5. Unicode and identifier policy
135
+
136
+ Review these as separate dimensions:
137
+
138
+ | Dimension | Questions |
139
+ | --- | --- |
140
+ | Encoding | Is the external charset fixed? Are malformed sequences rejected? |
141
+ | Scalar validity | Are lone surrogates, noncharacters when relevant, and NUL handled explicitly? |
142
+ | Normalization | Is NFC, NFD, NFKC, or NFKD selected per field and applied before validation? |
143
+ | Case | Is exact comparison, locale-independent full folding, or locale display casing intended? |
144
+ | Scripts | Are permitted scripts, mixed-script cases, and digit-set mixing explicit? |
145
+ | Confusables | Is collision detection separate from stored identity? |
146
+ | Ignorables | Are joining controls, variation selectors, soft hyphen, and BOM contextually handled? |
147
+ | Bidi | Are identifiers restricted and displayed text isolated? Are logs escaped visibly? |
148
+ | Length | Which limits use bytes, code points, grapheme clusters, display width, or normalized form? |
149
+ | IDNA | Which profile and version produce the canonical ASCII hostname? |
150
+
151
+ Keep storage and network protection limits in bytes and code points. Use grapheme clusters only for
152
+ user-visible character counts. Bound combining sequences and post-normalization growth separately
153
+ when they affect cost or storage.
154
+
155
+ Do not use a visual rendering, lowercase call, or normalization form as an authorization proof.
156
+ Bind authority to the stored canonical identity produced by the declared field policy.
157
+
158
+ ## 6. Structured sink policy
159
+
160
+ ### SQL
161
+
162
+ - Bind every data value through the driver.
163
+ - Map table, column, sort direction, operator, function, and grouping choice from a closed application
164
+ enum to fixed code.
165
+ - Reject generic "safe SQL fragment" strings and review ORM raw, native-query, string predicate,
166
+ relation-path, and order-clause escape hatches.
167
+ - Scope authorization in the query or repository operation, not as a format check before an
168
+ unscoped lookup.
169
+
170
+ ### NoSQL, search, and expression engines
171
+
172
+ - Accept a bounded business DTO, not a client-owned query object or DSL.
173
+ - Construct operator trees server-side from a closed mapping.
174
+ - Reject unexpected nested objects, operator-prefixed keys, scripts, unbounded regular expressions,
175
+ raw aggregation stages, and arbitrary field selection.
176
+ - Bound clause count, array size, date range, regex length, sort fields, result count, and query cost.
177
+
178
+ ### Processes
179
+
180
+ - Prefer a library API.
181
+ - Fix executable, subcommand, options, environment, working directory, privilege, network policy,
182
+ time, and output limits.
183
+ - Use an argument array without a shell, but still reject or terminate option parsing for operands
184
+ that can begin with `-`.
185
+ - Prefer stdin or an already-open file handle for large data. Close inherited file descriptors and
186
+ terminate descendants on timeout.
187
+
188
+ ### Filesystem and URL resources
189
+
190
+ - Prefer opaque server-owned resource IDs.
191
+ - Parse URLs into components and compare the canonical host under one IDNA policy.
192
+ - Resolve filesystem access relative to a trusted opened directory or equivalent capability.
193
+ - Treat symlinks, junctions, reparse points, case folding, device namespaces, alternate data streams,
194
+ trailing dots or spaces, short-name aliases, and time-of-check/time-of-use races as platform
195
+ concerns, not string-normalization details.
196
+ - Carry the opened handle or verified capability forward rather than reopening a checked string.
197
+
198
+ ### Templates and rendered output
199
+
200
+ - Treat template source, include names, expressions, and filter selection as deployed code.
201
+ - Copy only inert values into the template context; do not expose request, ORM, configuration,
202
+ classes, functions, or capability-bearing objects.
203
+ - Encode for the final output context. HTML escaping does not secure JavaScript, CSS, URL, CSV,
204
+ shell, or template grammar.
205
+ - Bound template CPU, memory, recursion, and output even when a sandbox is enabled.
206
+
207
+ ## 7. Format-specific parser limits
208
+
209
+ ### JSON
210
+
211
+ - Reject duplicate names, trailing garbage, multiple top-level values, invalid escapes, and lone
212
+ surrogate values that cannot satisfy the selected interoperability profile.
213
+ - Bound number text before arbitrary-precision conversion: total digits, fraction digits, exponent,
214
+ and domain range.
215
+ - Disable untrusted polymorphic type selection and bind into a closed DTO.
216
+
217
+ ### XML
218
+
219
+ - Reject `DOCTYPE` when the contract does not require it.
220
+ - Disable external general and parameter entities, external DTDs, XInclude, network and filesystem
221
+ resolvers, schema imports, and transformation-time external access.
222
+ - Bound entity expansion, element depth, attribute count, namespace declarations, name length,
223
+ text-node length, total nodes, and total decoded characters.
224
+ - Treat "secure processing" as a starting configuration whose effective provider limits must be
225
+ verified, not a magic flag.
226
+
227
+ ### YAML
228
+
229
+ - Use a safe data loader and a restricted schema. Disable runtime object construction, custom tags,
230
+ class lookup, and function invocation.
231
+ - Decide whether anchors, aliases, merge keys, directives, and multiple documents are needed; reject
232
+ them otherwise.
233
+ - Bound alias count, expansion work, depth, nodes, scalar size, and code points before object
234
+ construction.
235
+ - Validate the loaded data against an explicit DTO or schema after syntax parsing.
236
+
237
+ ### CSV and spreadsheet export
238
+
239
+ - Use a real CSV parser with fixed charset, delimiter, quote, escape, and newline policy.
240
+ - Bound rows, columns, record length, field length, total decoded bytes, and parse errors.
241
+ - Treat spreadsheet formula interpretation as a separate output sink. CSV quoting is not formula
242
+ neutralization; prefer a format with explicit text cell types when possible.
243
+ - Do not commit imported rows to production state until the complete bounded import validates.
244
+
245
+ ### Regular expressions
246
+
247
+ - Prefer a linear-time engine or a structurally safe subset for untrusted text.
248
+ - Require whole-string matching for field validation and check host-language anchor semantics.
249
+ - Bound pattern length, input length, captures, and execution work. Do not accept arbitrary
250
+ user-supplied patterns unless a dedicated constrained language owns them.
251
+ - Treat a timeout as a last stop, not the proof that a backtracking pattern is safe.
252
+
253
+ ## 8. Shared resource budget
254
+
255
+ Use one budget or bounded child views across transformations. Do not reset counters at decoder,
256
+ parser, nested-document, or subservice boundaries.
257
+
258
+ | Counter | Charged when | Typical failure class |
259
+ | --- | --- | --- |
260
+ | `wireBytes` | bytes arrive | request too large |
261
+ | `decodedBytes` | transfer or charset output is produced | decoded input too large |
262
+ | `expandedBytes` | decompression, entity, alias, or archive output is produced | expansion limit |
263
+ | `codePoints` | scalar values are decoded | text limit |
264
+ | `numberDigits` | numeric token is scanned | numeric complexity limit |
265
+ | `tokenCount` | token is accepted | syntax work limit |
266
+ | `nodeCount` | node allocation is attempted | structure limit |
267
+ | `maxDepth` | nested container is entered | nesting limit |
268
+ | `containerItems` | key, value, element, attribute, or row is accepted | breadth limit |
269
+ | `workUnits` | scan, comparison, normalization, regex, or recovery work occurs | complexity limit |
270
+ | `outputBytes` | result, log, rendered text, or child output is produced | output limit |
271
+ | deadline | bounded operation checks time | deadline exceeded |
272
+
273
+ Charge before allocation or effect. Report the stage, observed amount, configured limit, and stable
274
+ error class without echoing the hostile payload.
275
+
276
+ ## 9. Boundary test matrix
277
+
278
+ Minimum lanes:
279
+
280
+ 1. Smallest valid value and representative normal values.
281
+ 2. Empty, missing, null, wrong scalar type, wrong container type, and scalar-versus-array cases.
282
+ 3. Exact lower and upper business bounds plus one step outside.
283
+ 4. Whole-string mismatch, trailing newline, trailing garbage, and multiple-document cases.
284
+ 5. Duplicate key or parameter with equal values, conflicting values, and order reversal.
285
+ 6. Unknown field, enum, discriminator, and schema version.
286
+ 7. Invalid UTF-8, truncated escape, NUL, unexpected BOM, and invalid scalar sequence.
287
+ 8. NFC/NFD equivalents, NFKC-changing forms, case-fold expansion, mixed scripts, confusables,
288
+ default ignorables, bidi controls, and combining-mark growth.
289
+ 9. Raw, decoded, normalized, parsed, and output limits immediately below, at, and above the cap.
290
+ 10. Deep, wide, long-scalar, huge-number, alias, entity, regex, compression, and output-cost cases.
291
+ 11. Dynamic SQL identifier, NoSQL operator, process option, path separator, URL host, template
292
+ expression, and spreadsheet-formula attempts at the exact grammar boundary.
293
+ 12. Valid identifier without ownership, tenant membership, state permission, or action permission.
294
+ 13. Gateway-versus-application and application-versus-database differential cases.
295
+ 14. No side effect after every rejection, timeout, parser warning, and exhausted budget.
296
+
297
+ For accepted inputs, assert the canonical typed value and final structured sink shape. For rejected
298
+ inputs, assert the earliest stable rejection stage, error code, bounded work, and absence of side
299
+ effects or permissive defaults.
300
+
301
+ ## 10. Primary anchors
302
+
303
+ - [OWASP Input Validation Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html): syntactic versus semantic validation, early validation, allowlists, whole-string regular expressions, and the boundary between input validation and injection defenses.
304
+ - [WHATWG URL Standard](https://url.spec.whatwg.org/): component parsing, percent encoding and decoding, host processing, UTF-8 behavior, and URL validation errors.
305
+ - [RFC 3629](https://www.rfc-editor.org/rfc/rfc3629): UTF-8 validity, shortest-form encoding, scalar range, and decoder security considerations.
306
+ - [RFC 8259](https://www.rfc-editor.org/rfc/rfc8259): JSON grammar, interoperability, duplicate member names, numbers, strings, and parser behavior.
307
+ - [RFC 8785](https://www.rfc-editor.org/rfc/rfc8785): JSON canonicalization input constraints and deterministic serialization requirements.
308
+ - [Unicode Standard Annex #15](https://www.unicode.org/reports/tr15/): canonical and compatibility normalization forms, stability, idempotence, and the warning against blindly applying compatibility normalization to arbitrary text.
309
+ - [Unicode Technical Standard #39](https://www.unicode.org/reports/tr39/): identifier profiles, restriction levels, mixed scripts, confusables, and security mechanisms.
310
+ - [Unicode Technical Standard #46](https://www.unicode.org/reports/tr46/): IDNA compatibility processing and Unicode-to-ASCII domain mapping.
311
+ - [Unicode Standard Annex #29](https://www.unicode.org/reports/tr29/): grapheme-cluster segmentation for user-visible character counts.
312
+ - [OWASP SQL Injection Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html): parameter binding and fixed mappings for dynamic SQL identifiers.
313
+ - [OWASP NoSQL Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/NoSQL_Security_Cheat_Sheet.html): server-owned query construction, operator control, and query resource limits.
314
+ - [OWASP OS Command Injection Defense Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html): avoiding OS commands, data and command separation, argument injection, and option termination.
315
+ - [OWASP XML External Entity Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html): DTD, entity, XInclude, resolver, and secure-processing controls.
316
+ - [YAML 1.2.2](https://yaml.org/spec/1.2.2/): YAML representation, serialization, presentation, schema, tag, anchor, alias, and document semantics.
317
+ - [RFC 4180](https://www.rfc-editor.org/rfc/rfc4180): CSV quoting, embedded delimiters, and embedded line breaks.
318
+ - [OWASP ReDoS](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS): catastrophic backtracking and regular-expression denial-of-service risk.
319
+
@@ -0,0 +1,306 @@
1
+ ---
2
+ mustflow_doc: skill.input-event-synchronization-review
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: input-event-synchronization-review
9
+ description: Apply this skill when keyboard, mouse, pointer, touch, pen, wheel, gamepad, raw-input, remote desktop, cloud gaming, remote KVM, focus, capture, IME, clipboard, surface switching, frame or tick input, coalesced events, or input replay code is created, changed, reviewed, debugged, or reported and event loss, duplication, reordering, delay, feedback loops, cancellation, multi-owner state, or stale-session delivery can leave controls stuck or apply input inconsistently.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.input-event-synchronization-review
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - test_audit
23
+ - docs_validate_fast
24
+ - test_release
25
+ - mustflow_check
26
+ ---
27
+
28
+ # Input Event Synchronization Review
29
+
30
+ <!-- mustflow-section: purpose -->
31
+ ## Purpose
32
+
33
+ Review input as a lossy, session-scoped state-reconstruction protocol rather than a complete ledger
34
+ of hardware actions.
35
+
36
+ The review question is not "did every down receive an up?" It is "when delivery is coalesced,
37
+ duplicated, reordered, dropped, routed elsewhere, or terminated by lifecycle change, can one
38
+ authoritative reducer produce a bounded current state in which every active control ends by release
39
+ or cancel?"
40
+
41
+ <!-- mustflow-section: use-when -->
42
+ ## Use When
43
+
44
+ - Code handles keyboard, mouse, pointer, touch, pen, wheel, gamepad, raw device, remote desktop,
45
+ browser, desktop shell, game engine, canvas, drawing, drag, shortcut, text input, or replay events.
46
+ - Focus, visibility, suspend, resume, device connection, pointer capture, pointer lock, coordinate
47
+ transforms, frame or simulation ticks, event queues, source sequence, event dedupe, coalescing,
48
+ modifier state, key repeat, IME composition, or multi-device ownership changes.
49
+ - A bug reports stuck keys, stuck buttons, ghost drags, duplicate clicks, doubled movement, missing
50
+ movement, wrong shortcuts, input after focus return, capture theft, wheel target changes, or
51
+ nondeterministic input replay.
52
+ - Code or docs claim that timestamps preserve input order, down and up are paired, FIFO prevents
53
+ loss, polling repairs every gap, cancellation equals release, or one boolean represents current
54
+ modifier or button state.
55
+
56
+ <!-- mustflow-section: do-not-use-when -->
57
+ ## Do Not Use When
58
+
59
+ - The task validates hostile bytes, text, paths, uploads, fields, or decoded payloads; use
60
+ `input-boundary-validation-review`.
61
+ - The task is ordinary form, query, URL, cache, optimistic, persisted, or server-state ownership
62
+ without device-event lifecycle; use `frontend-state-ownership-review`.
63
+ - The task is keyboard accessibility, focus order, semantic activation, drag alternatives, or ARIA
64
+ behavior; use `frontend-accessibility-tree-review`.
65
+ - The main problem is a general shared-memory, lock, atomic, database, or distributed race rather
66
+ than input-session reconstruction; use `race-condition-review` or
67
+ `concurrency-invariant-review`.
68
+ - The task is only motion design, animation interruption, or visual gesture feedback; use
69
+ `motion-system-contract-review`.
70
+ - The code consumes an already normalized immutable input snapshot and does not own ingress,
71
+ lifecycle, reduction, cursor, capture, or replay semantics.
72
+
73
+ <!-- mustflow-section: required-inputs -->
74
+ ## Required Inputs
75
+
76
+ - Source ledger: platform APIs, event producers, polling sources, synthesized or compatibility
77
+ events, source clock domains, threading boundaries, and the one source authoritative for each
78
+ control or movement mode.
79
+ - Envelope contract: source, device, control, pointer, session epoch, source sequence, event ID,
80
+ physical identity, logical meaning, repeat, composition and synthesis flags, modifier snapshot,
81
+ button bitmask, coordinates, deltas, transform generation, native time, and ingress time.
82
+ - Lifecycle ledger: focus, visibility, suspend, resume, device add or remove, source reset, queue
83
+ overrun, capture gain or loss, pointer cancel or lock change, and session-generation changes.
84
+ - State model: per-device held controls, derived aggregate modifiers, `Up`, `Down`, `Canceled`,
85
+ `Press`, `Repeat`, `Release`, `Cancel`, drag phases, wheel ownership, and suppressed
86
+ recovery state.
87
+ - Delivery model: dedupe identity, source-order rule, reorder window, sequence-gap behavior,
88
+ snapshot or reset recovery, immutable batch boundary, journal retention, and consumer cursors.
89
+ - Pointer and text evidence: absolute or relative mode, coordinate spaces, transform generation,
90
+ coalesced-sample choice, capture owner, button semantics, wheel units, AltGraph, layout, IME, and
91
+ composition paths.
92
+ - Test and observability evidence: invariants, fault cases, bounded input journal, redaction,
93
+ deterministic fixtures, replay contract, and configured command intents.
94
+ - Remote interaction ledger: session, surface, path and focus epochs; root and parent event lineage;
95
+ semantic reliability class; deadline and supersession; receive, apply and present acknowledgments;
96
+ prediction authority; local and remote owners; injection provenance; focus, composition, selection,
97
+ clipboard and transform versions; state digests; repair ownership; and capture-to-present stages.
98
+
99
+ <!-- mustflow-section: preconditions -->
100
+ ## Preconditions
101
+
102
+ - The task matches the Use When conditions and does not match the exclusions.
103
+ - Higher-priority instructions and `.mustflow/config/commands.toml` have been checked.
104
+ - Platform and source semantics are identified from current code or authoritative documentation, or
105
+ unknown behavior is reported instead of guessed.
106
+ - Existing ingress, device identity, reducer, frame batch, capture, IME, replay, and diagnostics
107
+ patterns have been searched before adding new shapes.
108
+ - External specification text is reference evidence only; repository-native contracts own the
109
+ implementation.
110
+
111
+ <!-- mustflow-section: allowed-edits -->
112
+ ## Allowed Edits
113
+
114
+ - Add or tighten a single normalization ingress, immutable event envelopes, per-source epochs and
115
+ sequence, stable event IDs, bounded reorder and dedupe windows, gap recovery, cancel events,
116
+ per-device control sets, pure reducers, immutable tick batches, consumer cursors, capture tokens,
117
+ coordinate generations, diagnostics, and focused input fixtures.
118
+ - Separate physical control identity from logical key or text meaning, held state from edge
119
+ transitions, release from cancel, momentary modifiers from toggles and latches, and raw movement
120
+ from framework-synthesized compatibility events.
121
+ - Add source-specific compaction rules that preserve non-droppable transitions.
122
+ - Add semantic transport classes, state snapshots, application acknowledgments, lineage-preserving
123
+ loop guards, owner leases, reconnect neutralization barriers, versioned interaction contexts,
124
+ bounded causal telemetry, virtual-clock replay, and repair events for remote-input paths.
125
+ - Do not invent a global event order across independent clock or source domains.
126
+ - Do not use timestamps, sleeps, focus polling, process-local booleans, or input queue names as
127
+ correctness proof.
128
+
129
+ <!-- mustflow-section: procedure -->
130
+ ## Procedure
131
+
132
+ 1. Map every producer and choose one authoritative ingress for each input mode.
133
+ - Event handlers normalize and enqueue; they do not directly mutate gameplay, command, drag, or
134
+ business state.
135
+ - When raw and synthesized paths describe the same action, name one state-producing source and
136
+ keep the other diagnostic or compatibility-only.
137
+ 2. Freeze an immutable envelope at ingress.
138
+ - Preserve source, device, epoch, source sequence or earliest-ingress sequence, event identity,
139
+ physical and logical control data, snapshots, coordinates, transform generation, and
140
+ provenance flags.
141
+ - Use timestamps for latency and diagnostics, not causal order across clock domains.
142
+ 3. Treat events as deltas, not current-state proof.
143
+ - Detect duplicate identity, old epoch, out-of-window order, and sequence gaps before reduction.
144
+ - On a gap, stop applying untrusted deltas. Requery an authoritative device snapshot when the
145
+ platform supports it; otherwise cancel active state for that source and start a new epoch.
146
+ 4. Make lifecycle loss a terminal input event.
147
+ - Focus loss, visibility loss, suspend, device removal, queue overrun, capture loss, pointer
148
+ cancel, and source reset flow through one ordered `CancelAll(reason, oldEpoch)` path.
149
+ - Reject late events from the old epoch. Do not wait forever for a release routed elsewhere.
150
+ 5. Reduce physical state per source and device.
151
+ - Pair press and release by physical control identity, not translated text.
152
+ - Track holders as a set of devices or pointers. Derive aggregate Shift, Control, Alt, Meta, or
153
+ button state instead of overwriting one boolean.
154
+ 6. Separate persistent state from edge records.
155
+ - Held state is reducer output. Press, repeat, release, and cancel are immutable transition
156
+ records.
157
+ - Duplicate down while already down becomes repeat or diagnostic duplicate; release while up is
158
+ harmless and observable rather than a negative counter.
159
+ 7. Classify keyboard semantics.
160
+ - Use physical identity for held controls and gameplay bindings; use logical meaning and text
161
+ composition for text.
162
+ - Treat auto-repeat as policy input, not another press. Define hold, repeat, and one-shot commands
163
+ separately.
164
+ - Derive left and right modifiers independently. Distinguish momentary, toggle, and latch state.
165
+ - Give AltGraph and composition paths precedence over ordinary character shortcuts when the
166
+ platform reports them. Keep command handling separate from IME text commitment.
167
+ 8. Recover focus without synthesizing commands.
168
+ - If current device state can be queried, represent controls already held at return as
169
+ suppressed held state until a real release and new press occur.
170
+ - Use polling only as a bounded recovery snapshot. Do not use ambiguous edge bits or sampled
171
+ state to manufacture missed presses.
172
+ 9. Cut one immutable batch per frame or simulation tick.
173
+ - Do not let mid-tick arrivals mutate the snapshot already visible to earlier systems.
174
+ - Keep the journal immutable and give UI, gameplay, shortcuts, replay, and diagnostics separate
175
+ cursors or projections. One consumer must not destructively steal another's edge.
176
+ 10. Apply compaction by semantic class.
177
+ - Never drop or merge press, release, cancel, focus, capture, epoch, device, or mode transitions.
178
+ - Sum relative camera deltas, retain ordered drawing samples, keep the latest absolute hover
179
+ position, and accumulate wheel precision according to the consumer contract.
180
+ - Choose either the representative coalesced event or its original samples for one path, never
181
+ both.
182
+ 11. Keep coordinate and movement modes explicit.
183
+ - Do not derive relative movement from clamped absolute coordinates.
184
+ - Invalidate old absolute baselines on mode changes and mark warp-generated samples.
185
+ - Freeze the coordinate space and transform generation used at ingress so a later window, DPI,
186
+ viewport, zoom, or canvas change cannot reinterpret history.
187
+ 12. Model gestures and capture as state machines.
188
+ - Use explicit idle, armed, dragging, clicked or released, and canceled states. Measure drag
189
+ thresholds from the original anchor.
190
+ - Bind capture to pointer, generation, and owner. Confirm acquisition and loss events; only the
191
+ current owner token can release current capture.
192
+ - Reconcile current button bitmasks with internal state without inventing a new press when the
193
+ gesture never observed one.
194
+ 13. Model wheel delivery as a gesture transaction.
195
+ - Preserve unit or mode and fractional precision.
196
+ - Hold one wheel owner for the platform transaction or bounded idle phase. Do not assume pointer
197
+ capture owns wheel routing.
198
+ 14. For remote input, classify preservation semantics before choosing transport behavior.
199
+ - Treat absolute state as supersedable, relative movement as range-summed, pen or touch as a
200
+ path, press and release as idempotent boundaries, and focus, composition, clipboard, or
201
+ surface changes as ordered interaction transactions.
202
+ - Carry session, surface and path epochs, source and root identity, sequence, deadline, state
203
+ version, and reliability class. Transport receipt is not application acceptance.
204
+ - Separate receive, reducer-apply, and displayed-frame acknowledgments. Bound queues by oldest
205
+ still-useful input age and preserve boundary events under pressure.
206
+ 15. Prevent local-to-remote feedback loops by provenance, not timing guesses.
207
+ - Preserve origin, root event, parent event, apply context, hop path, and propagation policy
208
+ through adapters and derived commands.
209
+ - Keep capture and remote-apply paths separate. Exclude a dedicated injected source or exact
210
+ session marker at ingress; do not suppress similar local input inside a time window.
211
+ - Track held controls by owner and press identity. Use resource-specific arbitration for shared
212
+ modifiers, exclusive drags or composition, cursor control, clipboard, and local takeover.
213
+ 16. Version the remote interaction context.
214
+ - Separate operating-system activation, document visibility, active remote surface, and editing
215
+ focus. Make focus a request, application, and confirmed-generation protocol.
216
+ - Choose exactly one IME authority. Version composition, text, selection and target ranges;
217
+ close composition before focus or surface generation changes.
218
+ - Treat clipboard as a versioned multi-representation object with origin and content policy.
219
+ Advertise metadata before transferring selected content on a lower-priority path.
220
+ - Neutralize held state, capture, drag and composition before admitting a reconnect or new
221
+ surface epoch. Resume only after state and transform acknowledgment.
222
+ 17. Make remote-input failures replayable without logging user content.
223
+ - Link capture, normalize, queue, send, receive, validate, dedupe, apply, render, present, drop,
224
+ acknowledge and repair stages by event, root, frame, epoch and state hashes.
225
+ - Preserve source occurrence and component observation times separately. Use sequence and parent
226
+ relationships for causality; use clock estimates only for latency.
227
+ - Record high-frequency summaries in a bounded low-overhead ring, snapshot at semantic
228
+ boundaries, replay normalized events under a virtual monotonic clock, and compare the first
229
+ state-hash divergence.
230
+ 18. Read [Input Session State Checklist](references/input-session-state-checklist.md) for the
231
+ detailed envelope, transition, compaction, recovery, and fault matrices.
232
+ 19. Read [Remote Input Transport and Interaction Checklist](references/remote-input-transport-interaction-checklist.md) when input crosses a process, host, network, injected-device, or rendered-frame boundary.
233
+ 20. Require adversarial evidence.
234
+ - Inject duplicate, gap, reordering, coalescing, focus loss, device removal, capture theft,
235
+ suspend, mode change, multi-device holds, repeat, AltGraph, composition, and tick-boundary
236
+ arrival.
237
+ - Assert that every active control terminates by release or cancel, aggregate state equals its
238
+ holders, old epochs cannot mutate current state, one source action is not applied twice, and
239
+ every consumer sees one immutable batch.
240
+ - If configured proof is unavailable, report the static invariant gap instead of approving the
241
+ path.
242
+
243
+ <!-- mustflow-section: postconditions -->
244
+ ## Postconditions
245
+
246
+ - Source authority, envelope, identity, epoch, ordering, gap recovery, lifecycle cancellation,
247
+ physical and logical key model, device ownership, reducer, immutable batch, consumer cursors,
248
+ compaction, coordinates, capture, wheel, IME, diagnostics, and test evidence are explicit.
249
+ - Missing release, duplicate down, old-session delivery, queue loss, timestamp sorting, global-order
250
+ invention, destructive edge reads, raw-plus-synthesized duplication, modifier collapse, repeat
251
+ commands, composition leakage, stale capture release, doubled coalesced movement, transform drift,
252
+ and unowned wheel gestures are fixed or reported.
253
+ - Input synchronization claims are backed by configured tests, replayable fixtures, platform
254
+ evidence matched to current code, or labeled as static review risk.
255
+ - Remote-input claims also expose semantic delivery class, loop prevention, ownership arbitration,
256
+ interaction-context versions, acknowledgment layer, causal trace, repair path, and
257
+ capture-to-present evidence.
258
+
259
+ <!-- mustflow-section: verification -->
260
+ ## Verification
261
+
262
+ Use configured oneshot command intents when available:
263
+
264
+ - `changes_status`
265
+ - `changes_diff_summary`
266
+ - `lint`
267
+ - `build`
268
+ - `test_related`
269
+ - `test`
270
+ - `test_audit`
271
+ - `docs_validate_fast`
272
+ - `test_release`
273
+ - `mustflow_check`
274
+
275
+ Prefer the narrowest configured intent that covers the changed input boundary and synchronized
276
+ template surfaces. Do not infer raw device tools, live input recorders, browser sessions, game
277
+ loops, watchers, accessibility tools, or platform diagnostics outside the command contract.
278
+
279
+ <!-- mustflow-section: failure-handling -->
280
+ ## Failure Handling
281
+
282
+ - If the authoritative source, device identity, epoch, or gap recovery rule cannot be named, report
283
+ that current input state is not reconstructable.
284
+ - If safe recovery requires platform state queries, native integration, device fixtures, or a replay
285
+ harness outside scope, keep cancel-and-new-epoch behavior fail-safe and report the missing proof.
286
+ - If privacy-sensitive key or text content would enter diagnostics, keep physical identities,
287
+ lifecycle, sequence, and invariant counters while redacting text and user content.
288
+ - If a configured command fails, preserve the failing input invariant and fixture before editing
289
+ again.
290
+ - If deterministic input proof is not configured, report the missing manual or integration evidence
291
+ and defer rather than inventing a raw command.
292
+
293
+ <!-- mustflow-section: output-format -->
294
+ ## Output Format
295
+
296
+ - Input synchronization boundary reviewed
297
+ - Source authority and envelope
298
+ - Epoch, sequence, dedupe, gap, lifecycle, reducer, physical/logical key, modifier, repeat, IME,
299
+ batch, cursor, compaction, coordinate, gesture, capture, wheel, remote transport, lineage, loop,
300
+ arbitration, focus, clipboard, surface, acknowledgment, observability, replay, and test findings
301
+ - Input synchronization fixes made or recommended
302
+ - Evidence level: configured-test evidence, platform evidence, replay fixture, static review risk,
303
+ manual-only, missing, or not applicable
304
+ - Command intents run
305
+ - Skipped input diagnostics and reasons
306
+ - Remaining input-event synchronization risk