Security fixes: CB-014, CB-015, CB-016 #67

Merged
k9ert merged 1 commit from noopsec/cobot:security/fix-cb014-cb015-cb016 into main 2026-02-22 19:49:48 +00:00
Contributor

Security Fixes from Audit

⚠️ TESTING PENDING - Do not merge until tested

CB-016 [MEDIUM] - Telegram Auto-Adds Unknown Groups (CWE-862)

  • Issue: #25
  • Fix: Remove auto-add behavior for unknown groups; log and ignore instead
  • Impact: Attackers can no longer add bot to arbitrary groups for access

CB-015 [MEDIUM] - Error Messages Leak Internal State (CWE-209)

  • Issue: #24
  • Fix: Replace f"Error: {e}" with generic error messages + correlation IDs
  • Impact: Prevents information disclosure via error messages

CB-014 [MEDIUM] - Unbounded Event Deduplication Set (CWE-400)

  • Issue: #23
  • Fix: Replace unordered set with OrderedDict + TTL-based expiry (1h)
  • Impact: Prevents replay attacks from unordered trimming

Testing Checklist

  • CB-016: Verhalten wenn Config keine Gruppen hat
  • CB-014: TTL-Expiry über 1h prüfen, Memory-Growth unter Last
  • CB-015: Correlation ID erscheint korrekt in Logs

Fixes #25, #24, #23

## Security Fixes from Audit ⚠️ **TESTING PENDING** - Do not merge until tested ### CB-016 [MEDIUM] - Telegram Auto-Adds Unknown Groups (CWE-862) - **Issue:** #25 - **Fix:** Remove auto-add behavior for unknown groups; log and ignore instead - **Impact:** Attackers can no longer add bot to arbitrary groups for access ### CB-015 [MEDIUM] - Error Messages Leak Internal State (CWE-209) - **Issue:** #24 - **Fix:** Replace `f"Error: {e}"` with generic error messages + correlation IDs - **Impact:** Prevents information disclosure via error messages ### CB-014 [MEDIUM] - Unbounded Event Deduplication Set (CWE-400) - **Issue:** #23 - **Fix:** Replace unordered set with OrderedDict + TTL-based expiry (1h) - **Impact:** Prevents replay attacks from unordered trimming ### Testing Checklist - [ ] CB-016: Verhalten wenn Config keine Gruppen hat - [ ] CB-014: TTL-Expiry über 1h prüfen, Memory-Growth unter Last - [ ] CB-015: Correlation ID erscheint korrekt in Logs Fixes #25, #24, #23
[WIP] security: fix CB-014, CB-015, CB-016 from security audit
Some checks failed
CI / test (3.11) (pull_request) Failing after 15s
CI / lint (pull_request) Failing after 9s
CI / test (3.12) (pull_request) Failing after 16s
CI / test (3.13) (pull_request) Failing after 17s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 8s
6f61cfb380
⚠️ TESTING PENDING - Do not merge until tested

CB-016 [MEDIUM]: Telegram Auto-Adds Unknown Groups (CWE-862)
- Remove auto-add behavior for unknown groups
- Log and ignore messages from unconfigured groups
- Attackers can no longer add bot to arbitrary groups for access

CB-015 [MEDIUM]: Error Messages Leak Internal State (CWE-209)
- Replace f"Error: {e}" with generic error messages
- Add correlation IDs for internal log tracing
- Prevents information disclosure via error messages

CB-014 [MEDIUM]: Unbounded Event Deduplication Set (CWE-400)
- Replace unordered set with OrderedDict for deterministic trimming
- Add TTL-based expiry (1 hour) for processed events
- Prevents replay attacks from unordered trimming

