Skip to content

Gitea hides user email in PR API #29879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
splitt3r opened this issue Mar 18, 2024 · 2 comments · Fixed by #30231
Closed

Gitea hides user email in PR API #29879

splitt3r opened this issue Mar 18, 2024 · 2 comments · Fixed by #30231
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug

Comments

@splitt3r
Copy link
Contributor

splitt3r commented Mar 18, 2024

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

@yp05327 yp05327 added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Mar 19, 2024
@yp05327
Copy link
Contributor

yp05327 commented Mar 19, 2024

Doer will always be nil, so user's email will always be NoReplyAddress
image

@edwardzhanged
Copy link
Contributor

Any plan to fix this bug guys?

@lunny lunny mentioned this issue Apr 1, 2024
silverwind pushed a commit that referenced this issue Apr 8, 2024
Fix #29879

Co-authored-by: Giteabot <[email protected]>
GiteaBot added a commit to GiteaBot/gitea that referenced this issue Apr 8, 2024
lafriks pushed a commit that referenced this issue Apr 8, 2024
Backport #30231 by @lunny

Fix #29879

Co-authored-by: Lunny Xiao <[email protected]>
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jul 8, 2024
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this issue Jan 23, 2025
Backport go-gitea#30231 by @lunny

Fix go-gitea#29879

Co-authored-by: Lunny Xiao <[email protected]>
(cherry picked from commit e0b9638)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants