Skip to content

feat(config): update OpenTelemetry OTLP - #164

Open
foukou19 wants to merge 2 commits into
mainfrom
feat/idp-core-observability-otel-starter
Open

foukou19 wants to merge 2 commits into
mainfrom
feat/idp-core-observability-otel-starter

Conversation

@foukou19

@foukou19 foukou19 commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

PR Description

What this PR Provides

  • Webhook JWT_BEARER security: client_id_field now accepts any non-empty
    claim name (client_id, sub, azp, email, or a custom claim) instead of
    only azp or email.
  • Existing connectors using azp or email keep working without
    reconfiguration.
  • Webhook NONE security: config is now optional. You can omit it, pass
    null, or pass {}. A non-empty config is still rejected.
  • A missing configured claim in the incoming JWT now returns 401
    (previously 403). A claim value outside client_id_values still returns
    403.
  • The JWT validator logs the caller identity (webhook_jwt_caller) with the
    result ACCEPTED or REJECTED.
  • OpenTelemetry: library-based setup (no Java agent) with OTLP export of traces
    and metrics configured in application.yml.
  • OpenTelemetry: business attributes on webhook spans
    (idp.webhook.identifier, idp.webhook.security.result,
    idp.webhook.mapping.result) to ease debugging in Datadog.
  • Documentation updated in docs/src/concepts/webhooks.md.

Fixes

Review

The reviewer must double-check these points:

  • The reviewer has tested the feature
  • The reviewer has reviewed the implementation of the feature
  • The documentation has been updated
  • The feature implementation respects the Technical Doc / ADR previously produced
  • The Pull Request title has a ! after the type/scope to identify the breaking
    change in the release note and ensure we will release a major version.

How to test

  • Initial state:
    • A running idp-core instance.
    • The product entity template and the product-mapping entity dynamic
      mapping exist.
    • A JWT issuer exposing a public HTTPS JWKS endpoint.
  • JWT_BEARER with a client_id claim:
    1. Create the connector with POST /api/v1/inbound_webhooks:

      {
        "identifier": "product",
        "name": "product",
        "description": "product connector",
        "enabled": true,
        "mapping_identifiers": ["product-mapping"],
        "security": {
          "type": "JWT_BEARER",
          "config": {
            "jwks_uri": "xxx/ext/JWKS",
            "client_id_field": "client_id",
            "client_id_values": "C60ee4cXXXXXXXXXXXXXX8ae"
          }
        }
      }
    2. Call POST /webhooks/product with Authorization: Bearer <jwt>.
      The JWT must contain
      "client_id": "C60ee4cXXXXXXXXXXXXXX8ae.

    3. Repeat with client_id_field set to email and azp to check there is
      no regression.

  • Missing claim: call with a JWT without the configured claim.
  • Wrong value: call with a claim value not in client_id_values.
  • Missing header: call without the Authorization header.
  • NONE without config: create or update a webhook with
    {"security": {"type": "NONE"}}, then with "config": null and
    "config": {}.
  • NONE with config: send "config": {"a": "b"}.
  • Observability: set OTEL_EXPORTER_OTLP_ENDPOINT and call a webhook, then
    check the trace attributes in Datadog.
  • Expected results:
    • Valid configurations are accepted (201 on creation, 200 on update).
    • Authenticated calls are processed and log
      webhook_jwt_caller ... result=ACCEPTED.
    • Missing claim or missing header returns 401.
    • Wrong claim value returns 403.
    • NONE with a non-empty config returns 400.
    • Spans carry the three idp.webhook.* attributes.

Breaking changes (if any)

  • Behavior modification of a component

Context of the Breaking Change

For JWT_BEARER, a JWT that does not contain the configured claim now returns
401 Unauthorized instead of 403 Forbidden.

Result of the Breaking Change

Callers or monitoring that relied on 403 for a missing claim must handle
401. A claim value that is present but not allowed still returns 403.

@foukou19
foukou19 force-pushed the feat/idp-core-observability-otel-starter branch from 9cc79e6 to c803b56 Compare October 5, 2026 12:24
@github-code-quality

github-code-quality Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: Java

Java / code-coverage/jacoco

The overall line coverage in commit a0e304e in the feat/idp-core-observ... branch remains at 91%, unchanged from commit 211769e in the main branch.

Show a line coverage summary of the most impacted files.
File main 211769e feat/idp-core-observ... a0e304e +/-
com/decathlon/i...ationUtils.java 87% 86% -1%
com/decathlon/i...nProcessor.java 98% 98% 0%
com/decathlon/i...okSecurity.java 100% 100% 0%
com/decathlon/i...ionService.java 100% 100% 0%
com/decathlon/i...tractDtoIn.java 100% 100% 0%
com/decathlon/i...hookMapper.java 100% 100% 0%
com/decathlon/i...yProcessor.java 100% 100% 0%
com/decathlon/i...yValidator.java 87% 89% +2%

Updated October 07, 2026 16:23 UTC

