Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redact static tokens and custom http headers #4182

Merged
merged 6 commits into from
Dec 7, 2024

Conversation

michel-laterman
Copy link
Contributor

What is the problem this PR solves?

Static tokens and (potentially) custom http headers can expose secrets in diagnostic bundles.

How does this PR solve the problem?

Redact sensitive values within the Config.Redact() call,

Design Checklist

  • I have ensured my design is stateless and will work when multiple fleet-server instances are behind a load balancer.
  • I have or intend to scale test my changes, ensuring it will work reliably with 100K+ agents connected.
  • I have included fail safe mechanisms to limit the load on fleet-server: rate limiting, circuit breakers, caching, load shedding, etc.

Copy link
Contributor

mergify bot commented Dec 5, 2024

This pull request does not have a backport label. Could you fix it @michel-laterman? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label to automatically backport to the 8./d branch. /d is the digit

Copy link
Contributor

mergify bot commented Dec 5, 2024

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label and remove the backport-8.x label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Dec 5, 2024
@michel-laterman michel-laterman added enhancement New feature or request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-8.16 Automated backport with mergify backport-8.17 Automated backport with mergify labels Dec 5, 2024
Copy link

@pkoutsovasilis pkoutsovasilis left a comment

Choose a reason for hiding this comment

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

aside a small nit this LGTM

@michel-laterman
Copy link
Contributor Author

anther test failure from #4170

for k, v := range redacted.Elasticsearch.ProxyHeaders {
proxyHeaders[k] = v
lk := strings.ToLower(k)
if strings.Contains(lk, "auth") || strings.Contains(lk, "token") || strings.Contains(lk, "key") || strings.Contains(lk, "bearer") { // best-effort scan to redact sensitive headers
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be a function just to prevent people from forgetting to update both places.

We could also one day split out a lot of our best effort redaction logic into a reusable package.

@michel-laterman michel-laterman merged commit d0993e8 into elastic:main Dec 7, 2024
8 checks passed
@michel-laterman michel-laterman deleted the redact-static-tokens branch December 7, 2024 01:12
mergify bot pushed a commit that referenced this pull request Dec 7, 2024
Redact sensitive values in headers and static token within the Config.Redact()

(cherry picked from commit d0993e8)

# Conflicts:
#	internal/pkg/config/config.go
mergify bot pushed a commit that referenced this pull request Dec 7, 2024
Redact sensitive values in headers and static token within the Config.Redact()

(cherry picked from commit d0993e8)

# Conflicts:
#	internal/pkg/config/config.go
mergify bot pushed a commit that referenced this pull request Dec 7, 2024
Redact sensitive values in headers and static token within the Config.Redact()

(cherry picked from commit d0993e8)

# Conflicts:
#	internal/pkg/config/config.go
michel-laterman added a commit that referenced this pull request Dec 10, 2024
…4189)

* Redact static tokens and custom http headers (#4182)

Redact sensitive values in headers and static token within the Config.Redact()

(cherry picked from commit d0993e8)

# Conflicts:
#	internal/pkg/config/config.go

* Fix merge conflict

---------

Co-authored-by: Michel Laterman <[email protected]>
Co-authored-by: michel-laterman <[email protected]>
michel-laterman added a commit that referenced this pull request Dec 10, 2024
…4190)

* Redact static tokens and custom http headers (#4182)

Redact sensitive values in headers and static token within the Config.Redact()

(cherry picked from commit d0993e8)

# Conflicts:
#	internal/pkg/config/config.go

* Fix merge conflict

---------

Co-authored-by: Michel Laterman <[email protected]>
Co-authored-by: michel-laterman <[email protected]>
michel-laterman added a commit that referenced this pull request Dec 10, 2024
…4191)

* Redact static tokens and custom http headers (#4182)

Redact sensitive values in headers and static token within the Config.Redact()

(cherry picked from commit d0993e8)

# Conflicts:
#	internal/pkg/config/config.go

* Fix merge conflict

---------

Co-authored-by: Michel Laterman <[email protected]>
Co-authored-by: michel-laterman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.16 Automated backport with mergify backport-8.17 Automated backport with mergify enhancement New feature or request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants