Skip to content

Gitea hides user email in PR API #29879

Closed
@splitt3r

Description

@splitt3r

Description

I think this issue is related to #27943. But that PR seems to only fix webhooks.

I'm trying to get the user (creator / assignee) email(s) from the pull request api in Gitea. I noticed that the email adress in the user field is redacted even if it shouldn't be because its turned off. As you can see the email is replaced by username@hidden email. But e. g. the base/owner field has the normal email.

I'm not calling the api anonymous.

{
  "id": 1,
  "url": "http://localhost:3000/root/test/pulls/1",
  "number": 1,
  "user": {
    "id": 1,
    "login": "root",
    "login_name": "",
    "full_name": "",
    "email": "[email protected]",
    "avatar_url": "https://secure.gravatar.com/avatar/b1a4b2518dbbdd47dd4a713d5cd1df94?d=identicon",
    "language": "",
    "is_admin": false,
    "last_login": "0001-01-01T00:00:00Z",
    "created": "2024-03-15T14:38:57Z",
    "restricted": false,
    "active": false,
    "prohibit_login": false,
    "location": "",
    "website": "",
    "description": "",
    "visibility": "public",
    "followers_count": 0,
    "following_count": 0,
    "starred_repos_count": 0,
    "username": "root"
  },
  "title": "Update README.md",
  "body": "",
  "labels": [],
  "milestone": null,
  "assignee": null,
  "assignees": null,
  "requested_reviewers": null,
  "state": "open",
  "is_locked": false,
  "comments": 0,
  "html_url": "http://localhost:3000/root/test/pulls/1",
  "diff_url": "http://localhost:3000/root/test/pulls/1.diff",
  "patch_url": "http://localhost:3000/root/test/pulls/1.patch",
  "mergeable": true,
  "merged": false,
  "merged_at": null,
  "merge_commit_sha": null,
  "merged_by": null,
  "allow_maintainer_edit": false,
  "base": {
    "label": "main",
    "ref": "main",
    "sha": "10a867014fbd335a441cd435e1d7f3cca8bd32a7",
    "repo_id": 1,
    "repo": {
      "id": 1,
      "owner": {
        "id": 1,
        "login": "root",
        "login_name": "",
        "full_name": "",
        "email": "root@localhost",
        "avatar_url": "https://secure.gravatar.com/avatar/b1a4b2518dbbdd47dd4a713d5cd1df94?d=identicon",
        "language": "",
        "is_admin": false,
        "last_login": "0001-01-01T00:00:00Z",
        "created": "2024-03-15T14:38:57Z",
        "restricted": false,
        "active": false,
        "prohibit_login": false,
        "location": "",
        "website": "",
        "description": "",
        "visibility": "public",
        "followers_count": 0,
        "following_count": 0,
        "starred_repos_count": 0,
        "username": "root"
      },
      "name": "test",
      "full_name": "root/test",
      "description": "",
      "empty": false,
      "private": false,
      "fork": false,
      "template": false,
      "parent": null,
      "mirror": false,
      "size": 21,
      "language": "",
      "languages_url": "http://localhost:3000/api/v1/repos/root/test/languages",
      "html_url": "http://localhost:3000/root/test",
      "url": "http://localhost:3000/api/v1/repos/root/test",
      "link": "",
      "ssh_url": "git@localhost:root/test.git",
      "clone_url": "http://localhost:3000/root/test.git",
      "original_url": "",
      "website": "",
      "stars_count": 0,
      "forks_count": 0,
      "watchers_count": 1,
      "open_issues_count": 0,
      "open_pr_counter": 1,
      "release_counter": 0,
      "default_branch": "main",
      "archived": false,
      "created_at": "2024-03-15T14:39:22Z",
      "updated_at": "2024-03-15T14:39:46Z",
      "archived_at": "1970-01-01T00:00:00Z",
      "permissions": {
        "admin": false,
        "push": false,
        "pull": true
      },
      "has_issues": true,
      "internal_tracker": {
        "enable_time_tracker": false,
        "allow_only_contributors_to_track_time": true,
        "enable_issue_dependencies": true
      },
      "has_wiki": true,
      "has_pull_requests": true,
      "has_projects": true,
      "has_releases": true,
      "has_packages": true,
      "has_actions": false,
      "ignore_whitespace_conflicts": false,
      "allow_merge_commits": true,
      "allow_rebase": true,
      "allow_rebase_explicit": true,
      "allow_squash_merge": true,
      "allow_rebase_update": true,
      "default_delete_branch_after_merge": false,
      "default_merge_style": "merge",
      "default_allow_maintainer_edit": false,
      "avatar_url": "",
      "internal": false,
      "mirror_interval": "",
      "mirror_updated": "0001-01-01T00:00:00Z",
      "repo_transfer": null
    }
  },
  "head": {
    "label": "root-patch-1",
    "ref": "root-patch-1",
    "sha": "d29708418b325e157dc2ef7ca61423ac7468dd87",
    "repo_id": 1,
    "repo": {
      "id": 1,
      "owner": {
        "id": 1,
        "login": "root",
        "login_name": "",
        "full_name": "",
        "email": "root@localhost",
        "avatar_url": "https://secure.gravatar.com/avatar/b1a4b2518dbbdd47dd4a713d5cd1df94?d=identicon",
        "language": "",
        "is_admin": false,
        "last_login": "0001-01-01T00:00:00Z",
        "created": "2024-03-15T14:38:57Z",
        "restricted": false,
        "active": false,
        "prohibit_login": false,
        "location": "",
        "website": "",
        "description": "",
        "visibility": "public",
        "followers_count": 0,
        "following_count": 0,
        "starred_repos_count": 0,
        "username": "root"
      },
      "name": "test",
      "full_name": "root/test",
      "description": "",
      "empty": false,
      "private": false,
      "fork": false,
      "template": false,
      "parent": null,
      "mirror": false,
      "size": 21,
      "language": "",
      "languages_url": "http://localhost:3000/api/v1/repos/root/test/languages",
      "html_url": "http://localhost:3000/root/test",
      "url": "http://localhost:3000/api/v1/repos/root/test",
      "link": "",
      "ssh_url": "git@localhost:root/test.git",
      "clone_url": "http://localhost:3000/root/test.git",
      "original_url": "",
      "website": "",
      "stars_count": 0,
      "forks_count": 0,
      "watchers_count": 1,
      "open_issues_count": 0,
      "open_pr_counter": 1,
      "release_counter": 0,
      "default_branch": "main",
      "archived": false,
      "created_at": "2024-03-15T14:39:22Z",
      "updated_at": "2024-03-15T14:39:46Z",
      "archived_at": "1970-01-01T00:00:00Z",
      "permissions": {
        "admin": false,
        "push": false,
        "pull": true
      },
      "has_issues": true,
      "internal_tracker": {
        "enable_time_tracker": false,
        "allow_only_contributors_to_track_time": true,
        "enable_issue_dependencies": true
      },
      "has_wiki": true,
      "has_pull_requests": true,
      "has_projects": true,
      "has_releases": true,
      "has_packages": true,
      "has_actions": false,
      "ignore_whitespace_conflicts": false,
      "allow_merge_commits": true,
      "allow_rebase": true,
      "allow_rebase_explicit": true,
      "allow_squash_merge": true,
      "allow_rebase_update": true,
      "default_delete_branch_after_merge": false,
      "default_merge_style": "merge",
      "default_allow_maintainer_edit": false,
      "avatar_url": "",
      "internal": false,
      "mirror_interval": "",
      "mirror_updated": "0001-01-01T00:00:00Z",
      "repo_transfer": null
    }
  },
  "merge_base": "10a867014fbd335a441cd435e1d7f3cca8bd32a7",
  "due_date": null,
  "created_at": "2024-03-15T14:39:51Z",
  "updated_at": "2024-03-15T14:39:51Z",
  "closed_at": null,
  "pin_order": 0
}

Gitea Version

latest

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

Global settings:
image
User settings:
image

Git Version

No response

Operating System

No response

How are you running Gitea?

version: '3'

services:
  gitea:
    image: gitea/gitea
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=postgres:5432
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=gitea
      - GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE=false
    restart: always
    networks:
      - gitea
    volumes:
      - gitea-data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
    depends_on:
      - postgres

  postgres:
    image: postgres
    container_name: postgres
    restart: always
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=gitea
      - POSTGRES_DB=gitea
    networks:
      - gitea
    volumes:
      - postgres-data:/var/lib/postgresql/data

networks:
  gitea:

volumes:
  gitea-data:
  postgres-data:

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions