Skip to content

Protect critical Logfire metadata from string transforms - #2816

Merged
alexmojaki merged 9 commits into
mainfrom
alex/NO_TRANSFORM_KEYS
Nov 16, 2026
Merged

alexmojaki merged 9 commits into
mainfrom
alex/NO_TRANSFORM_KEYS

Conversation

@alexmojaki

@alexmojaki alexmojaki commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Keep critical SDK control attributes such as span type, pending parent ID, numeric level/sample rate, and source metadata out of transform_string.
  • Keep logfire.json_schema and logfire.scrubbed exempt from pattern matching while allowing transform_string to process their string values.
  • Remove the unused deprecated logfire.level_name constant without editing generated .pyi files, per AGENTS.md.
  • Document the transformer exemption and cover it in the scrubbing tests.

This is PR 3 of the scrubbing-policy split. It is independent of the GenAI message and OpenAI/Anthropic scope changes in #2801.

Verification

  • uv run pytest -q -p no:cacheprovider tests/test_secret_scrubbing.py (74 passed)
  • Ruff, Ruff Format, and pyright passed in pre-commit.

@veria-ai

veria-ai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Fixed/addressed: 2 · PR risk: 0/10

Reviews

result: dict[Any, Any] = {}
for k, v in cast('Mapping[Any, Any]', value).items():
if k in BaseScrubber.SAFE_KEYS:
if path == ('attributes',) and k in BaseScrubber.NO_TRANSFORM_KEYS:

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.

skip the extra check, keep it simple and cheap

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.

as in the root thing

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.

(AI) Addressed in 1296758. Removed the path check and updated the test.

@cubic-dev-ai cubic-dev-ai Bot 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.

Review completed against the latest diff

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread tests/test_secret_scrubbing.py Resolved
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  logfire-sdk/logfire/_internal
  constants.py
  scrubbing.py
Project Total  

This report was generated by python-coverage-comment-action

@cubic-dev-ai cubic-dev-ai Bot 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.

Review completed against the latest diff

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

@alexmojaki
alexmojaki added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit df367e9 Nov 16, 2026
32 checks passed
@alexmojaki
alexmojaki deleted the alex/NO_TRANSFORM_KEYS branch November 16, 2026 16:36
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.

1 participant