Conversation
|
👋 Hi — I'm PR Bot, your SAP code review assistant. I'll automatically review your pull requests for code quality, security, and SAP compliance. Get an overview of what I do → What I do
Key commands
*This introduction message will be shown to you only once, you will not see it in future PRs. |
SummaryThe following content is AI-generated and provides a summary of the pull request: Make n8n Webhook Authentication ConfigurableNew Features✨ Adds opt-in, configurable webhook authentication via This also fixes the previous behavior of forwarding Changes
PR Bot InformationVersion:
|
There was a problem hiding this comment.
We are aware of this problem and are working to improve it. Try /review+ to use the beta review engine. Try to limit the pull request's size.
PR Bot Information
Version: 1.31.51
- LLM:
gpt-5.5 - File Content Strategy: Full file content
- Correlation ID:
832519e0-b82a-11f1-8654-3d6a5570a176 - Event Trigger:
pull_request.opened
| * </ul> | ||
| */ | ||
| static Map<String, String> resolveWebhookAuthHeaders(N8nProperties.WebhookAuth auth) { | ||
| if (auth == null || auth.getType() == null) return Collections.emptyMap(); |
There was a problem hiding this comment.
Bug: Blank webhook auth values are accepted
The resolver only treats null as missing, so common optional placeholders like ${N8N_WEBHOOK_TOKEN:} bind to empty strings and produce invalid auth headers instead of failing at startup. Consider normalizing type and rejecting blank required fields (username, password, name, value, token) with isBlank() before constructing headers.
| if (auth == null || auth.getType() == null) return Collections.emptyMap(); | |
| if (auth == null || auth.getType() == null || auth.getType().isBlank()) return Collections.emptyMap(); |
Double-check suggestion before committing. Edit this comment for amendments.
Please provide feedback on the review comment by checking the appropriate box:
- 🌟 Awesome comment, a human might have missed that.
- ✅ Helpful comment
- 🤷 Neutral
- ❌ This comment is not helpful
Make webhook authentication configurable
Previously the plugin forwarded
X-N8N-API-KEYon every outbound webhook call. This was semantically wrong —X-N8N-API-KEYis an n8n REST API credential, not a webhook credential — and it hardcoded the header name, preventing workflows from using their own auth configuration.What changed
Webhook auth is now opt-in and configured via
n8n.webhook-auth.*:The three supported types mirror n8n's Webhook node auth options:
typebasicusername,passwordAuthorization: Basic base64(username:password)headername,value<name>: <value>bearertokenAuthorization: Bearer <token>When
n8n.webhook-authis absent, webhook calls are sent without authentication.n8n.api-keyis kept in the config model for future REST API (/api/v1/…) use but is no longer forwarded to webhook nodes.BTP destination path is unchanged in behaviour: destination headers are forwarded (minus
X-N8N-API-KEY), withn8n.webhook-authmerged on top.Files changed
N8nWebhookService— removedapiKeyfield; constructor now takesMap<String, String> authHeadersN8nAutoConfiguration— addedWebhookAuthnested config class andresolveWebhookAuthHeaders()static helper; updated both bean factories (n8nWebhookServiceandn8nWebhookServiceFromDestination)ConsoleN8NWebhookService— updatedsuper(...)call to match new constructorN8nAutoConfigurationTest— 9 new tests covering all auth types, missing-field errors, and unsupported typeN8nWebhookServiceRetryIT— updated constructor calln8n.api-keyconfig and allX-N8N-API-KEYheader assertionssamples/bookshop/application.yaml— added commented-outwebhook-authexampledocs/adr-webhook-authentication.md— updated to V0.2; documents new decision, preserves V0.1 historyTest plan
mvn verifypasses (165 unit + 19 integration tests)X-N8N-API-KEYheader is sent to a webhook node in any code pathtype=basicsends correct Base64-encodedAuthorization: Basicheadertype=headersends the configured custom header name and valuetype=bearersendsAuthorization: Bearer <token>basicwithoutpassword) throwIllegalStateExceptionat startupn8n.webhook-authentirely sends no auth header