Fixes #25, #24, #23
noopsec requested review from k9ert 2026-02-22 12:06:53 +00:00
k9ert force-pushed security/fix-cb014-cb015-cb016 from 6f61cfb380
Some checks failed
CI / test (3.11) (pull_request) Failing after 15s
CI / lint (pull_request) Failing after 9s
CI / test (3.12) (pull_request) Failing after 16s
CI / test (3.13) (pull_request) Failing after 17s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 8s
to 5c9e9d9ab6
Some checks failed
CI / lint (pull_request) Failing after 9s
CI / test (3.11) (pull_request) Failing after 17s
CI / test (3.12) (pull_request) Failing after 19s
CI / test (3.13) (pull_request) Failing after 19s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 8s
2026-02-22 15:34:46 +00:00
Compare
doxios left a comment
Collaborator

Review: Security Fixes CB-014, CB-015, CB-016

The security fixes look solid! 👍

CB-014 (Unbounded dedup set)

  • OrderedDict with TTL gives deterministic trimming
  • 1h expiry prevents unbounded growth
  • Cleans oldest first when over 1000 entries

CB-015 (Error message leaks)

  • Generic message with correlation ID: Reference: {error_id}
  • Detailed error logged internally for debugging

CB-016 (Telegram auto-add groups)

  • Unknown groups now logged and ignored, not auto-added
  • Clear log message explaining how to enable

