Skip to content

[DJANGO] Support sensitive_variables decorators in integration #2356

Open

Description

@ryshu

Problem Statement

In the Django framework, a utility exists to declare that a variable is sensitive or not.

https://docs.djangoproject.com/en/3.2/_modules/django/views/decorators/debug/

Would it be possible to support this functionality in the integration directly?

Solution Brainstorm

The SDK tries to read the sensitive_variables attribute on the functions it passes to add them to sensitive information not to be displayed clearly in sentry.

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀on Sep 7, 2023
  2. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀on Sep 11, 2023
  3. antonpirker commented on Sep 11, 2023

    @antonpirker
    Contributor

    Hey @ryshu thanks for bringing this up.
    Sounds like a good idea. I put this on our internal backlog, but as we are a bit swamped right now it will take some time until we pick this up.

    But PRs are always welcome if you want to give it a go!

  4. ryshu commented on Sep 13, 2023

    @ryshu
    Author

    Hello @antonpirker,

    Glad to hear it.

    I'm not against helping you but I currently don't know anything about the internal workings of the package and the event scrubber so I don't think I'll be of much help to you on the issue.

    If you have the time to give me some keys to a possible technical solution, I could look into implementing it later.

  5. moved this to Waiting for: Product Owner in GitHub Issues with 👀on Sep 13, 2023
  6. antonpirker commented on Sep 15, 2023

    @antonpirker
    Contributor

    Hey @ryshu

    That's fine, we just leave the issue here open and if I find some time to look into this (I also need to read some code to find out how to do this) I eventually ping you again! Thanks!

  7. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀on Sep 15, 2023
  8. vagi8 commented on Sep 15, 2023

    @vagi8
    Contributor

    Hey @antonpirker , I wanted to contribute and I have taken a look at the Django integration and Django debug sensitive variables code.

    1. sensitive_variables decorator is used to declare the sensitive variables (SV).
    2. The SV keys are stored as decorator variables as sensitive_variables_wrapper.sensitive_variables = variables ,

    we can loop through each exception frame to check if the decorator frame exists. Then extract all sensitive variables and hide them. I was also thinking its better to hide the sensitive_variable decorator frame as well.

    All these have to be implemented in utils.serialize_frame which is not very specific to django integration. Need some suggestions on how the implementation should be. The only way to extract the declared sensitive variables is from the decorator frame.

    Possible solution - we can use mechanism.type == django as a way to implement specifically for django integration inside utils but this feels bad.

  9. 13 remaining items

  10. added this to the milestone on Jun 7, 2024
  11. removed this from the milestone on Jun 20, 2024
  12. added
    TriagedHas been looked at recently during old issue triage
    on Jul 1, 2024
  13. removed their assignment
    on Jul 2, 2024
  14. added and removed
    TriagedHas been looked at recently during old issue triage
    on Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions