Skip to content

fix(feishu): fix group policy enforcement gaps#25439

Merged
Takhoffman merged 1 commit intoopenclaw:mainfrom
Lanfei:fix/feishu-group-policy
Feb 28, 2026
Merged

fix(feishu): fix group policy enforcement gaps#25439
Takhoffman merged 1 commit intoopenclaw:mainfrom
Lanfei:fix/feishu-group-policy

Conversation

@Lanfei
Copy link
Contributor

@Lanfei Lanfei commented Feb 24, 2026

Summary

  • Problem: Three gaps in Feishu group policy enforcement: (1) groupConfig.enabled: false was parsed but never checked, so disabled groups still received messages; (2) the group allowlist rejection log emitted the sender's open_id instead of the group ID and policy, making it hard to diagnose; (3) the sender-level allowFrom check merged in DM pairing store entries, allowing DM-paired users to bypass explicit group admission config.
  • Why it matters: Operators who disable a group or restrict group senders via groups.<id>.allowFrom could not trust those settings to be enforced. The store merge also created an inconsistency: group message admission used a merged list while group command authorization used config-only, so the same sender could pass message gating but fail command auth.
  • What changed: (1) Added early return when groupConfig.enabled === false; (2) fixed rejection log to show group ID + groupPolicy; (3) removed readAllowFromStore merge from group sender check — groups.<id>.allowFrom is now config-only, matching command authorization behavior.
  • What did NOT change (scope boundary): DM admission logic is untouched. readAllowFromStore is still used for DM dmPolicy and command authorization checks. groupPolicy / groupAllowFrom (group-level admission) logic is untouched.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

  • Groups with enabled: false in config are now silently dropped (previously ignored).
  • Senders not listed in groups.<id>.allowFrom are now blocked even if they have a DM pairing entry. Operators who relied on the store-merge behavior (unintentional) will need to add those users explicitly to allowFrom.

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22 / Bun
  • Model/provider: —
  • Integration/channel (if any): Feishu
  • Relevant config (redacted):
    {
      "channels": {
        "feishu": {
          "groupAllowFrom": ["oc_xxx"],
          "groups": {
            "oc_xxx": {
              "enabled": false,
              "allowFrom": ["ou_admin"]
            }
          }
        }
      }
    }

Steps

  1. Send a message to a group with enabled: false → should be dropped.
  2. Send a message to a group with allowFrom: ["ou_admin"] as a user not in the list → should be blocked.
  3. Send a message to the same group as ou_admin → should pass through.

Expected

  • Case 1: message silently dropped, log emits group <id> is disabled.
  • Case 2: message dropped, log emits sender <id> not in group <id> sender allowlist.
  • Case 3: message delivered normally.

Actual

  • All three cases behave as expected after this patch.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

pnpm test extensions/feishu/src/bot.test.ts — 7 tests pass.

Human Verification (required)

  • Verified scenarios: enabled: false early return; sender blocked when not in allowFrom; sender allowed when in allowFrom; DM path unaffected.
  • Edge cases checked: group with no allowFrom set (sender check skipped entirely); groupPolicy: open with no groupAllowFrom (group admitted, sender check skipped).
  • What you did not verify: live Feishu webhook end-to-end with a real bot token.

Compatibility / Migration

  • Backward compatible? No — operators who inadvertently relied on DM-paired users passing group sender checks will need to add them explicitly to groups.<id>.allowFrom.
  • Config/env changes? No
  • Migration needed? No — config schema unchanged; only enforcement tightened.

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert extensions/feishu/src/bot.ts to previous commit.
  • Files/config to restore: extensions/feishu/src/bot.ts, extensions/feishu/src/bot.test.ts.
  • Known bad symptoms: legitimate group users suddenly blocked → check if they need to be added to groups.<id>.allowFrom.

Risks and Mitigations

  • Risk: operators with existing DM-paired users in groups may see those users blocked.
    • Mitigation: the old behavior was unintentional and undocumented; a clear migration note is included above. Operators can add users to allowFrom explicitly.

@openclaw-barnacle openclaw-barnacle bot added channel: feishu Channel integration: feishu size: XS size: S and removed size: XS labels Feb 24, 2026
@Lanfei Lanfei force-pushed the fix/feishu-group-policy branch from 521c4a6 to 933cca7 Compare February 24, 2026 15:58
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
@Takhoffman Takhoffman force-pushed the fix/feishu-group-policy branch from 933cca7 to 0388316 Compare February 28, 2026 05:36
@Takhoffman Takhoffman merged commit b0a8909 into openclaw:main Feb 28, 2026
25 of 26 checks passed
@Takhoffman
Copy link
Contributor

PR #25439 - fix(feishu): fix group policy enforcement gaps (#25439)

Merged via squash.

  • Merge commit: b0a8909
  • Final PR head SHA merged: 0388316
  • Verification run locally:
    • pnpm install --frozen-lockfile
    • pnpm build
    • pnpm check
    • pnpm test:macmini

Changes made:

  • Rebased the PR branch on current origin/main.
  • Resolved test conflict by preserving current sender-level policy tests and retaining the disabled-group enforcement regression coverage.

Why these changes were made:

  • Keep the PR behavior aligned with current Feishu access-control logic while preserving explicit coverage for the fail-closed disabled-group policy.

@Takhoffman
Copy link
Contributor

Closing as superseded/already-fixed.

This change is already on main via commit:

Verified in current main:

  • extensions/feishu/src/bot.ts contains the groupConfig?.enabled === false guard.
  • extensions/feishu/src/bot.test.ts contains coverage for dropping disabled groups.

mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 28, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 28, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Feb 28, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Feb 28, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id

(cherry picked from commit d6bdb89)
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Feb 28, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id

(cherry picked from commit d6bdb89)
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Feb 28, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id

(cherry picked from commit d6bdb89)
@Lanfei Lanfei deleted the fix/feishu-group-policy branch February 28, 2026 14:30
vincentkoc pushed a commit to Sid-Qin/openclaw that referenced this pull request Feb 28, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
vincentkoc pushed a commit to rylena/rylen-openclaw that referenced this pull request Feb 28, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
newtontech pushed a commit to newtontech/openclaw-fork that referenced this pull request Feb 28, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 1, 2026
ansh pushed a commit to vibecode/openclaw that referenced this pull request Mar 2, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
venjiang pushed a commit to venjiang/openclaw that referenced this pull request Mar 2, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
robertchang-ga pushed a commit to robertchang-ga/openclaw that referenced this pull request Mar 2, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
sachinkundu pushed a commit to sachinkundu/openclaw that referenced this pull request Mar 6, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
Mateljan1 pushed a commit to Mateljan1/openclaw that referenced this pull request Mar 7, 2026
- Respect groupConfig.enabled flag (was parsed but never enforced)
- Fix misleading log: group allowlist rejection now logs group ID and
  policy instead of sender open_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants