Skip to content

RHCLOUD-47156: Add guide for protecting list endpoints#117

Merged
josejulio merged 5 commits into
project-kessel:mainfrom
josejulio:RHCLOUD-47156
Jun 18, 2026
Merged

RHCLOUD-47156: Add guide for protecting list endpoints#117
josejulio merged 5 commits into
project-kessel:mainfrom
josejulio:RHCLOUD-47156

Conversation

@josejulio

@josejulio josejulio commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds comprehensive documentation for protecting list endpoints with Kessel authorization, covering the four main patterns teams use in production.

What's included

Documentation (protect-list.mdx)

  • Pre-filtering (coarse): Workspace-level filtering with StreamedListObjects
  • Pre-filtering (fine): Resource-level filtering with StreamedListObjects
  • Post-filtering (coarse): Workspace checks on query results with CheckBulk
  • Post-filtering (fine): Per-resource checks with CheckBulk

Each pattern includes:

  • When to use it
  • How it works (with diagrams)
  • Performance tradeoffs
  • Code examples

Code Examples

  • Python: Pre-filtering and post-filtering examples using SDK helpers
  • Go: Pre-filtering example using SDK helpers
  • All examples use real SDK methods (list_workspaces_async, CheckBulk, principal_subject, etc.)

Real-World References

  • Digital Roadmap: Pre-filtering with StreamedListObjects
  • Config Manager: Default workspace pattern

Decision Support

  • Performance comparison table
  • Decision flowchart (Mermaid)
  • Qualitative performance guidance

Jira

Closes RHCLOUD-47156

Acceptance Criteria Met

  • ✅ Explain pre-filtering approach (coarse and fine-grained) with code examples
  • ✅ Explain post-filtering approach (coarse and fine-grained) with code examples
  • ✅ Document StreamedListObjects API for workspace-level filtering
  • ✅ Include performance considerations and tradeoffs
  • ✅ Provide decision guide for choosing between approaches
  • ✅ Reference real implementations (Digital Roadmap, Config Manager)

🤖 Generated with Claude Code

Implements RHCLOUD-47156 with documentation covering four authorization
patterns for list endpoints:
- Pre-filtering (coarse): workspace-level filtering with StreamedListObjects
- Pre-filtering (fine): resource-level filtering with StreamedListObjects
- Post-filtering (coarse): workspace checks on query results
- Post-filtering (fine): per-resource checks with CheckBulk

Includes code examples in Python and Go using SDK helpers, real-world
references to Digital Roadmap and Config Manager implementations,
performance guidance, and a decision flowchart.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comment thread src/examples/protect-list/post-filter-bulk.py Outdated
Comment thread src/content/docs/building-with-kessel/how-to/protect-list.mdx Outdated
- Fix O(n²) performance bug in post-filter-bulk.py by using enumerate()
  instead of index() lookup inside loop
- Improve Mermaid diagram readability in dark mode by adding explicit
  black text color (color:#000) to all diagram nodes

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

**Implementation:**

<CodeExamples files={preFilterCoarse} regions="get-workspaces" />

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.

Seems like "Coarse-grained: Workspace-level filtering" is the only section that has code examples in multiple languages. Should we also add examples for the other supported languages or at least Go examples for the other sections since we are showcasing both atm

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.

Added more examples - sorry (they are a lot)!

Address critical issues found by language-specific SDK review agents:

Python (4 files):
- Change client → stub to match SDK naming
- Remove async/await, use sync pattern with .build()
- Use PascalCase methods: CheckBulk, StreamedListObjects
- Use list_workspaces instead of list_workspaces_async

Go (2 files):
- Fix import paths: remove separate allowed/check_bulk_request packages
- Use v1beta2.CheckBulkRequest, v1beta2.Allowed_ALLOWED_TRUE

TypeScript (4 files):
- Change .build() → .buildAsync() for promise-based APIs

Ruby (1 file):
- Fix hash access: .workspace_id → [:workspace_id]

Java (4 files):
- Add comment about channel cleanup (not environment-specific)

All changes verified against actual SDK examples in respective repositories.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

@lennysgarage lennysgarage left a comment

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.

Just found some issues with the Go examples rest looks great!

Comment thread src/examples/protect-list/pre-filter-fine.go Outdated
Comment thread src/examples/protect-list/post-filter-bulk.go Outdated
Comment thread src/examples/protect-list/post-filter-coarse.go Outdated
josejulio and others added 2 commits June 18, 2026 06:22
Use GetItem() method instead of accessing Item field directly.
Matches SDK example pattern from examples/grpc/check_bulk.go.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Jonathan Marcantonio <lennysgarage1@gmail.com>

@lennysgarage lennysgarage left a comment

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.

LGTM

@josejulio josejulio merged commit 3d84bd4 into project-kessel:main Jun 18, 2026
2 checks passed
@josejulio josejulio deleted the RHCLOUD-47156 branch June 18, 2026 15:04
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.

2 participants