Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. Is there such a thing as an in-memory password obfuscation class for #Python that maybe encrypts the value with a random in-memory key, so it will less likely be casually written to some log or debug output?

Is there such a thing as an in-memory password obfuscation class for #Python that maybe encrypts the value with a random in-memory key, so it will less likely be casually written to some log or debug output?

Scheduled Pinned Locked Moved Uncategorized
python
4 Posts 3 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • unixtippse@mastodon.onlineU This user is from outside of this forum
    unixtippse@mastodon.onlineU This user is from outside of this forum
    unixtippse@mastodon.online
    wrote last edited by
    #1

    Is there such a thing as an in-memory password obfuscation class for #Python that maybe encrypts the value with a random in-memory key, so it will less likely be casually written to some log or debug output? Not a software developer here, just some bloke writing scripts.

    do3cc@mastodon.socialD 1 Reply Last reply
    0
    • unixtippse@mastodon.onlineU unixtippse@mastodon.online

      Is there such a thing as an in-memory password obfuscation class for #Python that maybe encrypts the value with a random in-memory key, so it will less likely be casually written to some log or debug output? Not a software developer here, just some bloke writing scripts.

      do3cc@mastodon.socialD This user is from outside of this forum
      do3cc@mastodon.socialD This user is from outside of this forum
      do3cc@mastodon.social
      wrote last edited by
      #2

      @unixtippse You could create a string like object that overwrites __str__ and __repr__ to not expose its value. When you pass it to logs, you won’t see the password. Would not work with smarter things like sentry.

      unixtippse@mastodon.onlineU cazabon@mindly.socialC 2 Replies Last reply
      0
      • do3cc@mastodon.socialD do3cc@mastodon.social

        @unixtippse You could create a string like object that overwrites __str__ and __repr__ to not expose its value. When you pass it to logs, you won’t see the password. Would not work with smarter things like sentry.

        unixtippse@mastodon.onlineU This user is from outside of this forum
        unixtippse@mastodon.onlineU This user is from outside of this forum
        unixtippse@mastodon.online
        wrote last edited by
        #3

        @do3cc That's what I though about, but I'm not sufficiently delusional to do anything on Python that resembles a security component. 🙂

        1 Reply Last reply
        0
        • do3cc@mastodon.socialD do3cc@mastodon.social

          @unixtippse You could create a string like object that overwrites __str__ and __repr__ to not expose its value. When you pass it to logs, you won’t see the password. Would not work with smarter things like sentry.

          cazabon@mindly.socialC This user is from outside of this forum
          cazabon@mindly.socialC This user is from outside of this forum
          cazabon@mindly.social
          wrote last edited by
          #4

          @do3cc @unixtippse

          I've also seen people implement classes that throw an exception if __str__ or __repr__ are called, so you immediately know it's a bug. They typically add a separate method to actually show the value if needed.

          1 Reply Last reply
          2
          0
          • R relay@relay.publicsquare.global shared this topic
            R relay@relay.mycrowd.ca shared this topic
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups