Skip to content

Slack plugin hardening#63288

Merged
hugoShaka merged 6 commits intomasterfrom
hugo/reduce-probability-of-slack-token-loss
Jan 30, 2026
Merged

Slack plugin hardening#63288
hugoShaka merged 6 commits intomasterfrom
hugo/reduce-probability-of-slack-token-loss

Conversation

@hugoShaka
Copy link
Copy Markdown
Contributor

@hugoShaka hugoShaka commented Jan 29, 2026

This PR improves how we handle issues during Slack token renewal, or renewal during shutdown. It makes sure we try everything possible to finish the renewal. The server can still crash/be ungracefully terminated, but at least we support graceful termination better.

Twin e PR: https://github.com/gravitational/teleport.e/pull/7951

This PR does the following changes:

  • Do not cancel ongoing refresh
  • Better logging in case of error

More context in Slack:

Changelog: Improved robustness of the Slack hosted plugin to reduce the likeliness of failed token refresh when experiencing external disruption.

- Do not cancel ongoing refresh
- Better logging in case of error
Comment thread integrations/access/common/auth/token_provider.go Outdated
Comment thread integrations/access/common/auth/token_provider.go Outdated
@hugoShaka hugoShaka requested a review from r0mant January 29, 2026 19:07
Copy link
Copy Markdown
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

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

I feel really uneasy about logging the tokens so I would prefer we don't do it as mentioned in the comment(-s). Once that's addressed, will be lgtm.

Comment thread integrations/access/common/auth/token_provider.go Outdated
Comment thread integrations/access/slack/oauth.go Outdated
Comment thread integrations/access/common/auth/token_provider.go Outdated
Comment thread integrations/access/common/auth/token_provider.go
Comment thread integrations/access/common/auth/token_provider.go Outdated
Comment thread integrations/access/common/auth/token_provider.go Outdated
Comment thread integrations/access/common/auth/token_provider.go Outdated
Comment on lines +33 to +35
const (
requestTimeout = 30 * time.Second
)
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.

Do we need to add a timeout here? It's always better to let the caller do this IMO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't agree, I don't trust the caller to set a deadline and I don't want this to hang. I'm still honouring the caller's context by cancelling when they want, but I don't see why this should be the caller's responsibility to be sure my HTTP client will not block infinitely.

Comment thread integrations/access/common/auth/token_provider.go Outdated
hugoShaka and others added 3 commits January 29, 2026 17:18
Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
Copy link
Copy Markdown
Contributor

@tigrato tigrato left a comment

Choose a reason for hiding this comment

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

Should we also prevent multiple replicas of auth server trying to refresh the same plugin/credentials?
from my understanding, every auth server replica runs the slack plugin and tries to revalidate the credentials

It also seems the case that the plugin manager shutsdown every single plugin on credentials refresh as per:

This means that after the first update, all plugins will eventually synchronize and refresh the credentials at the same time

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from bernardjkim January 30, 2026 11:50
@hugoShaka hugoShaka added this pull request to the merge queue Jan 30, 2026
Merged via the queue into master with commit 839f053 Jan 30, 2026
42 of 43 checks passed
@hugoShaka hugoShaka deleted the hugo/reduce-probability-of-slack-token-loss branch January 30, 2026 16:22
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@hugoShaka See the table below for backport results.

Branch Result
branch/v17 Failed
branch/v18 Create PR

hugoShaka added a commit that referenced this pull request Jan 30, 2026
* Slack plugin hardening

- Do not cancel ongoing refresh
- Better logging in case of error

* fixup! Slack plugin hardening

* fixup! fixup! Slack plugin hardening

* Apply suggestions from code review

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* address feedback

* fixup! address feedback

---------

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
hugoShaka added a commit that referenced this pull request Jan 30, 2026
* Slack plugin hardening

- Do not cancel ongoing refresh
- Better logging in case of error

* fixup! Slack plugin hardening

* fixup! fixup! Slack plugin hardening

* Apply suggestions from code review

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* address feedback

* fixup! address feedback

---------

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
github-merge-queue bot pushed a commit that referenced this pull request Jan 30, 2026
* Slack plugin hardening

- Do not cancel ongoing refresh
- Better logging in case of error

* fixup! Slack plugin hardening

* fixup! fixup! Slack plugin hardening

* Apply suggestions from code review



* address feedback

* fixup! address feedback

---------

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants