Add documentation for PGP under Cryptography Module - #2379
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughSummary
WalkthroughAdded Cryptography Module overview, reference, and example documentation. Added Bash and PowerShell scripts for isolated GnuPG keyring setup and key export. Documented OpenPGP connections, key sources, six operations, parameters, results, and errors. Added file-based examples for purchase-order encryption, product-catalog signing, and invoice sign-and-encrypt processing. Added module navigation entries. Sequence Diagram(s)sequenceDiagram
participant FileConnection
participant EncryptListener
participant pgpEncrypt
participant DecryptListener
participant pgpDecrypt
FileConnection->>EncryptListener: Poll purchase order
EncryptListener->>pgpEncrypt: Encrypt for Bob
pgpEncrypt->>FileConnection: Write encrypted file
FileConnection->>DecryptListener: Poll encrypted file
DecryptListener->>pgpDecrypt: Decrypt with Bob private key
pgpDecrypt->>FileConnection: Write recovered file
sequenceDiagram
participant InvoiceSender
participant pgpSignAndEncrypt
participant FileConnection
participant InvoiceReceiver
participant pgpDecryptAndVerify
InvoiceSender->>pgpSignAndEncrypt: Sign and encrypt invoice
pgpSignAndEncrypt->>FileConnection: Write sealed invoice
FileConnection->>InvoiceReceiver: Poll sealed invoice
InvoiceReceiver->>pgpDecryptAndVerify: Decrypt and verify
pgpDecryptAndVerify->>InvoiceReceiver: Return content and signature result
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (1)
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md (1)
30-36: 🩺 Stability & Availability | 🔵 TrivialWarn that
ActionAfterFailure=DELETEis demo-only.Every scenario deletes the source file after a failure. Add a production note and recommend retaining or moving failed files. A cryptography or write error otherwise removes the only input copy.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md` around lines 30 - 36, Add a production warning near the “Every scenario uses” description stating that ActionAfterFailure=DELETE is for this demo only, and recommend retaining or moving failed source files in production to preserve the input after cryptography or write errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-config.md`:
- Around line 49-53: Update the storage guidance in
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-config.md:49-53
to restrict resources: to public or disposable demo keys and direct private keys
to protected sources such as env:NAME or Secure Vault. Update the setup
instructions in
en/docs/assets/attachments/module/pgp/cryptography-setup.ps1:6-8, 41-43, 50-50
and en/docs/assets/attachments/module/pgp/cryptography-setup.sh:8-10, 46-47,
49-50, 57-57 so they no longer add the four exported private .asc files to
resources/keys and instead use protected secret storage. Apply the same
correction to the example instructions in
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md:165-169.
In
`@en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md`:
- Around line 304-310: Update the instructions around the Bob private-key
connection to clarify that bob-private.asc contains only key material; state
that the PGP_PRIVATE_KEY connection supplies the Secure Vault passphrase, and
remove the claim that the file carries that passphrase.
- Line 358: Normalize all connection-name references throughout the cryptography
module example to one consistent naming scheme: alice-private-key,
alice-public-key, bob-public-key, and bob-private-key. Update the prose and XML
elements, including the encryptionConfigKey occurrences, while preserving the
example’s existing meaning and structure.
- Around line 43-56: Correct the “Input Type” guidance in the “How input and
output are decided” section: describe inputType as controlling outbound data,
and state that inbound decryption and verification auto-detect OpenPGP input and
use outputType for the recovered representation. Align the wording with the
module reference while preserving the existing Input Source and ASCII Armor
guidance.
- Around line 689-696: Update the pgpSignAndEncrypt example around
responseVariable cryptography_pgpSignAndEncrypt_1 so the output filename
extension matches armor=false: change the invoice output and corresponding
documented path from .asc to .gpg or .pgp, while preserving the existing
binary-output configuration.
In
`@en/docs/reference/connectors/cryptography-module/cryptography-module-overview.md`:
- Around line 16-19: Update the operation descriptions for pgpDecrypt and
pgpSign to use the correct private-key roles: pgpDecrypt uses the receiver’s
private key and passphrase, while pgpSign uses the sender’s private key. Leave
the pgpEncrypt and pgpVerify descriptions unchanged.
- Line 41: Update the “Cryptography Module Github Repository” link in the
cryptography module overview to target the repository root instead of the pull
request URL, and change the label spelling to “GitHub” while preserving the
existing link text and Markdown format.
---
Nitpick comments:
In
`@en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md`:
- Around line 30-36: Add a production warning near the “Every scenario uses”
description stating that ActionAfterFailure=DELETE is for this demo only, and
recommend retaining or moving failed source files in production to preserve the
input after cryptography or write errors.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: eacdfbd5-400c-4ecc-925c-07c59772af7b
⛔ Files ignored due to path filters (25)
en/docs/assets/img/integrate/connectors/cryptography/pgp/PGP_Keys_store.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/add_bob_private_key.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/add_bob_public_key.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/add_encrypt_operation.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/add_file_exchange_connection.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/add_file_write_operation.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/add_new_key_pgp_private.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/add_new_local_file_connection.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/add_new_public_key_click.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/add_pgp_decrypt_operation.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/create_project.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/file_write_select.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/invoice_inbound_listener_flow.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/invoice_outbound_listener_flow.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/pgp_encrypt_select.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/pgp_search.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/price_catalog_consumer_listener_flow.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/price_catalog_publisher_listener_flow.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/purchase_order_decrypt_inbound.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/purchase_order_encrypt_inbound.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/purchase_order_inbound_listener_flow.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/purchase_order_outbound_listener_flow.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/scenario_1_flow.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/scenario_2_flow.pngis excluded by!**/*.pngen/docs/assets/img/integrate/connectors/cryptography/pgp/scenario_3_flow.pngis excluded by!**/*.png
📒 Files selected for processing (6)
en/docs/assets/attachments/module/pgp/cryptography-setup.ps1en/docs/assets/attachments/module/pgp/cryptography-setup.shen/docs/reference/connectors/cryptography-module/1.x/cryptography-module-config.mden/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.mden/docs/reference/connectors/cryptography-module/cryptography-module-overview.mden/mkdocs.yml
| <tr><td><code>resources:keys/alice-private.asc</code></td><td>Project registry resource, bundled in the integration project.</td><td><strong>Recommended</strong> — versioned with the project.</td></tr> | ||
| <tr><td><code>env:NAME</code></td><td>Environment variable holding the key material.</td><td>Containers / Kubernetes Secrets.</td></tr> | ||
| <tr><td><code>-----BEGIN PGP…</code></td><td>Key text pasted inline (armored).</td><td>Quick tests.</td></tr> | ||
| <tr><td><code>/path/to/key.asc</code></td><td>Filesystem path.</td><td>On-box files.</td></tr> | ||
| <tr><td><code>gov:/…</code>, <code>conf:/…</code></td><td>WSO2 Registry (legacy syntax).</td><td>Older deployments; still supported.</td></tr> |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
files=(
"en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-config.md"
"en/docs/assets/attachments/module/pgp/cryptography-setup.ps1"
"en/docs/assets/attachments/module/pgp/cryptography-setup.sh"
"en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md"
)
printf '== files present ==\n'
for f in "${files[@]}"; do
if [ -f "$f" ]; then
printf '%s\n' "$f"
else
printf 'MISSING: %s\n' "$f"
fi
done
printf '\n== target sections ==\n'
for f in "${files[@]}"; do
[ -f "$f" ] || continue
printf '\n--- %s ---\n' "$f"
wc -l "$f"
case "$f" in
*cryptography-module-config.md) sed -n '35,65p' "$f" ;;
*cryptography-setup.ps1) sed -n '1,60p' "$f" ;;
*cryptography-setup.sh) sed -n '1,70p' "$f" ;;
*cryptography-module-example.md) sed -n '155,175p' "$f" ;;
esac
done
printf '\n== resource key references around targets ==\n'
rg -n "resources:keys|alice-private|bob-private|export-secret-keys|keyIdentifier|Key Identifier|key material|Resources" "${files[@]}"Repository: wso2/docs-mi
Length of output: 17548
Security Misconfiguration (CWE-922)
Reachability: External
Keep private key material out of project resources.
Apply the same storage rule across the referenced files: use resources: only for public or disposable demo keys, and place private keys in protected secret sources such as env:NAME/Secure Vault. Update the setup scripts and example instructions that currently say to add the four exported .asc files to resources/keys.
📍 Affects 4 files
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-config.md#L49-L53(this comment)en/docs/assets/attachments/module/pgp/cryptography-setup.ps1#L6-L8en/docs/assets/attachments/module/pgp/cryptography-setup.ps1#L41-L43en/docs/assets/attachments/module/pgp/cryptography-setup.ps1#L50-L50en/docs/assets/attachments/module/pgp/cryptography-setup.sh#L8-L10en/docs/assets/attachments/module/pgp/cryptography-setup.sh#L46-L47en/docs/assets/attachments/module/pgp/cryptography-setup.sh#L49-L50en/docs/assets/attachments/module/pgp/cryptography-setup.sh#L57-L57en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md#L165-L169
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-config.md`
around lines 49 - 53, Update the storage guidance in
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-config.md:49-53
to restrict resources: to public or disposable demo keys and direct private keys
to protected sources such as env:NAME or Secure Vault. Update the setup
instructions in
en/docs/assets/attachments/module/pgp/cryptography-setup.ps1:6-8, 41-43, 50-50
and en/docs/assets/attachments/module/pgp/cryptography-setup.sh:8-10, 46-47,
49-50, 57-57 so they no longer add the four exported private .asc files to
resources/keys and instead use protected secret storage. Apply the same
correction to the example instructions in
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md:165-169.
| !!! tip "How input and output are decided" | ||
| Each PGP operation is governed by three configuration choices: | ||
|
|
||
| 1. **Input Type** — how to interpret the data on the receiving side (decryption/verification): | ||
| - **BINARY** (default) — read as raw bytes | ||
| - **TEXT** — read as a text string | ||
|
|
||
| 2. **Input Source** — where the data comes from: | ||
| - **Message Body** (default) — the raw payload | ||
| - **Expression** — a custom source specified via `sourceContent` | ||
|
|
||
| 3. **ASCII Armor** — controls the output format of encrypted/signed content: | ||
| - **FALSE** (default) — binary format, save as `.gpg` or `.pgp` | ||
| - **TRUE** — text format, save as `.asc` |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Correct the receiving-side input guidance.
inputType applies to outbound operations. Inbound decryption and verification auto-detect the OpenPGP input and use outputType for the recovered representation. Align this section with the module reference.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md`
around lines 43 - 56, Correct the “Input Type” guidance in the “How input and
output are decided” section: describe inputType as controlling outbound data,
and state that inbound decryption and verification auto-detect OpenPGP input and
use outputType for the recovered representation. Align the wording with the
module reference while preserving the existing Input Source and ASCII Armor
guidance.
| 3. **Add Bob's private key as the decryption key** — click **+ Add new key**. | ||
|
|
||
| <img src="{{base_path}}/assets/img/integrate/connectors/cryptography/pgp/add_new_key_pgp_private.png" title="Add a new PGP private key" width="800" alt="Adding a new PGP private key connection"/> | ||
|
|
||
| Then select the private key type as `PGP_PRIVATE_KEY` and point it at Bob's private key (`bob-private.asc`, which carries the Secure Vault passphrase). | ||
|
|
||
| <img src="{{base_path}}/assets/img/integrate/connectors/cryptography/pgp/add_bob_private_key.png" title="Bob's private key connection" width="800" alt="Configuring Bob's private key connection"/> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Associate the passphrase with the connection.
bob-private.asc contains key material. It does not carry the Secure Vault value. State that the PGP_PRIVATE_KEY connection supplies the passphrase.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md`
around lines 304 - 310, Update the instructions around the Bob private-key
connection to clarify that bob-private.asc contains only key material; state
that the PGP_PRIVATE_KEY connection supplies the Secure Vault passphrase, and
remove the claim that the file carries that passphrase.
| <cryptography.pgpEncrypt> | ||
| <inputSource>Message Body</inputSource> | ||
| <inputType>BINARY</inputType> | ||
| <encryptionConfigKey>Bob-public-key</encryptionConfigKey> |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Use consistent connection names throughout the example.
The prose and XML alternate between alice-private, alice-private-key, alice-public, alice-public-key, and Bob-*/bob-*. Normalize all references, for example to alice-private-key, alice-public-key, bob-public-key, and bob-private-key.
Also applies to: 411-411, 464-468, 512-512, 566-566, 634-640, 684-685, 742-743
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md`
at line 358, Normalize all connection-name references throughout the
cryptography module example to one consistent naming scheme: alice-private-key,
alice-public-key, bob-public-key, and bob-private-key. Update the prose and XML
elements, including the encryptionConfigKey occurrences, while preserving the
example’s existing meaning and structure.
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end documentation for a new Cryptography (PGP) Module in the WSO2 MI docs, including navigation entries, an overview, a detailed configuration reference, a step-by-step example, and setup scripts for generating demo PGP keys.
Changes:
- Adds MkDocs navigation entries for the Cryptography (PGP) Module docs (overview, 1.x example, 1.x reference).
- Introduces new documentation pages: module overview, configuration/operation reference, and a multi-scenario B2B file-exchange walkthrough.
- Adds helper scripts (
.shand.ps1) to generate and export the demo key material used in the examples.
Reviewed changes
Copilot reviewed 6 out of 31 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| en/mkdocs.yml | Adds nav entries for the new Cryptography (PGP) Module docs. |
| en/docs/reference/connectors/cryptography-module/cryptography-module-overview.md | New overview page describing the module, operations, compatibility, and contribution link. |
| en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md | New multi-scenario walkthrough showing encrypt/decrypt, sign/verify, and sign+encrypt/decrypt+verify flows. |
| en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-config.md | New reference covering connections, shared I/O model, all operations, and error codes. |
| en/docs/assets/attachments/module/pgp/cryptography-setup.sh | Bash script to generate/export demo keys for the examples. |
| en/docs/assets/attachments/module/pgp/cryptography-setup.ps1 | PowerShell script to generate/export demo keys for the examples. |
Suppressed comments (7)
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md:388
- This FileURI example includes a user-specific local path (
C:/Users/AmilaSW/...). Consider using a generic placeholder path consistent with the rest of the guide.
<parameter name="transport.vfs.FileURI">C:/Users/AmilaSW/Documents/FileExchange/exchange</parameter>
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md:489
- This FileURI example includes a user-specific local path (
C:/Users/AmilaSW/...). Consider using a generic placeholder path consistent with the rest of the guide.
<parameter name="transport.vfs.FileURI">C:/Users/AmilaSW/Documents/FileExchange/publish</parameter>
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md:543
- This FileURI example includes a user-specific local path (
C:/Users/AmilaSW/...). Consider using a generic placeholder path consistent with the rest of the guide.
<parameter name="transport.vfs.FileURI">C:/Users/AmilaSW/Documents/FileExchange/consume</parameter>
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md:661
- This FileURI example includes a user-specific local path (
C:/Users/AmilaSW/...). Consider using a generic placeholder path consistent with the rest of the guide.
<parameter name="transport.vfs.FileURI">C:/Users/AmilaSW/Documents/FileExchange/secure</parameter>
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md:718
- This FileURI example includes a user-specific local path (
C:/Users/AmilaSW/...). Consider using a generic placeholder path consistent with the rest of the guide.
<parameter name="transport.vfs.FileURI">C:/Users/AmilaSW/Documents/FileExchange/open</parameter>
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md:769
- This step references
open/invoice.asc, but the Synapse snippet above usesarmor=false(binary output). If you keeparmor=false, the narrative should reference the.pgp(or similar) filename to match the actual output format.
- The outbound listener signs and encrypts it to `open/invoice.asc`.
- Then inbound listener then decrypts and verifies it — there is **no file write on the receiver side** for this scenario instead it logs decrypted content/throws an error based on verification reults.
en/docs/reference/connectors/cryptography-module/1.x/cryptography-module-example.md:613
- The business scenario text says Global Electronics sends the invoice to ABC Retail, but the steps/config below have Alice signing and encrypting to Bob's public key (i.e., Alice is the sender and Bob is the recipient). Align the narrative with the scenario’s key roles so readers don’t invert who should sign/encrypt vs decrypt/verify.
negotiated pricing, payment amounts, and banking information, so it must satisfy three security
requirements at once: **only ABC Retail can read it**, **ABC Retail knows it came from Global
Electronics**, and **ABC Retail knows it was not modified**. Alice **signs** the invoice with her
private key, then it is **encrypted** with Bob's public key. Bob **decrypts** it with his private
key and **verifies** Alice's signature before forwarding it to the finance system.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Purpose
Adds end-to-end documentation for the Cryptography (PGP) Module — overview, configuration reference, and a hands-on example.
What's included
1.x) — PGP key connections (PGP_PRIVATE_KEY/PGP_PUBLIC_KEY), key-material sources, the shared input/output model (inputSource/inputType/armor/outputType), all six operations with parameters, defaults, and result attributes, plus error codes.1.x) — three B2B file-exchange scenarios sharing one cast and key set:pgpEncrypt→pgpDecrypt)pgpSign→pgpVerify)pgpSignAndEncrypt→pgpDecryptAndVerify)Each driven by File Inbound Endpoints + the File Connector, with step-by-step build screenshots, per-listener flow images, and sender/receiver synapse configs in collapsible Inbound Endpoint / Inbound Sequence tabs.
cryptography-setup.sh/.ps1to generate and export the demo keys.