Minor issues to address:

  1. Logging style: Uses print(..., file=sys.stderr) instead of self.log_warn()/self.log_error(). We recently standardized on centralized logging (PR #79). Please use:

    • self.log_warn(...) for the telegram warning
    • self.log_error(...) for the loop error
  2. Import placement: import uuid inside the function should be at module level.

Once these are fixed, happy to approve! 🦊

## Review: Security Fixes CB-014, CB-015, CB-016 The security fixes look solid! 👍 ### CB-014 (Unbounded dedup set) ✅ - `OrderedDict` with TTL gives deterministic trimming - 1h expiry prevents unbounded growth - Cleans oldest first when over 1000 entries ### CB-015 (Error message leaks) ✅ - Generic message with correlation ID: `Reference: {error_id}` - Detailed error logged internally for debugging ### CB-016 (Telegram auto-add groups) ✅ - Unknown groups now logged and ignored, not auto-added - Clear log message explaining how to enable ### Minor issues to address: 1. **Logging style**: Uses `print(..., file=sys.stderr)` instead of `self.log_warn()`/`self.log_error()`. We recently standardized on centralized logging (PR #79). Please use: - `self.log_warn(...)` for the telegram warning - `self.log_error(...)` for the loop error 2. **Import placement**: `import uuid` inside the function should be at module level. Once these are fixed, happy to approve! 🦊
noopsec requested review from doxios 2026-02-22 16:27:31 +00:00
noopsec force-pushed security/fix-cb014-cb015-cb016 from 5c9e9d9ab6
Some checks failed
CI / lint (pull_request) Failing after 9s
CI / test (3.11) (pull_request) Failing after 17s
CI / test (3.12) (pull_request) Failing after 19s
CI / test (3.13) (pull_request) Failing after 19s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 8s
to c23e06757c
Some checks failed
CI / lint (pull_request) Failing after 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 17s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 9s
2026-02-22 18:28:06 +00:00
Compare
k9ert force-pushed security/fix-cb014-cb015-cb016 from c23e06757c
Some checks failed
CI / lint (pull_request) Failing after 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 17s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 9s
to 09773e62d4
Some checks failed
CI / lint (pull_request) Failing after 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 18s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 13s
2026-02-22 18:30:40 +00:00
Compare
noopsec force-pushed security/fix-cb014-cb015-cb016 from 09773e62d4
Some checks failed
CI / lint (pull_request) Failing after 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 18s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 13s
to 5b2ac2d78d
Some checks failed
CI / lint (pull_request) Failing after 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 19s
CI / test (3.13) (pull_request) Failing after 19s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 9s
2026-02-22 18:33:51 +00:00
Compare
noopsec force-pushed security/fix-cb014-cb015-cb016 from 5b2ac2d78d
Some checks failed
CI / lint (pull_request) Failing after 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 19s
CI / test (3.13) (pull_request) Failing after 19s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 9s
to 42194d5f29
Some checks failed
CI / lint (pull_request) Successful in 10s
CI / test (3.11) (pull_request) Failing after 18s
CI / test (3.12) (pull_request) Failing after 19s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 8s
2026-02-22 19:23:52 +00:00
Compare
noopsec force-pushed security/fix-cb014-cb015-cb016 from 42194d5f29
Some checks failed
CI / lint (pull_request) Successful in 10s
CI / test (3.11) (pull_request) Failing after 18s
CI / test (3.12) (pull_request) Failing after 19s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 8s
to 317b7c36ef
Some checks failed
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Failing after 17s
CI / test (3.12) (pull_request) Failing after 18s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 13s
2026-02-22 19:27:15 +00:00
Compare
noopsec force-pushed security/fix-cb014-cb015-cb016 from 317b7c36ef
Some checks failed
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Failing after 17s
CI / test (3.12) (pull_request) Failing after 18s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 13s
to aee981aa7a
Some checks failed
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 19s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 9s
2026-02-22 19:33:12 +00:00
Compare
noopsec force-pushed security/fix-cb014-cb015-cb016 from aee981aa7a
Some checks failed
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 19s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 9s
to 874ff114fc
Some checks failed
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 18s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 12s
2026-02-22 19:33:47 +00:00
Compare
noopsec force-pushed security/fix-cb014-cb015-cb016 from 874ff114fc
Some checks failed
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 18s
CI / test (3.13) (pull_request) Failing after 18s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 12s
to 439046ed20
Some checks failed
CI / lint (pull_request) Successful in 8s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 16s
CI / test (3.13) (pull_request) Failing after 17s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 8s
2026-02-22 19:40:22 +00:00
Compare
noopsec force-pushed security/fix-cb014-cb015-cb016 from 439046ed20
Some checks failed
CI / lint (pull_request) Successful in 8s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 16s
CI / test (3.13) (pull_request) Failing after 17s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 8s
to f13108c817
Some checks failed
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 17s
CI / test (3.13) (pull_request) Failing after 19s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 12s
2026-02-22 19:43:06 +00:00
Compare
noopsec force-pushed security/fix-cb014-cb015-cb016 from f13108c817
Some checks failed
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Failing after 16s
CI / test (3.12) (pull_request) Failing after 17s
CI / test (3.13) (pull_request) Failing after 19s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 12s
to 5273b9a1b2
Some checks failed
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Successful in 21s
CI / test (3.12) (pull_request) Successful in 24s
E2E Tests / e2e (pull_request) Successful in 11s
CI / test (3.13) (pull_request) Successful in 23s
CI / build (pull_request) Has been cancelled
2026-02-22 19:47:07 +00:00
Compare
noopsec force-pushed security/fix-cb014-cb015-cb016 from 5273b9a1b2
Some checks failed
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Successful in 21s
CI / test (3.12) (pull_request) Successful in 24s
E2E Tests / e2e (pull_request) Successful in 11s
CI / test (3.13) (pull_request) Successful in 23s
CI / build (pull_request) Has been cancelled
to 8a67bb5eca
All checks were successful
CI / lint (pull_request) Successful in 10s
CI / test (3.11) (pull_request) Successful in 21s
CI / test (3.12) (pull_request) Successful in 22s
CI / test (3.13) (pull_request) Successful in 24s
E2E Tests / e2e (pull_request) Successful in 15s
CI / build (pull_request) Successful in 7s
2026-02-22 19:47:43 +00:00
Compare
noopsec changed title from [WIP] Security fixes: CB-014, CB-015, CB-016 to Security fixes: CB-014, CB-015, CB-016 2026-02-22 19:48:49 +00:00
k9ert merged commit 1b263d9c31 into main 2026-02-22 19:49:48 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ultanio/cobot!67
No description provided.