makiri 0.8.0-aarch64-linux → 0.9.0-aarch64-linux
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.
- checksums.yaml +4 -4
- data/.github/workflows/security.yml +49 -0
- data/CHANGELOG.md +56 -0
- data/README.md +51 -3
- data/Rakefile +57 -0
- data/lib/makiri/3.2/makiri.so +0 -0
- data/lib/makiri/3.3/makiri.so +0 -0
- data/lib/makiri/3.4/makiri.so +0 -0
- data/lib/makiri/4.0/makiri.so +0 -0
- data/lib/makiri/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 73e114eace5001084f191b87a1608364858d5696d79bc2f1b950aea2c7806ec4
|
|
4
|
+
data.tar.gz: 2ecdd8274159bf93573f08d47462aa69470104f4a188c4731ba36cf33efba0cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 115fd4af76231a9ca4373927ee763f658b01011f5cb244befda840274789629b582267f5798e83bccdb5add73c05156281ffe49461a3abbf311af19f99e9243e
|
|
7
|
+
data.tar.gz: 976aad3964d2993a31167d01d719fe9c6d5ea762560c5e00430c19e2b6c1cb35fa0a5d8cd594e377749bcdbb4704bfaa7c401f2d986f65e3dca066409cf79c3b
|
|
@@ -157,6 +157,55 @@ jobs:
|
|
|
157
157
|
# poisoning on), catching intra-arena overflows that a plain ASan build cannot
|
|
158
158
|
# see - the class the v3.0.0 :lexbor-contains overflow belonged to. Heavy
|
|
159
159
|
# (full instrumented Lexbor rebuild), so nightly only.
|
|
160
|
+
# The randomised property checks (spec/invariants/). Cheap enough to gate a PR
|
|
161
|
+
# on, so they run on every push; the ASan pass is nightly because an
|
|
162
|
+
# instrumented build is slow.
|
|
163
|
+
invariants:
|
|
164
|
+
name: Invariant checks
|
|
165
|
+
runs-on: ubuntu-latest
|
|
166
|
+
if: github.event_name != 'schedule'
|
|
167
|
+
steps:
|
|
168
|
+
- name: Checkout (with vendored Lexbor submodule)
|
|
169
|
+
uses: actions/checkout@v6
|
|
170
|
+
with:
|
|
171
|
+
submodules: recursive
|
|
172
|
+
|
|
173
|
+
- name: Ensure cmake is available
|
|
174
|
+
uses: lukka/get-cmake@latest
|
|
175
|
+
|
|
176
|
+
- name: Set up Ruby
|
|
177
|
+
uses: ruby/setup-ruby@v1
|
|
178
|
+
with:
|
|
179
|
+
ruby-version: "3.4"
|
|
180
|
+
bundler-cache: true
|
|
181
|
+
|
|
182
|
+
- name: Run the invariant checks
|
|
183
|
+
run: bundle exec rake invariants
|
|
184
|
+
|
|
185
|
+
invariants-sanitize:
|
|
186
|
+
name: Nightly invariant checks under ASan + UBSan
|
|
187
|
+
runs-on: ubuntu-latest
|
|
188
|
+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
|
189
|
+
steps:
|
|
190
|
+
- name: Checkout (with vendored Lexbor submodule)
|
|
191
|
+
uses: actions/checkout@v6
|
|
192
|
+
with:
|
|
193
|
+
submodules: recursive
|
|
194
|
+
|
|
195
|
+
- name: Ensure cmake is available
|
|
196
|
+
uses: lukka/get-cmake@latest
|
|
197
|
+
|
|
198
|
+
- name: Set up Ruby
|
|
199
|
+
uses: ruby/setup-ruby@v1
|
|
200
|
+
with:
|
|
201
|
+
ruby-version: "3.4"
|
|
202
|
+
bundler-cache: true
|
|
203
|
+
|
|
204
|
+
# The text index hands out borrowed slices, so a stale one is a memory bug
|
|
205
|
+
# as much as a wrong answer - this is the pass that would see it.
|
|
206
|
+
- name: Run the invariant checks under sanitizers
|
|
207
|
+
run: bundle exec rake "invariants:sanitize"
|
|
208
|
+
|
|
160
209
|
security-sanitize-lexbor:
|
|
161
210
|
name: Nightly instrumented-Lexbor ASan suite
|
|
162
211
|
runs-on: ubuntu-latest
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.0] - 2026-09-11
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
* `Node#attribute_by_qualified_name(name)` and
|
|
8
|
+
`Node#attribute_value_by_qualified_name(name)`: the attribute whose
|
|
9
|
+
**qualified** name is exactly `name` — its node, and its value — or nil.
|
|
10
|
+
`#[]` cannot answer this: it also finds a prefixed attribute by its local
|
|
11
|
+
name (`svg_a["href"]` returns `xlink:href`), and it lower-cases what it looks
|
|
12
|
+
up (`el["DATA-X"]` finds `data-x`). The new match is byte-exact.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
* **`Makiri::XML` follows the DOM namespace model.** A node's namespace URI is
|
|
17
|
+
decided once — by the parser, or by the context it is first inserted into —
|
|
18
|
+
and does not change afterwards; the serializer emits whatever xmlns
|
|
19
|
+
declarations the output needs:
|
|
20
|
+
|
|
21
|
+
- moving a node under an element that binds its prefix to a different URI
|
|
22
|
+
keeps `namespace_uri`, and the output declares the prefix at the moved node;
|
|
23
|
+
- inserting a node whose prefix is bound nowhere in the destination now
|
|
24
|
+
succeeds instead of raising;
|
|
25
|
+
- `import_node` keeps the namespace of what it copied;
|
|
26
|
+
- an element in no namespace stays in no namespace under a default namespace,
|
|
27
|
+
serialized as `xmlns=""`;
|
|
28
|
+
- `#to_xml` on a node below the root declares the prefixes its subtree uses,
|
|
29
|
+
so the output re-parses to the same namespaces standing alone.
|
|
30
|
+
|
|
31
|
+
Nodes from the factories (`create_element` and friends) still take their
|
|
32
|
+
namespace from the context they are first inserted into.
|
|
33
|
+
|
|
34
|
+
* **Inserting a node from another document adopts it.** `add_child` / `before` /
|
|
35
|
+
`after` / `replace` bring the node over and remove it from the document it
|
|
36
|
+
came from, instead of copying it (`Makiri::XML`) or raising (`Makiri::HTML`).
|
|
37
|
+
A spliced fragment is left empty; a rejected insert leaves the source
|
|
38
|
+
document untouched.
|
|
39
|
+
|
|
40
|
+
The node handed back is a **different object** than the one passed in, so use
|
|
41
|
+
the return value afterwards rather than the argument. `Document#import_node`
|
|
42
|
+
is unchanged: it copies and leaves the source alone.
|
|
43
|
+
|
|
44
|
+
* **XML serialization is capped at the nesting depth the parser accepts.**
|
|
45
|
+
`#to_xml` and `#canonicalize` raise `Makiri::Error` past it, rather than
|
|
46
|
+
emitting XML that Makiri could not read back. A deeper tree is still fine to
|
|
47
|
+
hold, walk and query.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
* XPath axes from an **attribute** context node on the XML backend now follow
|
|
52
|
+
XPath 1.0 §2.2: `following-sibling` and `preceding-sibling` are empty, and
|
|
53
|
+
`following` / `preceding` exclude attribute nodes. They used to return the
|
|
54
|
+
element's later attributes.
|
|
55
|
+
|
|
56
|
+
* A rejected insert no longer leaves part of the moved subtree carrying
|
|
57
|
+
namespace URIs resolved against the scope it was refused from.
|
|
58
|
+
|
|
3
59
|
## [0.8.0] - 2026-07-12
|
|
4
60
|
|
|
5
61
|
### Fixed
|
data/README.md
CHANGED
|
@@ -110,7 +110,9 @@ doc.css("feed > entry").map { |e| e.at_css("title").text } # => ["Hello", "Worl
|
|
|
110
110
|
|
|
111
111
|
# Serialize back to XML
|
|
112
112
|
doc.to_xml # => "<?xml version=\"1.0\"?>\n<feed ...>...</feed>\n"
|
|
113
|
-
|
|
113
|
+
# A node below the root serializes self-contained: no XML declaration, but the
|
|
114
|
+
# namespace declarations its subtree needs, so the output re-parses the same.
|
|
115
|
+
doc.at_xpath("//a:entry", ns).to_xml # => "<entry xmlns=\"http://www.w3.org/2005/Atom\"><title>Hello</title></entry>"
|
|
114
116
|
doc.to_xml(pretty: true) # indented, element-only content
|
|
115
117
|
|
|
116
118
|
# DOCTYPE is recognized but the DTD is not processed (no entities, no I/O):
|
|
@@ -138,8 +140,11 @@ doc.root.to_xml # => "<feed xmlns:dc=\"urn:dc\"><post dc:k=\"v\">Bye</
|
|
|
138
140
|
```
|
|
139
141
|
|
|
140
142
|
XML subtrees can be built with `Document#create_element` and related node factory methods,
|
|
141
|
-
then inserted with `#add_child`, `#before`, `#after`, or `#replace
|
|
142
|
-
|
|
143
|
+
then inserted with `#add_child`, `#before`, `#after`, or `#replace`. A factory-built
|
|
144
|
+
node takes its namespace from the context it is first inserted into; one that already
|
|
145
|
+
has a namespace keeps it. A node from another document is **adopted** — brought over
|
|
146
|
+
and removed from the document it came from — and the method returns the node now in
|
|
147
|
+
the tree, which is a different object than the one passed in.
|
|
143
148
|
|
|
144
149
|
`Document#import_node(node, deep = false)` brings a node into a document as a
|
|
145
150
|
detached copy, and works **across representations**: importing a `Makiri::HTML`
|
|
@@ -240,6 +245,34 @@ Detailed, test-backed notes live in `spec/conformance/README.md`.
|
|
|
240
245
|
(QNames), never PI targets. Nokogiri/libxml2 rejects it (`colons are forbidden
|
|
241
246
|
from PI names`); Makiri follows the normative text. Only the reserved `xml`
|
|
242
247
|
(any case) target is rejected.
|
|
248
|
+
* A node's **namespace URI is its identity**, not something re-derived from the
|
|
249
|
+
declarations around it - the WHATWG DOM model, measured against Chrome 152
|
|
250
|
+
(`DOMParser` + `XMLSerializer`).
|
|
251
|
+
* Moving a node under an element that binds its prefix to a different URI does
|
|
252
|
+
**not** change `namespace_uri`; the serializer emits the declaration the
|
|
253
|
+
output needs (`<p:x xmlns:p="urn:a"/>`), and nothing when the destination
|
|
254
|
+
already agrees. libxml2 keeps the URI on an in-document move but does *not*
|
|
255
|
+
emit the declaration, so Nokogiri's tree and its own output disagree there.
|
|
256
|
+
* `#to_xml` on a node below the root is **self-contained**: it declares the
|
|
257
|
+
prefixes its subtree uses, so the output re-parses to the same namespaces
|
|
258
|
+
standing alone. Nokogiri omits them, and its subtree output does not
|
|
259
|
+
round-trip.
|
|
260
|
+
* Where one prefix would have to mean two things at once, the serializer
|
|
261
|
+
invents one (`ns1`, `ns2`, ...) rather than shadow the other, as browsers do.
|
|
262
|
+
* An element in **no** namespace stays that way under a default namespace,
|
|
263
|
+
serialized as `xmlns=""`.
|
|
264
|
+
* Nodes from the factories (`create_element` and friends) still take their
|
|
265
|
+
namespace from the context they are first inserted into, so a subtree can be
|
|
266
|
+
built detached and attached afterwards. Only later moves carry.
|
|
267
|
+
* Inserting a node **from another document adopts it** (`add_child` / `before` /
|
|
268
|
+
`after` / `replace`): it is brought over and taken out of the document it came
|
|
269
|
+
from, as `appendChild` does in the DOM and in both Chrome and Nokogiri.
|
|
270
|
+
* Each arena owns its own nodes, so the node cannot be relinked across them: it
|
|
271
|
+
is copied here and removed there. The one visible difference from Nokogiri
|
|
272
|
+
and browsers is that the node handed back is a **different object** than the
|
|
273
|
+
one passed in - use the return value afterwards, not the argument.
|
|
274
|
+
* `Document#import_node` is the copy: it leaves the source alone, like DOM
|
|
275
|
+
`importNode`.
|
|
243
276
|
* Otherwise the parsed tree is byte-identical to `Nokogiri::XML`'s (verified by
|
|
244
277
|
the property-based differential), including namespaces, prolog/epilog comments
|
|
245
278
|
and PIs, and adjacent-CDATA coalescing.
|
|
@@ -267,6 +300,21 @@ Detailed, test-backed notes live in `spec/conformance/README.md`.
|
|
|
267
300
|
* Type selectors are ASCII case-insensitive (CSS-correct for HTML; `LI` matches `<li>`)
|
|
268
301
|
* `Nokogiri::HTML5` is case-sensitive there.
|
|
269
302
|
|
|
303
|
+
### Serialization
|
|
304
|
+
|
|
305
|
+
* **Comment data is written literally**, as the WHATWG serialization algorithm
|
|
306
|
+
says and as browsers do: `comment.content = "a-->b"` serializes to
|
|
307
|
+
`<!--a-->b-->`, which re-parses as the comment `"a"` followed by text.
|
|
308
|
+
* `Nokogiri::HTML5` escapes it to `<!--a-->b-->` instead. That does not
|
|
309
|
+
round-trip either - comments do not decode entities, so the data comes back
|
|
310
|
+
as `"a-->b"`. Neither library round-trips this; Makiri matches Chrome.
|
|
311
|
+
* The same applies to the children of `style` / `script` / `xmp` / `iframe` /
|
|
312
|
+
`noembed` / `noframes` / `plaintext`, which the algorithm also writes
|
|
313
|
+
literally. `noscript` is **escaped**, because Makiri parses it with scripting
|
|
314
|
+
disabled (its children are elements, not raw text) and escaping is what makes
|
|
315
|
+
that round-trip; `Nokogiri::HTML5` writes it literally and contradicts its own
|
|
316
|
+
parser there.
|
|
317
|
+
|
|
270
318
|
### Text input (mutation APIs)
|
|
271
319
|
|
|
272
320
|
* Programmatic string arguments must be **valid UTF-8** (invalid bytes raise
|
data/Rakefile
CHANGED
|
@@ -226,6 +226,63 @@ task :sanitize do
|
|
|
226
226
|
sh(env, "#{FileUtils::RUBY} -S rspec")
|
|
227
227
|
end
|
|
228
228
|
|
|
229
|
+
# The randomised property checks in spec/invariants/. They are not *_spec.rb, so
|
|
230
|
+
# `rake spec` skips them; they run here and nightly in CI. Each takes
|
|
231
|
+
# [documents] [seed] [html|xml] and is deterministic, so a finding replays.
|
|
232
|
+
INVARIANT_CHECKS = [
|
|
233
|
+
["check_ns_reresolve.rb", %w[]],
|
|
234
|
+
["check_import_clone.rb", %w[]],
|
|
235
|
+
["check_tree_invariants.rb", %w[html xml]],
|
|
236
|
+
["check_index_staleness.rb", %w[html xml]],
|
|
237
|
+
["check_serialize_fixpoint.rb", %w[html xml]],
|
|
238
|
+
["check_text_input.rb", nil], # takes no count
|
|
239
|
+
].freeze
|
|
240
|
+
|
|
241
|
+
# [[script, argv], ...] for a given document count.
|
|
242
|
+
def invariant_runs(count)
|
|
243
|
+
INVARIANT_CHECKS.flat_map do |script, backends|
|
|
244
|
+
path = "spec/invariants/#{script}"
|
|
245
|
+
next [[path, []]] if backends.nil?
|
|
246
|
+
next [[path, [count.to_s]]] if backends.empty?
|
|
247
|
+
|
|
248
|
+
backends.map { |b| [path, [count.to_s, "20260911", b]] }
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
desc "Run the invariant checks (override the document count via INVARIANT_COUNT)"
|
|
253
|
+
task invariants: :compile do
|
|
254
|
+
count = (ENV["INVARIANT_COUNT"] || 2000).to_i
|
|
255
|
+
invariant_runs(count).each do |script, argv|
|
|
256
|
+
sh "#{FileUtils::RUBY} -Ilib #{script} #{argv.join(' ')}"
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
desc "Run the invariant checks under AddressSanitizer + UBSan (the text index " \
|
|
261
|
+
"holds borrowed slices, so staleness there is a memory bug too)"
|
|
262
|
+
task "invariants:sanitize" do
|
|
263
|
+
sanitize = ENV["MAKIRI_SANITIZE"] || "address,undefined"
|
|
264
|
+
sh({ "MAKIRI_SANITIZE" => sanitize }, "#{FileUtils::RUBY} -S rake clean compile")
|
|
265
|
+
|
|
266
|
+
env = {
|
|
267
|
+
"ASAN_OPTIONS" => "detect_leaks=0:detect_container_overflow=0:" \
|
|
268
|
+
"detect_odr_violation=0:abort_on_error=1:halt_on_error=1",
|
|
269
|
+
"UBSAN_OPTIONS" => "print_stacktrace=1:halt_on_error=1",
|
|
270
|
+
}
|
|
271
|
+
if sanitize.include?("address")
|
|
272
|
+
runtime = asan_runtime_path or
|
|
273
|
+
abort "invariants:sanitize: could not locate the ASan runtime for #{RbConfig::CONFIG['CC']}"
|
|
274
|
+
preload = RbConfig::CONFIG["target_os"] =~ /darwin/ ? "DYLD_INSERT_LIBRARIES" : "LD_PRELOAD"
|
|
275
|
+
env[preload] = runtime
|
|
276
|
+
puts "invariants:sanitize: preloading #{runtime} via #{preload}"
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Instrumented builds are slow; a smaller sweep still exercises every path.
|
|
280
|
+
count = (ENV["INVARIANT_COUNT"] || 500).to_i
|
|
281
|
+
invariant_runs(count).each do |script, argv|
|
|
282
|
+
sh(env, "#{FileUtils::RUBY} -Ilib #{script} #{argv.join(' ')}")
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
|
|
229
286
|
desc "Measure C coverage of OUR sources (clang source-based) over the spec suite. " \
|
|
230
287
|
"Prints an llvm-cov region+branch report (excludes vendored Lexbor) and writes " \
|
|
231
288
|
"a line-level detail file to tmp/coverage/show.txt."
|
data/lib/makiri/3.2/makiri.so
CHANGED
|
Binary file
|
data/lib/makiri/3.3/makiri.so
CHANGED
|
Binary file
|
data/lib/makiri/3.4/makiri.so
CHANGED
|
Binary file
|
data/lib/makiri/4.0/makiri.so
CHANGED
|
Binary file
|
data/lib/makiri/version.rb
CHANGED