Skip to content

Commit 86145ec

Browse files
committed
docs(audit): complete xml linq review
1 parent afc48df commit 86145ec

43 files changed

Lines changed: 898 additions & 23 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NEXT.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ Historical session detail belongs in git history and `plan.sqlite3`.
2626
`Socket::Socket: socket() failed`; this matches the documented requirement
2727
for local-network permission. The tests remain enabled and need a
2828
network-permitted final-gate rerun.
29-
- The first 1,368 audit reports confirm three hundred thirty-two findings. The newly complete
30-
50-file `Security.Cryptography` shard passed 80/80 focused tests and adds SR-AUD-331 through
31-
SR-AUD-332: `Rfc2898DeriveBytes` inherits a no-op `Dispose` and continues PBKDF2 derivation;
32-
HMAC clears direct key storage but retains invertible inner/outer pads. The preceding 43-file
33-
`Text.Json` shard passed 147/147 and adds SR-AUD-324 through SR-AUD-330, including an
34-
ASan-confirmed dangling JsonNode parent pointer. Earlier work
29+
- The first 1,406 audit reports confirm three hundred thirty-six findings. The newly complete
30+
38-file `Xml.Linq` shard passed 92/92 focused tests and adds SR-AUD-333 through SR-AUD-336:
31+
retained children dereference an ASan-confirmed dangling raw parent; namespaces are lost in
32+
parse/save; special XML lexical delimiters corrupt output; and registered XObject events never
33+
notify. The preceding 50-file `Security.Cryptography` shard passed 80/80 and adds
34+
SR-AUD-331 through SR-AUD-332. Earlier work
3535
confirms that tracked CI omits the
3636
direct `Collections.Blocking` selective fixture; the boundary validator has
3737
narrow negative-fixture coverage; `BlockingCollection<T>` has a

