Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8361323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:40:16+00:00 2026-06-09T11:40:16+00:00

I actually writing a Python module to access KeePass/KeePassX databases. My problem is that

  • 0

I actually writing a Python module to access KeePass/KeePassX databases. My problem is that the password to the database is saved plain text in my database object:

def __init__(self, filepath=None, masterkey=None, read_only=False,
             new = False):
    """ Initialize a new or an existing database.

    If a 'filepath' and a 'masterkey' is passed 'load' will try to open
    a database. If 'True' is passed to 'read_only' the database will open
    read-only. It's also possible to create a new one, just pass 'True' to
    new. This will be ignored if a filepath and a masterkey is given this
    will be ignored.

    """

    self.groups = []
    self.read_only = read_only
    self.filepath = filepath
    self.masterkey = masterkey # I mean this

I don’t know how to avoid this. The only idea I had is to store the password encrypted with a random generated key (like KeePassX does) but isn’t there the problem that Python doesn’t allow private members? I mean is it possible to access the random generated key from the outside of the running program? Or is the only possibility to dump the memory of the program from RAM? If the answer to the latter is `yes’, than it should be increase security or am I misguided?

Either way, isn’t there the problem that Python `throws’ strings to the whole RAM so that there’s always the possibility that the password is stored in plain text?

Many questions, I know, but it’s one of the most critical points of security in this project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:40:17+00:00Added an answer on June 9, 2026 at 11:40 am

    If you have an OS with process memory protection (all modern OSes have this) then any code that is running in the same process will have access to the password. Other processes will not have access to data unless you grant specific access to a page of memory in an OS specific manner: this is one method RPG is done. The kernel has access to your memory and thus to the password, but if an attack vector comes through that path you have some serious problems.

    If you have an OS with virtual memory then the page that contains the password may be written to a file that the root user has access. So a processes that is running in root could read the password from there. But if you have a rogue process running as root you have more serious problems to worry about.

    Private members in objects is a language level protection that is only enforced at compilation or interpretation of the code. It has no effect on the RAM access of the data.

    So in summary the password is secure while it is in the running process. You only need to be concerned if the password were saved to a file under your control or written to a stream in some manner under your control.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a command line tool based on Python's cmd module (actually, cmd2 ,
I'm writing a Python-module which should provide an easy OOP interface to low-level GUI
Often when I'm using Python I'll find myself writing list comprehensions that look something
I am writing a game in Python (with pygame) that requires me to generate
I'm working on a Python module that is acting as an interpreter for an
I'm writing a python module in C and I need to have it call
I am writing a module to let me write code in python 3, but
I am writing a quite large Python application; the application is actually to a
I am currently writing a Python script for use on Linux machines that will
I am writing a binding system that exposes classes and functions to python in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.