Repository navigation
Commit f938273
authored
Support xmlsec1 1.3.13 and bundle it in all wheels (#435)
Fixes building and running python-xmlsec against xmlsec1 1.3.13 and bumps the
bundled xmlsec1 to 1.3.13 on all platforms (Linux, macOS, Windows). Closes #434.
## Backward-incompatible changes
xmlsec1 1.3.13 tightens several defaults. python-xmlsec follows the new library
defaults and does not restore the old behavior. Wheels bundle 1.3.13, so these
changes apply to everyone installing from wheels. Source builds behave
according to the libxmlsec1 version they link against.
### 1. Only empty and same-document reference URIs are allowed by default
`<dsig:Reference>` URIs are now limited to `URI=""` and `URI="#id"` by default.
Any other URI, e.g. `http://...`, `cid:...`, `file:///...` or a relative path
such as `other.xml`, makes `SignatureContext.sign()` / `verify()` raise
`xmlsec.Error`. This mostly affects code that resolves external references
through `xmlsec.register_callbacks`.
To opt in, set the new `SignatureContext.enabled_reference_uris` property:
ctx = xmlsec.SignatureContext()
ctx.enabled_reference_uris = (
xmlsec.constants.TransformUriTypeEmpty
| xmlsec.constants.TransformUriTypeSameDocument
| xmlsec.constants.TransformUriTypeRemote
) # or xmlsec.constants.TransformUriTypeAny
### 2. External URIs are rejected in encryption and KeyInfo processing
The same default (empty + same-document only) now applies to:
- `<enc:CipherReference URI="...">` when decrypting with `EncryptionContext.decrypt()`
- `<dsig:RetrievalMethod URI="...">` and `<dsig11:KeyInfoReference URI="...">` in `<dsig:KeyInfo>`
python-xmlsec does not expose a setting to widen these, so documents that rely
on external URIs here can no longer be processed. `EncryptionContext.encrypt_uri()`
is not affected: xmlsec1 allows the URI passed by the caller.
### 3. Other behavior changes inherited from xmlsec1 1.3.13
These come from the library itself and have no python-xmlsec setting:
- **Relationship transform** (OOXML / OPC signatures): several handling bugs
were fixed, so digests can differ from those produced by older versions.
- **PBKDF2**: iteration counts above 1,000,000 are rejected.
- **CBC decryption**: a padding length of zero is now rejected as invalid
padding.
- **Nested key depth**: the `<enc:EncryptedKey>` nesting limit (default 1)
now also counts `<enc11:DerivedKey>`, `<enc:AgreementMethod>` and
`<as:EncapsulationMechanism>`.
See the xmlsec1 1.3.13 release notes for the full list:
https://www.aleksey.com/xmlsec/news.html
## New API
- `SignatureContext.enabled_reference_uris` (read/write `int`): bitmask of
allowed `<dsig:Reference>` URI types. Raises `TypeError` for non-int or
`del`, `OverflowError` for negative values, `ValueError` for values above
`TransformUriTypeAny`.
- New constants: `xmlsec.constants.TransformUriTypeNone`, `TransformUriTypeEmpty`,
`TransformUriTypeSameDocument`, `TransformUriTypeLocal`, `TransformUriTypeRemote`,
`TransformUriTypeAny`.
## Compatibility fixes for xmlsec1 1.3.13
- Build: include `<xmlsec/dl.h>` explicitly. 1.3.13 no longer includes it
transitively.
- `xmlsec.init()` called after import no longer fails. 1.3.13 rejects a
second `xmlSecInit()` without a shutdown in between.
- Encrypting with an `<enc:EncryptedKey>` keeps lax key lookup for the key
encryption key. 1.3.13 stopped copying the lax-search flag into the nested
context that encrypts the session key.
## Build and packaging
- Bundled xmlsec1 1.3.12 → 1.3.13 on Linux/macOS (`build_support`, `cache_libs`
workflow) and Windows (win-binaries release `2026.10.28`).
- Static xmlsec1 builds are configured with `--disable-apps` (1.3.13's fuzz
targets fail to build against a private libxslt prefix) and `--with-pic`
(1.3.13's hardening flags otherwise produce non-PIC objects that can't be
linked into the extension module).
## Docs and tests
- Documented the new constants and `enabled_reference_uris`.
- Added tests for `enabled_reference_uris`. The `register_callbacks` test now
opts into all URI types.1 parent 99f8855 commit f938273
11 files changed
Lines changed: 123 additions & 4 deletions
File tree
- .github/workflows
- build_support
- doc/source/modules
- src
- xmlsec
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| 393 | + | |
| 394 | + | |
393 | 395 | | |
394 | 396 | | |
395 | 397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
295 | 320 | | |
296 | 321 | | |
297 | 322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
285 | 292 | | |
286 | 293 | | |
287 | 294 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
520 | 554 | | |
521 | 555 | | |
522 | 556 | | |
| |||
525 | 559 | | |
526 | 560 | | |
527 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
528 | 569 | | |
529 | 570 | | |
530 | 571 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
65 | 76 | | |
66 | 77 | | |
67 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
42 | 59 | | |
43 | 60 | | |
44 | 61 | | |
| |||
0 commit comments