Signed-off-by: foukou19 <ferial.oukoukas@decathlon.com>
@foukou19
foukou19 force-pushed the feat/idp-core-observability-otel-starter branch from c803b56 to b98b630 Compare October 6, 2026 09:32
@foukou19
foukou19 requested a balanced review from Copilot October 7, 2026 08:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Default startup and OTLP header configuration issues can prevent or misroute telemetry exports.

Review effort: Balanced
Findings: 2 Medium severity · 2 Low severity

Open (4)
What changed in this PR

Updates OpenTelemetry export and webhook observability while broadening JWT claim support and allowing omitted configuration for unsecured webhooks.

Changes:

  • Adds OTLP tracing/metrics dependencies and configuration.
  • Adds webhook security and mapping trace attributes.
  • Supports custom JWT identity claims and optional NONE security configuration.
File Description
pom.xml Adds OpenTelemetry and Micrometer dependencies.
src/​main/​resources/​application.yml Configures OTLP exporters and Camel tracing.
JwtBearerSecurityValidator.java Accepts custom identity claims.
JwtBearerSecurityValidatorTest.java Tests custom JWT claims.
SecurityProcessor.java Records webhook security trace attributes.
IngestionProcessor.java Records ingestion mapping outcomes.
InboundWebhookSecurityContractDtoIn.java Makes security config optional.
WebhookSecurityValidationService.java Handles absent NONE configuration.
WebhookSecurity.java Normalizes absent NONE configuration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

tracing:
# Tracing is disabled by default and only enabled via environment variables (OTEL_TRACING_ENABLED).
enabled: false
enabled: ${OTEL_TRACING_ENABLED:true}
public record InboundWebhookSecurityContractDtoIn(
@NotBlank(message = WEBHOOK_CONNECTOR_SECURITY_TYPE_MANDATORY) String type,
@NotNull(message = WEBHOOK_CONNECTOR_SECURITY_CONFIG_MANDATORY) Map<String, String> config) {
Map<String, String> config) {
@foukou19
foukou19 force-pushed the feat/idp-core-observability-otel-starter branch 3 times, most recently from 6b8f4ed to 6b68405 Compare October 7, 2026 09:24
@foukou19
foukou19 requested a balanced review from Copilot October 7, 2026 09:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Telemetry defaults risk breaking unconfigured deployments, mapping results are lossy, and claimed JWT audit logging is missing.

Review effort: Balanced
Findings: 1 High severity · 3 Medium severity · 3 Low severity

Open (7)
Resolved since last review (2)

Comment thread src/main/resources/application.yml Outdated
case null, default -> log.warn("Unsupported or null mapping action: {}", mapping.action());
}

Span.current().setAttribute(SPAN_ATTRIBUTE_MAPPING_RESULT, "SUCCESS");
Comment on lines +147 to +155
=== "NONE"

```json
{
"type": "NONE"
}
```

For `NONE`, you can omit `config`, set it to `null`, or pass `{}`. Any non-empty `config` is rejected.
Comment on lines +187 to +190
traces:
export:
url: ${OTEL_EXPORTER_OTLP_ENDPOINT}
protocol: ${OTEL_EXPORTER_OTLP_PROTOCOL:http/protobuf}
@foukou19
foukou19 force-pushed the feat/idp-core-observability-otel-starter branch 4 times, most recently from 2c23b12 to 241409d Compare October 7, 2026 14:35
@foukou19
foukou19 requested a balanced review from Copilot October 7, 2026 14:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +187 to +190
traces:
export:
url: ${OTEL_EXPORTER_OTLP_ENDPOINT:}
protocol: ${OTEL_EXPORTER_OTLP_PROTOCOL:http/protobuf}
Comment on lines +191 to +194
metrics:
export:
url: ${OTEL_EXPORTER_OTLP_ENDPOINT:}
protocol: ${OTEL_EXPORTER_OTLP_PROTOCOL:http/protobuf}
Comment thread docs/src/deployment/docker.md Outdated
public record InboundWebhookSecurityContractDtoIn(
@NotBlank(message = WEBHOOK_CONNECTOR_SECURITY_TYPE_MANDATORY) String type,
@NotNull(message = WEBHOOK_CONNECTOR_SECURITY_CONFIG_MANDATORY) Map<String, String> config) {
Map<String, String> config) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config is optional for NONE, so I dropped @NotNull (type stays @notblank
Other strategies still reject a missing config).
I added tests that truly omit it: controller (omitted and null for NONE on POST and PUT, 400 for non-empty NONE config and for HMAC_SHA256 without config)

Signed-off-by: foukou19 <ferial.oukoukas@decathlon.com>
@foukou19
foukou19 force-pushed the feat/idp-core-observability-otel-starter branch from bb086c7 to 76f3ec9 Compare October 7, 2026 15:19
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@foukou19
foukou19 force-pushed the feat/idp-core-observability-otel-starter branch from a0e304e to 76f3ec9 Compare October 7, 2026 16:42

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants