Skip to content

feat(attributes): Hide internal attributes from responses#116084

Closed
nsdeschenes wants to merge 10 commits into
masterfrom
nd/feat-attributes-hide-internal-attributes-from-responses
Closed

feat(attributes): Hide internal attributes from responses#116084
nsdeschenes wants to merge 10 commits into
masterfrom
nd/feat-attributes-hide-internal-attributes-from-responses

Conversation

@nsdeschenes
Copy link
Copy Markdown
Contributor

@nsdeschenes nsdeschenes commented May 22, 2026

The goal of this PR is to hide internal attributes from API responses to non-staff users. This visibility is controlled via the visibility field from the conventions package.

TODO

Closes EXP-966

Add a shared helper for hiding internal Sentry convention attributes from API surfaces and let SearchResolver track attributes hidden by API visibility configuration.

This keeps default resolver behavior unchanged unless an API caller opts into visibility enforcement.
Filter internal Sentry convention attributes from trace item and span attribute discovery APIs unless the requester is staff or superuser.

Apply the same visibility checks to attribute value autocomplete and validation so hidden attributes are treated as unknown for regular users.
Apply EAP API visibility checks to trace item stats, ranked attribute comparisons, trace item detail serialization, exports, and RPC table/stat responses.

Hidden attributes in query filters now return empty results instead of broadening the query for regular users.
@nsdeschenes
Copy link
Copy Markdown
Contributor Author

@cursor review

@nsdeschenes
Copy link
Copy Markdown
Contributor Author

@sentry review

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 22, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 4f7ea65. Configure here.

nsdeschenes and others added 2 commits May 22, 2026 08:03
Apply API attribute visibility checks when the events endpoint queries RPC datasets. This prevents non-staff users from selecting internal attributes with field params and receiving their values.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Apply the same API attribute visibility checks to the events-timeseries RPC path. Return an empty timeseries response instead of querying hidden internal attributes for non-staff users.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@nsdeschenes
Copy link
Copy Markdown
Contributor Author

@cursor review

@nsdeschenes
Copy link
Copy Markdown
Contributor Author

@sentry review

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit cc7183e. Configure here.

Comment thread src/sentry/snuba/rpc_dataset_common.py Outdated
nsdeschenes and others added 2 commits May 22, 2026 09:08
Return empty timeseries metadata when API visibility hides requested attributes, and type resolver visibility options explicitly so backend typing accepts the config calls.

Co-Authored-By: Codex <noreply@openai.com>
Rename the hidden-attribute metadata variable so mypy does not see two typed definitions for final_meta in the same function scope.

Co-Authored-By: Codex <codex@openai.com>
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f3513ce. Configure here.

Comment thread src/sentry/snuba/rpc_dataset_common.py
Comment thread src/sentry/snuba/rpc_dataset_common.py
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 22, 2026

EXP-966

Propagate hidden API attribute markers from cross-trace resolvers back to the primary resolver so table and bulk table queries return empty results instead of dispatching RPCs. Resolve cross-trace query visibility using the target trace item type for span, log, metric, and occurrence filters.

Add regression coverage for non-staff cross-trace filters on internal span and log attributes.

Co-Authored-By: Codex <noreply@openai.com>
Comment thread src/sentry/search/eap/resolver.py
nsdeschenes and others added 2 commits May 22, 2026 09:50
Add regression coverage that cross-trace occurrence filters resolve API attribute visibility with the occurrence item type instead of the primary spans item type.

Co-Authored-By: Codex <noreply@openai.com>
Use the trace item type from the resolver's column definitions for API attribute visibility checks. This keeps dataset-specific resolvers from applying a mismatched primary request item type.

Add coverage for log resolvers receiving a spans visibility config.

Co-Authored-By: Codex <noreply@openai.com>
@nsdeschenes
Copy link
Copy Markdown
Contributor Author

Closing in favour of: #116091, #116092, #116093, #116094

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant