Skip to content

Pickling a gitlab-python result includes the auth details #2776

Description

@mikepurvis

I have an instance with several thousand repos, where it's convenient to cache the top-level details for each in order to run various config checks. This boils down to:

gl = gitlab.Gitlab(GITLAB_URL, os.environ["GITLAB_PRIVATE_TOKEN"])
projects = gl.projects.list(get_all=True)
with open(CACHE_PATH / "projects.pickle", "wb") as f:
    pickle.dump(projects, f)

But then when I look at the pickle file, it includes the private token. When I also save the gitlab object and do a gitlab.private_token = None first, the token shows up elsewhere.

Expected Behavior

It would be great if there was an easy way to exclude the token, or otherwise manage the "session" separately.

Specifications

  • python-gitlab version: 4.4.0
  • API version you are using (v3/v4): v4
  • Gitlab server version: 15.6.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions