Slack: redact and cap interaction system events#28982
Slack: redact and cap interaction system events#28982Takhoffman merged 6 commits intoopenclaw:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c2848b68c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (typeof value === "string") { | ||
| return truncateInteractionString(value); |
There was a problem hiding this comment.
Preserve full interaction text in sanitized system payloads
The sanitizer now truncates every string field to 160 characters via truncateInteractionString before checking whether the event actually exceeds the 2400-character cap, so long modal inputs are always shortened even when the full payload would fit. In Slack interaction flows where users submit plain_text_input/rich text values (which can be much longer), this introduces silent data loss in the system event consumed by downstream agent logic, causing incomplete or incorrect handling of otherwise valid submissions.
Useful? React with 👍 / 👎.
Greptile SummaryAdds security hardening for Slack interaction system events by redacting sensitive metadata and capping payload sizes.
Confidence Score: 5/5
Last reviewed commit: 5c2848b |
5c2848b to
064acdb
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98392a614b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| .slice(0, SLACK_INTERACTION_ARRAY_MAX_ITEMS) | ||
| .map((entry) => sanitizeSlackInteractionPayloadValue(entry)) | ||
| .filter((entry) => entry !== undefined); | ||
| if (value.length > SLACK_INTERACTION_ARRAY_MAX_ITEMS) { | ||
| sanitized.push(`…+${value.length - SLACK_INTERACTION_ARRAY_MAX_ITEMS} more`); | ||
| } |
There was a problem hiding this comment.
Delay array truncation until payload exceeds size cap
sanitizeSlackInteractionPayloadValue always slices arrays to 64 items and appends a summary marker before formatSlackInteractionSystemEvent checks the 2400-character limit, so interaction data is lost even when the full event would still fit. In practice, large but valid selection sets (for example multi-select actions with >64 selected IDs) will be silently truncated in normal-sized events, which can make downstream agent decisions incomplete or incorrect.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 069c32af9c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const compactPayload = sanitizeSlackInteractionPayloadValue( | ||
| buildCompactSlackInteractionPayload(sanitizedPayload), | ||
| ) as Record<string, unknown>; |
There was a problem hiding this comment.
Build compact summary from original payload
When the first serialized event exceeds the 2400-char cap, the compact path is built from sanitizedPayload, but that object has already had arrays truncated to 64 entries with a synthetic …+N more marker. As a result, inputsOmitted is computed from the capped array instead of the true modal input count, so submissions with more than 65 inputs are underreported (for example, a 200-input modal is reported as only 62 omitted), which gives downstream agent logic incorrect truncation metadata.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 23b10a953b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const trimmed = value.trim(); | ||
| if (trimmed.length <= max) { | ||
| return trimmed; |
There was a problem hiding this comment.
Preserve whitespace when truncating interaction strings
truncateInteractionString calls .trim() on every string before size checks, so Slack modal/text inputs lose leading and trailing spaces even when the event is far below the 2400-character cap. This changes the semantic content of user submissions (for example indented snippets, fixed-width values, or intentionally padded text) and can cause downstream agent behavior to diverge from what the user actually entered; truncation should cap length without normalizing whitespace.
Useful? React with 👍 / 👎.
23b10a9 to
8651341
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Ready to merge. @Takhoffman @Lukavyi could any of you merge this when you have a moment? |
|
@vincentkoc @Takhoffman Bumping this as well. I've addressed the Codex feedback regarding truncation/whitespace to ensure no data loss for downstream agents. It’s fully verified and green—ready to land when you have a moment. |
Cherry-pick of upstream 746688d.
Cherry-pick of upstream 746688d.
Summary
Describe the problem and fix in 2–5 bullets:
triggerId,responseUrl, workflow trigger URL, modal metadata/hash) and could exceed practical size when large modal payloads are captured.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
pnpm build.pnpm check.pnpm test.Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
payloadTruncated, and report omitted input counts.Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
src/slack/monitor/events/interactions.ts,src/slack/monitor/events/interactions.test.ts.Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.payloadTruncated, omitted counts) to retain event utility.