-
-
Notifications
You must be signed in to change notification settings - Fork 147
Bugfixes #1375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfixes #1375
Conversation
WalkthroughThe authorization logic for resource access has been updated in two areas. The checks for stream resources now also grant access if the stream is of type Changes
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/rbac/map.rs (1)
242-248
: Consider caching stream type lookups to improve performance.The authorization check now makes additional calls to
PARSEABLE.get_stream()
for each request. This could impact performance if authorization checks are frequent.Consider caching stream type information or passing it as a parameter to avoid repeated lookups:
-let is_internal = PARSEABLE - .get_stream(context_resource_id) - .is_ok_and(|stream| { - stream - .get_stream_type() - .eq(&crate::storage::StreamType::Internal) - }); +let is_internal = context_resource_id + .and_then(|id| PARSEABLE.get_stream(id).ok()) + .map(|stream| stream.get_stream_type() == &crate::storage::StreamType::Internal) + .unwrap_or(false);Alternatively, consider passing stream type information as a parameter to avoid lookups during authorization checks.
src/utils/mod.rs (1)
121-123
: Minor: Consider improving code formatting and error handling.The line formatting could be improved and the error handling made more explicit.
- let is_internal = PARSEABLE - .get_stream(&table_name) - .is_ok_and(|stream|stream.get_stream_type().eq(&crate::storage::StreamType::Internal)); + let is_internal = PARSEABLE + .get_stream(table_name) + .is_ok_and(|stream| { + stream.get_stream_type() == &crate::storage::StreamType::Internal + });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/rbac/map.rs
(1 hunks)src/utils/mod.rs
(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: de-sh
PR: parseablehq/parseable#0
File: :0-0
Timestamp: 2025-03-20T15:50:45.435Z
Learning: Pay close attention to code comments for typos and semantic clarity during reviews for the Parseable project.
Learnt from: nikhilsinhaparseable
PR: parseablehq/parseable#1276
File: src/prism/logstream/mod.rs:335-338
Timestamp: 2025-03-28T06:30:13.566Z
Learning: The datasets API in Parseable is exclusively used by the datasets page in the Parseable UI and only queries the specific fields "p_src_ip" and "p_user_agent", making additional field validation unnecessary.
src/rbac/map.rs (4)
Learnt from: de-sh
PR: parseablehq/parseable#1185
File: src/handlers/http/logstream.rs:255-261
Timestamp: 2025-02-14T09:49:25.818Z
Learning: In Parseable's logstream handlers, stream existence checks must be performed for both query and standalone modes. The pattern `!PARSEABLE.streams.contains(&stream_name) && (PARSEABLE.options.mode != Mode::Query || !PARSEABLE.create_stream_and_schema_from_storage(&stream_name).await?)` ensures proper error handling in both modes.
Learnt from: nikhilsinhaparseable
PR: parseablehq/parseable#1276
File: src/prism/logstream/mod.rs:0-0
Timestamp: 2025-03-28T06:17:01.201Z
Learning: In the Parseable datasets API, specific stream names don't need to be logged in error cases because the API is called from the Parseable UI where only authorized users can access and the streams in the request are pre-filtered based on user authorization.
Learnt from: nikhilsinhaparseable
PR: parseablehq/parseable#1340
File: src/query/mod.rs:64-66
Timestamp: 2025-06-18T06:39:04.775Z
Learning: In src/query/mod.rs, QUERY_SESSION_STATE and QUERY_SESSION serve different architectural purposes: QUERY_SESSION_STATE is used for stats calculation and allows dynamic registration of individual parquet files from the staging path (files created every minute), while QUERY_SESSION is used for object store queries with the global schema provider. Session contexts with schema providers don't support registering individual tables/parquets, so both session objects are necessary for their respective use cases.
Learnt from: nikhilsinhaparseable
PR: parseablehq/parseable#1346
File: src/parseable/streams.rs:319-331
Timestamp: 2025-06-16T09:50:38.636Z
Learning: In Parseable's Ingest or Query mode, the node_id is always available because it's generated during server initialization itself, before the get_node_id_string() function in streams.rs would be called. This makes the .expect() calls on QUERIER_META.get() and INGESTOR_META.get() safe in this context.
src/utils/mod.rs (5)
Learnt from: nikhilsinhaparseable
PR: parseablehq/parseable#1276
File: src/prism/logstream/mod.rs:0-0
Timestamp: 2025-03-28T06:17:01.201Z
Learning: In the Parseable datasets API, specific stream names don't need to be logged in error cases because the API is called from the Parseable UI where only authorized users can access and the streams in the request are pre-filtered based on user authorization.
Learnt from: de-sh
PR: parseablehq/parseable#1185
File: src/handlers/http/logstream.rs:255-261
Timestamp: 2025-02-14T09:49:25.818Z
Learning: In Parseable's logstream handlers, stream existence checks must be performed for both query and standalone modes. The pattern `!PARSEABLE.streams.contains(&stream_name) && (PARSEABLE.options.mode != Mode::Query || !PARSEABLE.create_stream_and_schema_from_storage(&stream_name).await?)` ensures proper error handling in both modes.
Learnt from: nikhilsinhaparseable
PR: parseablehq/parseable#1305
File: src/handlers/http/users/dashboards.rs:0-0
Timestamp: 2025-05-01T10:27:56.858Z
Learning: The `add_tile()` function in `src/handlers/http/users/dashboards.rs` should use `get_dashboard_by_user(dashboard_id, &user_id)` instead of `get_dashboard(dashboard_id)` to ensure proper authorization checks when modifying a dashboard.
Learnt from: nikhilsinhaparseable
PR: parseablehq/parseable#1276
File: src/prism/logstream/mod.rs:335-338
Timestamp: 2025-03-28T06:30:13.566Z
Learning: The datasets API in Parseable is exclusively used by the datasets page in the Parseable UI and only queries the specific fields "p_src_ip" and "p_user_agent", making additional field validation unnecessary.
Learnt from: nikhilsinhaparseable
PR: parseablehq/parseable#1340
File: src/query/mod.rs:64-66
Timestamp: 2025-06-18T06:39:04.775Z
Learning: In src/query/mod.rs, QUERY_SESSION_STATE and QUERY_SESSION serve different architectural purposes: QUERY_SESSION_STATE is used for stats calculation and allows dynamic registration of individual parquet files from the staging path (files created every minute), while QUERY_SESSION is used for object store queries with the global schema provider. Session contexts with schema providers don't support registering individual tables/parquets, so both session objects are necessary for their respective use cases.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: coverage
- GitHub Check: Quest Smoke and Load Tests for Distributed deployments
- GitHub Check: Quest Smoke and Load Tests for Standalone deployments
- GitHub Check: Build Default aarch64-unknown-linux-gnu
- GitHub Check: Build Default x86_64-apple-darwin
- GitHub Check: Build Default aarch64-apple-darwin
- GitHub Check: Build Kafka aarch64-apple-darwin
- GitHub Check: Build Kafka x86_64-unknown-linux-gnu
- GitHub Check: Build Default x86_64-pc-windows-msvc
- GitHub Check: Build Default x86_64-unknown-linux-gnu
🔇 Additional comments (2)
src/utils/mod.rs (2)
29-29
: LGTM: Import addition is appropriate.The addition of the
PARSEABLE
import is correctly placed and necessary for the new stream type checking logic.
121-128
: Verify the security implications of granting broad access to internal streams.Similar to the change in
src/rbac/map.rs
, this modification grants access to internal streams regardless of explicit permissions. This could have security implications and should be carefully reviewed.The logic is consistent with the changes in
src/rbac/map.rs
, but please verify that this behavior is intended and secure. Consider adding a comment explaining why internal streams receive special treatment.+ // Internal streams are accessible to all authenticated users + // regardless of explicit stream permissions let is_internal = PARSEABLE .get_stream(&table_name) .is_ok_and(|stream|stream.get_stream_type().eq(&crate::storage::StreamType::Internal));
Fixes #XXXX.
Description
This PR has:
Summary by CodeRabbit
New Features
Bug Fixes