Stop logging bearer tokens in the DA proxy

Open Beginner friendly
#1,872 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
79/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp

Research direction

Start in src/oed-feedpoller/Services/DaEventFeedProxyService.cs and inspect the three logging statements in DaEventFeedProxyService.ProxyRequest. Remove the two bearer token logs and ensure the headers log excludes Authorization or omits headers. Done when those statements cannot log bearer tokens; consider whether existing token telemetry should be purged.

Written by the indexing model from the issue text.

Description

DaEventFeedProxyService.ProxyRequest writes bearer tokens to Application Insights at Information level.

Affected log statements in src/oed-feedpoller/Services/DaEventFeedProxyService.cs:

  • "Proxying request to {Url} with {Headers}": serializes all incoming request headers, including Authorization.
  • "Proxying request to {Url} with {BearerToken}": logs outgoingRequest.Headers.Authorization.
  • "Proxying response to {Url} with {BearerToken}": logs incomingResponse.RequestMessage.Headers.Authorization, i.e. the token actually sent to DA (Maskinporten token with the domstol* scopes when the handler adds it).

Anyone with read access to the App Insights resource can read valid DA tokens for as long as they live.

Suggested fix

  • Remove the two {BearerToken} log statements.
  • Log only non-sensitive headers (or none) in the {Headers} statement.
  • Consider whether existing telemetry containing tokens should be purged.
Dominant language
No language data
Stars
5
Forks
2
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Altinn/oed

All issues in Altinn/oed

Similar issues

More Observability & SRE issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.