Conversation
Replace the custom sanitizeTracePath helper with a strict regex that captures only the date and filename segments, then reconstruct the GCS URL from those encodeURIComponent-encoded groups. This ensures no raw user input is ever interpolated into the fetch URL, satisfying CodeQL's taint-flow analysis. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds comprehensive analytics and activity logging to the Bookstack Agent, including backend support for logging query activity and new frontend components for visualizing usage metrics, query velocity, and recent queries. The changes enable tracking and display of detailed agent usage statistics, tool calls, and query outcomes, improving observability and user insight into the agent’s performance.
Backend: Analytics Logging Integration
activity_logger(BookstackActivityLogger) to the FastAPI app state, initialized at startup, for capturing analytics about each query. Logging is performed asynchronously in the background to avoid blocking the main event stream. Query details such as session ID, question, tool calls, answer, duration, and status are logged for each query processed. [1] [2] [3] [4] [5]Frontend: Analytics Dashboard Components
QueryMetricscomponent that displays key metrics (total queries, unique sessions, success rate, average duration, tool calls, etc.) in a visually appealing card layout, including a success/error bar for answer rates.QueryVelocityChartcomponent using recharts to visualize daily query volume and error rates over the last 90 days, with responsive design and gradient area charts for success and error counts.RecentQueriesTablecomponent with search, status filtering, pagination, and per-query trace inspection (modal view), showing recent queries, tool usage, durations, and statuses. Tool calls and answer previews are available for each query.