Conversation
keremoge
marked this pull request as ready for review
October 2, 2026 12:43
keremoge
marked this pull request as draft
October 2, 2026 12:43
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
XML parsing can expose request data and bypass DTD checks, while SOAP handling has signature-ambiguity risks.
Review effort: Balanced
Findings: 2
Open (5)
Raw byte scan misses DTDs in non-ASCII XML encodings · New Multiple SOAP Body elements enable signature-wrapping ambiguity · New Unconditional SHA-1 warning floods logs on every request · New Malformed XML leaks request contents to stderr logs · New Client-supplied Security role can hide the generated signature · New
What changed in this PR
Adds XMLDSig and WS-Security request-signing plugins with shared XML, credential, algorithm, and request-processing utilities.
Changes:
- Implements XML and SOAP signing plugins.
- Adds installation, registration, schemas, and configuration.
- Adds bilingual documentation and signing tests.
| File | Description |
|---|---|
apisix/plugins/xml-signer.lua |
Defines the XML signer plugin. |
apisix/plugins/xml-signer/signer.lua |
Implements enveloped XML signatures. |
apisix/plugins/soap-signer.lua |
Defines the SOAP signer plugin. |
apisix/plugins/soap-signer/signer.lua |
Implements WS-Security signatures. |
apisix/plugins/signing/xml.lua |
Provides libxml2 utilities. |
apisix/plugins/signing/request.lua |
Handles request filtering and rewriting. |
apisix/plugins/signing/credentials.lua |
Loads and caches signing credentials. |
apisix/plugins/signing/algorithms.lua |
Defines supported algorithms. |
apisix/cli/config.lua |
Registers both plugins. |
conf/config.yaml.example |
Adds default plugin configuration. |
Makefile |
Installs new Lua modules. |
t/plugin/xml-signer.t |
Tests XML signing behavior. |
t/plugin/soap-signer.t |
Tests SOAP signing behavior. |
docs/en/latest/plugins/xml-signer.md |
Documents XML signing. |
docs/en/latest/plugins/soap-signer.md |
Documents SOAP signing. |
docs/zh/latest/plugins/xml-signer.md |
Adds Chinese XML documentation. |
docs/zh/latest/plugins/soap-signer.md |
Adds Chinese SOAP documentation. |
docs/en/latest/config.json |
Adds English navigation entries. |
docs/zh/latest/config.json |
Adds Chinese navigation entries. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+151
to
+153
| local upper = value:upper() | ||
| if upper:find("<!DOCTYPE", 1, true) or upper:find("<!ENTITY", 1, true) then | ||
| return nil, "DTD and entity declarations are not allowed" |
Comment on lines
+70
to
+73
| local body = xml.find_child(root, soap_namespace, "Body") | ||
| if not body then | ||
| return nil, "invalid_soap", "SOAP Body is required" | ||
| end |
Comment on lines
+70
to
+72
| if conf.signature.algorithm == "rsa-sha1" then | ||
| core.log.warn(plugin_name, " is using legacy SHA-1 cryptography") | ||
| end |
| return nil, "DTD and entity declarations are not allowed" | ||
| end | ||
|
|
||
| local doc = C.xmlReadMemory(value, #value, "document.xml", nil, XML_PARSE_NONET) |
Comment on lines
+297
to
+300
| envelope.security = xml.find_child(envelope.header, WSSE, "Security") | ||
| if not envelope.security then | ||
| envelope.security = xml.new_child(envelope.header, envelope.wsse_ns, "Security") | ||
| end |
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.


Description
Some upstream XML and SOAP services require signed request bodies. This PR adds APISIX plugins to apply those signatures before proxying requests.
xml-signerfor enveloped XML Digital Signatures.soap-signerfor WS-Security signatures on SOAP 1.1 and SOAP 1.2 requests.Checklist