Skip to content

feat(adapters/slack): add Sign in with Slack and block_actions types to slackapi - #167

Merged
ethanndickson merged 5 commits into
mainfrom
ethan/slack-bot-pr03-slackapi-types
Nov 12, 2026
Merged

ethanndickson merged 5 commits into
mainfrom
ethan/slack-bot-pr03-slackapi-types

Conversation

@ethanndickson

Copy link
Copy Markdown
Member

The Coder Agents Slack bot needs a few more things from slackapi before it can link Slack users to Coder users and handle button clicks, so this adds them.

OpenIDConnectToken calls openid.connect.token to finish Sign in with Slack, and decodes the Slack user ID and team ID from the ID token. Manifest gains oauth_config.scopes.user, ButtonElement gains a value, and ParseBlockActions decodes a block_actions interaction payload into typed fields, where before you only had the raw payload.

The ID token's signature isn't checked, since it comes straight from Slack's token endpoint over TLS, which OpenID Connect allows. It does check that the audience is the client ID and that the token has a user and team ID, but it leaves the issuer alone so GovSlack works, and leaves the expiry and nonce to the caller. Like #113, I've only tested these against slackapitest so far.

…very decoded field

Use a nonce that encodes to the base64url-only "-" so the ID token test
fails if the decoder uses the standard alphabet, add refresh_token and
expires_in to the token response, give the interaction user a distinct
name, and add an ephemeral-message block_actions case with is_ephemeral
true and no message.
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T04:50:15.159789Z 9849b5d Manual request
🔒 Security Review ✅ Completed 2026-11-12T04:54:43.620531Z 9849b5d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3cacac4c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread adapters/slack/slackapi/openid.go Resolved
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

I declined the PKCE finding on openid.go and resolved the thread. The only planned caller is a confidential client that sends client_secret and never sends a code_challenge, and OAuthV2AccessRequest on main has the same shape without a verifier. Treat the missing code_verifier as an accepted known limitation for this PR.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: f3cacac4c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
ethanndickson marked this pull request as ready for review November 12, 2026 03:56
@ethanndickson

Copy link
Copy Markdown
Member Author

Simulated maintainer review. An agent wrote this in the style of ThomasK33's past maintainer reviews on this repo. It is not from a maintainer.

I accept the direction. Sign in with Slack and typed block_actions decoding fit slackapi, which is still experimental. They follow its conventions: form-encoded requests, typed responses, and WithToken("") for a call that must not send the client token. I checked one point myself: OpenIDConnectToken sends no Authorization header, and openid_test.go asserts that and the exact form.

Local check: go test -race -count=5 ./adapters/slack/... . passed on f3cacac (Go 1.26.10). CI is green, and the Codex code review is clean on this head.

Before merge:

  1. ParseBlockActions drops two fields that the adapter already reads. ADR 0016 wants one implementation of each piece of Slack protocol code, so that copies do not drift. The adapter keeps its own block_actions decoder (interactive.go:130), and the new decoder already differs from it. I ran the payload from TestSlackMenuSelectionInteraction (a static_select in a thread, here marked ephemeral) through ParseBlockActions on f3cacac:

    message=<nil>
    container={Type:message MessageTS:444.000 ChannelID:C2 IsEphemeral:true}
    action={Type:static_select ActionID:pick BlockID: Value: ActionTS:}
    
    • container.thread_ts is lost. The adapter anchors on it (interactive.go:219). For an ephemeral message, Message is nil, so Message.ThreadTS cannot give the thread either. The EphemeralMessage fixture (action_id: link) suggests that this is the planned case.
    • The selected value is lost. Since fix(adapters/slack): per-activation interaction identity + normalized selection values #51, the adapter reads selected_option and selected_options (interactive.go:155-156, :238-257). BlockAction.Value is empty for every select menu.

    Please add ThreadTS to InteractionContainer, with a threaded ephemeral fixture. Its doc should say that it is empty when Slack omits it. For the selected values, I would not add fields: ActionsBlock holds only ButtonElement, so slackapi cannot build a menu today. Instead, say in the ParseBlockActions and BlockAction docs that only button actions are decoded, and that a caller decodes other elements from the raw payload. Either way, please open a tracking issue to move the adapter onto one decoder. I am not asking for that move here: the adapter's Raw holds its private interactionPayload, and OpenModalFromRaw depends on it, so the move changes a supported surface.

  2. Run the Codex security review on the final head. Only the Codex code review has run. This PR handles the client secret, a user token, and an ID token that the code does not verify, so the security pass matters here.

  3. Say plainly what the ID token check skips. The doc comment cites OpenID Connect Core 3.1.3.7 for the skipped signature. That part is right: item 6 lets TLS to the token endpoint stand in for the signature. But the same section makes the iss match (item 2), the exp check (item 9), and the nonce match when the request sent one (item 11) MUSTs, and item 6 does not replace them. Also, the issuer is known for each host: the GovSlack discovery document gives https://slack-gov.com. I accept the skip in an experimental low-level package, but a reader must not have to open openid.go to learn it. Please:

    • reword the doc comment so that the citation covers only the signature;
    • add a bullet to the README Behavior section that names what OpenIDConnectToken checks (audience, team ID, user ID) and what it does not check (signature, issuer, expiry, nonce);
    • add the same note to the docs/reference.md row (line 737). Today it reads as if the claims are verified.

Not blocking:

  • Live check. As with feat(adapters/slack): add the Web API methods that the Coder Agents Slack bot needs #113, these are tested only against slackapitest and hand-written fixtures, and the fake also missed bug(adapters/slack): HistoryReader fails on live Slack — conversations.history/replies sent as JSON #98. When you can, please add an opt-in TestLiveOpenID next to TestLiveOAuth: exchange a code from openid.connect.authorize, check that Claims.UserID and Claims.TeamID match AuthTest with the returned user token, and check that a reused code fails. For block_actions, one captured real payload of a threaded ephemeral button click (redacted) would make a better fixture. It would also settle the thread_ts question in item 1 against real Slack, because Slack's payload reference does not list that field.
  • Exports. This is the same question as on feat(adapters/slack): add slackapi, a low-level Slack API package #97, at field level: please say which fields the bot reads. RefreshToken and ExpiresIn have no refresh method, and TriggerID has no views.open wrapper. A short note is enough.
  • PKCE. Your decline is reasonable. The bot is a confidential client, and Slack requires code_verifier only when the app turns PKCE on and the authorize request sent a code_challenge. Please put one sentence in the OpenIDConnectTokenRequest doc, so that a future public client knows why it gets invalid_grant.
  • PR body. Existing callers see no behavior change: ButtonElement.Value is omitted when empty. Nothing to add.

After that, the normal gate applies: green CI, a clean Codex code review and a clean Codex security review on the final head (pushes reset both), and zero unresolved threads.

…kActions and the ID token check skip

Add InteractionContainer.ThreadTS, so the thread of an ephemeral message
is not lost when Message is nil. Say that BlockAction has only the fields
of a button action. Say that OpenIDConnectToken checks the audience, team
ID, and user ID, and does not check the signature, issuer, expiry, or
nonce.
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@ethanndickson

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 267ef0fcfa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread adapters/slack/slackapi/interaction.go Resolved
Comment thread adapters/slack/slackapi/interaction.go Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 267ef0fcfa

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@ethanndickson

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 9849b5dfe8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 9849b5dfe8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ethanndickson
ethanndickson merged commit 9288379 into main Nov 12, 2026
3 checks passed
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.

1 participant