audit/AUDIT_FINDINGS_INDEX.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ identifier (`SR-AUD-###`), severity, status, and concise remediation target.
338338
| [SR-AUD-330](modules/text-json/include/System/Text/Json/JsonSerializer.hpp.audit.md#sr-aud-330--medium--jsonserializer-deserialize-ignores-its-jsonserializeroptions-argument) | medium | confirmed | `JsonSerializer.hpp`, `JsonSerializerOptions.hpp`, `JsonSerializationTests.cpp` | Both Deserialize overloads discard options, so configured parse controls such as trailing commas, comments, depth, and duplicate policy have no effect. |
339339
| [SR-AUD-331](modules/security-cryptography/include/System/Security/Cryptography/Rfc2898DeriveBytes.hpp.audit.md#sr-aud-331--high--rfc2898derivebytesdispose-is-inherited-as-a-no-op-and-permits-post-disposal-derivation) | high | confirmed | `DeriveBytes.hpp`, `Rfc2898DeriveBytes.hpp`, `Rfc2898DeriveBytes.cpp`, `HashAlgorithmTests.cpp` | Rfc2898DeriveBytes inherits an empty Dispose, retains password/salt/buffer state, and continues real PBKDF2 derivation after disposal; current .NET disposes its HMAC and clears sensitive state. |
340340
| [SR-AUD-332](modules/security-cryptography/include/System/Security/Cryptography/HMAC.hpp.audit.md#sr-aud-332--high--hmac-disposal-leaves-invertible-key-derived-pads-resident) | high | confirmed | `HMAC.hpp`, `HMAC.cpp`, `KeyedHashAlgorithm.hpp`, `HashAlgorithmTests.cpp` | Dispose clears direct key storage but leaves inner/outer pads sized and invertible; the audit probe reconstructs the original HMAC key after disposal. |
341+
| [SR-AUD-333](modules/xml-linq/include/System/Xml/Linq/XObject.hpp.audit.md#sr-aud-333--high--retained-xmllinq-children-dereference-a-destroyed-raw-parent) | high | confirmed | `XObject.hpp`, `XObject.cpp`, `XNode.cpp`, `XContainer.cpp`, `Extensions.hpp`, `XLinqNodeTests.cpp` | A public shared_ptr child outlives its shared_ptr-owned parent while retaining a raw parent pointer; ASan confirms heap-use-after-free at getParentProperty. |
342+
| [SR-AUD-334](modules/xml-linq/include/System/Xml/Linq/XElement.hpp.audit.md#sr-aud-334--medium--namespace-uri-semantics-are-discarded-by-xmllinq-parse-and-serialization) | medium | confirmed | `XName.hpp`, `XNamespace.hpp`, `XElement.hpp/.cpp`, `XDocument.cpp`, `XLinqSupportTests.cpp` | Parsed prefix text never resolves to an XName URI and writer paths emit only local names; a namespaced programmatic tree serializes/reparses as unqualified XML. |
343+
| [SR-AUD-335](modules/xml-linq/include/System/Xml/Linq/XCData.hpp.audit.md#sr-aud-335--medium--direct-serializers-emit-or-corrupt-xml-special-lexical-content) | medium | confirmed | `XCData`, `XComment`, `XProcessingInstruction` headers/sources, `XLinqNodeTests.cpp` | CDATA ]]>, comment --, and PI ?> lexical delimiters are emitted without splitting, escaping, or diagnostics; a CDATA round trip loses data. |
344+
| [SR-AUD-336](modules/xml-linq/include/System/Xml/Linq/XObject.hpp.audit.md#sr-aud-336--medium--changed-and-changing-accept-handlers-but-never-notify-mutations) | medium | confirmed | `XObject.hpp`, `XObjectChange*`, mutation APIs, `XLinqNodeTests.cpp` | Event registration discards handlers; direct mutation leaves a registered Changed callback uninvoked and tests only assert no throw. |
341345

342346
Severity is assessed by reachable impact: **critical** (data loss, security,
343347
or systemic integrity), **high** (crash, corruption, major contract break),

audit/AUDIT_MANIFEST.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ mirrored report exists and contains evidence rather than a boilerplate verdict.
1414
| Consumer fixtures and validator tests | 16 | 16 | AUDITED |
1515
| Integration tests | 7 | 7 | AUDITED |
1616
| Benchmarks | 1 | 1 | AUDITED |
17-
| 41 runtime modules (source, headers, tests, module docs/CMake) | 1,699 | 1,319 | IN PROGRESS |
18-
| **Total** | **1,748** | **1,368** | **IN PROGRESS** |
17+
| 41 runtime modules (source, headers, tests, module docs/CMake) | 1,699 | 1,357 | IN PROGRESS |
18+
| **Total** | **1,748** | **1,406** | **IN PROGRESS** |
1919

2020
The module shard is processed in dependency/risk order rather than directory
2121
order: component boundaries and `Core.Base` first, then collections, IO/text,

audit/AUDIT_PROGRESS.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
- Scope frozen from a clean `feature/work` source checkout; audit artifacts
77
are the only expected working-tree changes.
88
- Eligible files: 1,748. Excluded tracked files: 33.
9-
- Completed per-file reports: 1,368 (78.3% of eligible scope; 1,319/1,699 runtime-module files).
10-
- Confirmed findings: 332 (eighty-three high, two hundred thirty-eight medium, eleven low). Open risks: 2 documented-adaptation questions. Blocked reviews: 2 environment-limited validation runs.
9+
- Completed per-file reports: 1,406 (80.4% of eligible scope; 1,357/1,699 runtime-module files).
10+
- Confirmed findings: 336 (eighty-four high, two hundred forty-one medium, eleven low). Open risks: 2 documented-adaptation questions. Blocked reviews: 2 environment-limited validation runs.
1111

1212
## Initial validation evidence
1313

@@ -40,12 +40,12 @@ the full gate during final audit reconciliation.
4040

4141
## Latest checkpoint
4242

43-
The complete 50-file `Security.Cryptography` shard is mirrored. Its focused
44-
target passed 80/80. Direct probes confirm SR-AUD-331 and SR-AUD-332: PBKDF2
45-
inherits a no-op `Dispose`, continuing to derive bytes and retain state, while
46-
HMAC disposal clears only its direct key and leaves invertible inner/outer pads
47-
resident. The preceding 43-file `Text.Json` target passed 147/147. Audit-only:
48-
no production or test source was changed.
43+
The complete 38-file `Xml.Linq` shard is mirrored. Its focused target passed
44+
92/92. Direct probes confirm SR-AUD-333 through SR-AUD-336: retained children
45+
use an ASan-confirmed dangling raw parent; namespace URI identity is lost in
46+
parse/save; lexical CDATA/comment/PI delimiters corrupt or emit invalid XML;
47+
and XObject events accept handlers but never notify. Audit-only: no production
48+
or test source was changed.
4949

5050
## Resume point
5151

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Audit: `modules/xml-linq/CMakeLists.txt`
2+
3+
## Metadata
4+
5+
- Audit status: AUDITED.
6+
- Component: `Xml.Linq`.
7+
- Validation: `SharpRuntimeTests_Xml_Linq` built and passed 92/92 on 2026-07-27.
8+
- Direct evidence: `/tmp/sharp-runtime-xml-linq-audit/xml_linq_probe`; SR-AUD-333 was rebuilt with ASan/UBSan against Xml.Linq sources.
9+
10+
## Assessment
11+
12+
The static module declares the documented Core.Base and Xml public dependencies; no dependency-boundary divergence was found.
13+
14+
## Missing assertions and diagnostics
15+
16+
Keep a selective consumer closure build for Xml.Linq in CI.
17+
18+
## Final assessment
19+
20+
AUDITED; component-scoped evidence and confirmed findings are recorded in the audit index.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Audit: `modules/xml-linq/README.md`
2+
3+
## Metadata
4+
5+
- Audit status: AUDITED.
6+
- Component: `Xml.Linq`.
7+
- Validation: `SharpRuntimeTests_Xml_Linq` built and passed 92/92 on 2026-07-27.
8+
- Direct evidence: `/tmp/sharp-runtime-xml-linq-audit/xml_linq_probe`; SR-AUD-333 was rebuilt with ASan/UBSan against Xml.Linq sources.
9+
10+
## Assessment
11+
12+
The README correctly describes the compiled Xml.Linq component and its dependencies.
13+
14+
## Missing assertions and diagnostics
15+
16+
Document the confirmed raw-parent lifetime, namespace, lexical-serialization, and event limitations when remediation is planned.
17+
18+
## Final assessment
19+
20+
AUDITED; component-scoped evidence and confirmed findings are recorded in the audit index.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Audit: `modules/xml-linq/include/System/Xml/Linq/Extensions.hpp`
2+
3+
## Metadata
4+
5+
- Audit status: AUDITED.
6+
- Component: `Xml.Linq`.
7+
- Validation: `SharpRuntimeTests_Xml_Linq` built and passed 92/92 on 2026-07-27.
8+
- Direct evidence: `/tmp/sharp-runtime-xml-linq-audit/xml_linq_probe`; SR-AUD-333 was rebuilt with ASan/UBSan against Xml.Linq sources.
9+
10+
## Assessment
11+
12+
This hierarchy path follows the raw parent pointer declared by XObject.
13+
Retained children can outlive their shared_ptr-owned parent; ASan confirms
14+
SR-AUD-333 at the first parent query. Sibling navigation, mutation,
15+
document-order comparison, and extension ancestor traversal share the same
16+
unsafe ownership assumption.
17+
18+
## Missing assertions and diagnostics
19+
20+
Add post-parent-destruction ASan regressions for this operation, not only
21+
normal attached-tree behavior.
22+
23+
## Final assessment
24+
25+
AUDITED; SR-AUD-333 applies to this raw-parent traversal path.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Audit: `modules/xml-linq/include/System/Xml/Linq/LoadOptions.hpp`
2+
3+
## Metadata
4+
5+
- Audit status: AUDITED.
6+
- Component: `Xml.Linq`.
7+
- Validation: `SharpRuntimeTests_Xml_Linq` built and passed 92/92 on 2026-07-27.
8+
- Direct evidence: `/tmp/sharp-runtime-xml-linq-audit/xml_linq_probe`; SR-AUD-333 was rebuilt with ASan/UBSan against Xml.Linq sources.
9+
10+
## Assessment
11+
12+
The option enum values and bitwise operators match their documented values; several corresponding consumers are intentionally absent or no-op.
13+
14+
## Missing assertions and diagnostics
15+
16+
Add behavior tests for every accepted option, especially namespace output and load metadata, not only integer flag values.
17+
18+
## Final assessment
19+
20+
AUDITED; component-scoped evidence and confirmed findings are recorded in the audit index.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Audit: `modules/xml-linq/include/System/Xml/Linq/ReaderOptions.hpp`
2+
3+
## Metadata
4+
5+
- Audit status: AUDITED.
6+
- Component: `Xml.Linq`.
7+
- Validation: `SharpRuntimeTests_Xml_Linq` built and passed 92/92 on 2026-07-27.
8+
- Direct evidence: `/tmp/sharp-runtime-xml-linq-audit/xml_linq_probe`; SR-AUD-333 was rebuilt with ASan/UBSan against Xml.Linq sources.
9+
10+
## Assessment
11+
12+
The option enum values and bitwise operators match their documented values; several corresponding consumers are intentionally absent or no-op.
13+
14+
## Missing assertions and diagnostics
15+
16+
Add behavior tests for every accepted option, especially namespace output and load metadata, not only integer flag values.
17+
18+
## Final assessment
19+
20+
AUDITED; component-scoped evidence and confirmed findings are recorded in the audit index.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Audit: `modules/xml-linq/include/System/Xml/Linq/SaveOptions.hpp`
2+
3+
## Metadata
4+
5+
- Audit status: AUDITED.
6+
- Component: `Xml.Linq`.
7+
- Validation: `SharpRuntimeTests_Xml_Linq` built and passed 92/92 on 2026-07-27.
8+
- Direct evidence: `/tmp/sharp-runtime-xml-linq-audit/xml_linq_probe`; SR-AUD-333 was rebuilt with ASan/UBSan against Xml.Linq sources.
9+
10+
## Assessment
11+
12+
The option enum values and bitwise operators match their documented values; several corresponding consumers are intentionally absent or no-op.
13+
14+
## Missing assertions and diagnostics
15+
16+
Add behavior tests for every accepted option, especially namespace output and load metadata, not only integer flag values.
17+
18+
## Final assessment
19+
20+
AUDITED; component-scoped evidence and confirmed findings are recorded in the audit index.

0 commit comments

Comments
 (0)