如何获取提交github仓库的用户的IP地址信息

问题描述 投票:0回答:1

是否可以获取在github仓库中提交的用户的IP地址?

我正在尝试提交 API 调用,但它不包含任何相关信息。

curl --request GET --url "https://api.github.com/repos/org/test-public-repo/commits/b46fffeeac69892470eea14692c218ea7a09ac10" \
  --header "Authorization: Bearer $TOKEN" \
  --header "X-GitHub-Api-Version: 2022-11-28"  

输出

{
  "sha": "b46fffeeac69892470eea14692c218ea7a09ac10",
  "node_id": "C_kwDOKRgIVtoAKGI0NmZmZmVlYWM2OTg5MjQ3MGVlYTE0NjkyYzIxOGVhN2EwOWFjMTA",
  "commit": {
    "author": {
      "name": "FName LName",
      "email": "[email protected]",
      "date": "2023-09-09T21:05:38Z"
    },
    "committer": {
      "name": "FName LName",
      "email": "[email protected]",
      "date": "2023-09-09T21:05:38Z"
    },
    "message": "feat: test ip",
    "tree": {
      "sha": "912b9f298c81c371c7da2070bc860964d124cfeb",
      "url": "https://api.github.com/repos/org/test-public-repo/git/trees/912b9f298c81c371c7da2070bc860964d124cfeb"
    },
    "url": "https://api.github.com/repos/org/test-public-repo/git/commits/b46fffeeac69892470eea14692c218ea7a09ac10",
    "comment_count": 0,
    "verification": {
      "verified": false,
      "reason": "unsigned",
      "signature": null,
      "payload": null
    }
  },
  "url": "https://api.github.com/repos/org/test-public-repo/commits/b46fffeeac69892470eea14692c218ea7a09ac10",
  "html_url": "https://github.com/org/test-public-repo/commit/b46fffeeac69892470eea14692c218ea7a09ac10",
  "comments_url": "https://api.github.com/repos/org/test-public-repo/commits/b46fffeeac69892470eea14692c218ea7a09ac10/comments",
  "author": {
    "login": "github-user",
    "id": 11111,
    "node_id": "MDQ6VXNlcjcwODIyNzEw",
    "avatar_url": "https://avatars.githubusercontent.com/u/70822710?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/github-user",
    "html_url": "https://github.com/github-user",
    "followers_url": "https://api.github.com/users/github-user/followers",
    "following_url": "https://api.github.com/users/github-user/following{/other_user}",
    "gists_url": "https://api.github.com/users/github-user/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/github-user/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/github-user/subscriptions",
    "organizations_url": "https://api.github.com/users/github-user/orgs",
    "repos_url": "https://api.github.com/users/github-user/repos",
    "events_url": "https://api.github.com/users/github-user/events{/privacy}",
    "received_events_url": "https://api.github.com/users/github-user/received_events",
    "type": "User",
    "site_admin": false
  },
  "committer": {
    "login": "github-user",
    "id": 11111,
    "node_id": "MDQ6VXNlcjcwODIyNzEw",
    "avatar_url": "https://avatars.githubusercontent.com/u/11111?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/github-user",
    "html_url": "https://github.com/github-user",
    "followers_url": "https://api.github.com/users/github-user/followers",
    "following_url": "https://api.github.com/users/github-user/following{/other_user}",
    "gists_url": "https://api.github.com/users/github-user/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/github-user/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/github-user/subscriptions",
    "organizations_url": "https://api.github.com/users/github-user/orgs",
    "repos_url": "https://api.github.com/users/github-user/repos",
    "events_url": "https://api.github.com/users/github-user/events{/privacy}",
    "received_events_url": "https://api.github.com/users/github-user/received_events",
    "type": "User",
    "site_admin": false
  },
  "parents": [
    {
      "sha": "26c26f8856cd81d9f9144e6654897320f4b9f575",
      "url": "https://api.github.com/repos/org/test-public-repo/commits/26c26f8856cd81d9f9144e6654897320f4b9f575",
      "html_url": "https://github.com/org/test-public-repo/commit/26c26f8856cd81d9f9144e6654897320f4b9f575"
    }
  ],
  "stats": {
    "total": 1,
    "additions": 1,
    "deletions": 0
  },
  "files": [
    {
      "sha": "e389600420ded46e657d418951fa716c9f18bb12",
      "filename": "README.md",
      "status": "modified",
      "additions": 1,
      "deletions": 0,
      "changes": 1,
      "blob_url": "https://github.com/org/test-public-repo/blob/b46fffeeac69892470eea14692c218ea7a09ac10/README.md",
      "raw_url": "https://github.com/org/test-public-repo/raw/b46fffeeac69892470eea14692c218ea7a09ac10/README.md",
      "contents_url": "https://api.github.com/repos/org/test-public-repo/contents/README.md?ref=b46fffeeac69892470eea14692c218ea7a09ac10",
      "patch": "@@ -2,3 +2,4 @@\n test\n \n ii\n+aa"
    }
  ]
}

github github-api
1个回答
0
投票

我不相信这是可能的。首先,GitHub不知道创建提交的人的IP地址,只知道推送它的人的IP地址,这可能不相同。此外,一个人可以有多个 IP 地址(家庭、工作、学校、咖啡店),而 GitHub 只能知道推送它的人在给定时间使用的 IP 地址。

此外,一般来说,从个人数据的角度来看,暴露这一点是有问题的,因为人们不必使用真实姓名或真实电子邮件地址在 GitHub 上提交,而且许多人不愿意暴露他们的家庭或工作 IP 。想想人们出于各种原因骚扰或殴打他人的情况,或者是在政府专制的国家中的用户。在未经用户同意的情况下泄露该信息还可能违反各种隐私法,例如 GDPR。

© www.soinside.com 2019 - 2024. All rights reserved.