Skip to content

feat(logging): bulk download selected log entries as CSV - #865

Open
josephfusco wants to merge 4 commits into
mainfrom
feat/logging-bulk-download
Open

josephfusco wants to merge 4 commits into
mainfrom
feat/logging-bulk-download

Conversation

@josephfusco

@josephfusco josephfusco commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Adds a "Download Selected" bulk action that streams the selected log entries as one CSV. Cells that a spreadsheet would run as formulas are now escaped in every download.

Closes #405

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Assisting with implementing bulk log downloads.

Adds a "Download Selected" bulk action to the logs list. Selected entries
are streamed to php://output as a single CSV, fetched one at a time so
memory stays flat, and capped by the filterable
wpgraphql_logging_bulk_download_limit (default 1000). The single-entry
download now shares the same header/stream/write code path.
@josephfusco josephfusco added [Type] Enhancement A suggestion for improvement of an existing feature [Area] Logging Issues for the WPGraphQL Logging plugin labels Oct 30, 2026
@josephfusco josephfusco added this to the WPGraphQL Logging Plugin milestone Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Plugin Artifacts Ready!

Download from GitHub Actions run

Available plugins:

  • ✅ wpgraphql-logging.zip

See the "Artifacts" section at the bottom of the Actions run page

Second review pass (correctness and security):
- Escape cells that spreadsheets would evaluate as formulas. Log values
  such as the query and message come from unauthenticated GraphQL
  requests, so an exported CSV could otherwise run attacker formulas.
- Drop open output buffers before streaming so large exports are not
  held in memory.
- Ignore non-scalar IDs (absint() turns arrays into 1) and reuse the
  service's ID sanitizer in the list table.
…ge cases

Third review pass (tests and static analysis):
- Cover the ViewLogsPage load-time hook end to end: bad nonce and the
  'Logs not found' path through the real database service.
- Assert formula cells are escaped and plain cells are left alone.
- Assert non-scalar IDs are dropped instead of becoming ID 1.
…le setup

Fourth review pass (simplification, performance and docs):
- Only build the list table at load time when the bulk download action
  is actually requested, instead of on every page load.
- Document the Download Selected bulk action, the 1,000-row cap and
  its filters, and formula escaping in the plugin docs.
@josephfusco
josephfusco marked this pull request as ready for review October 30, 2026 19:56
@josephfusco
josephfusco requested review from a team and colinmurphy as code owners October 30, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Logging Issues for the WPGraphQL Logging plugin [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logging Plugin: Mass Download of IDs

1 participant