-
Notifications
You must be signed in to change notification settings - Fork 22
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
frizbee actions
generates wrong/invalid commit ref?
#206
Comments
Minimal reproducer:
|
GitHub's own API endpoints appear to be returning the wrong ref here:
yields: {
"node_id": "REF_kwDOMnghHqxyZWZzL3RhZ3MvdjM",
"object": {
"sha": "c5df01c9e4233fcd789bd004850aa36809d07727",
"type": "tag",
"url": "https://api.github.com/repos/astral-sh/setup-uv/git/tags/c5df01c9e4233fcd789bd004850aa36809d07727"
},
"ref": "refs/tags/v3",
"url": "https://api.github.com/repos/astral-sh/setup-uv/git/refs/tags/v3"
} ...and
yields: {
"node_id": "TA_kwDOMnghHtoAKGM1ZGYwMWM5ZTQyMzNmY2Q3ODliZDAwNDg1MGFhMzY4MDlkMDc3Mjc",
"sha": "c5df01c9e4233fcd789bd004850aa36809d07727",
"url": "https://api.github.com/repos/astral-sh/setup-uv/git/tags/c5df01c9e4233fcd789bd004850aa36809d07727",
"tagger": {
"name": "eifinger",
"email": "eifinger@users.noreply.github.com",
"date": "2024-10-25T12:13:43Z"
},
"object": {
"sha": "3b9817b1bf26186f03ab8277bab9b827ea5cc254",
"type": "commit",
"url": "https://api.github.com/repos/astral-sh/setup-uv/git/commits/3b9817b1bf26186f03ab8277bab9b827ea5cc254"
},
"tag": "v3",
"message": "Release v3.2.0\n",
"verification": {
"verified": false,
"reason": "unsigned",
"signature": null,
"payload": null
}
} |
another idea is probably we just query /tags endpoint
|
Hi @woodruffw, thank you for the thorough investigation and the reproducer, this is awesome! I'll try to have a better look later this week, possibly early next week. |
Hacks around stacklok/frizbee#206. Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw it looks like there are two steps involved
$ gh api /repos/astral-sh/setup-uv/git/refs/tags/v3
{
"ref": "refs/tags/v3",
"node_id": "REF_kwDOMnghHqxyZWZzL3RhZ3MvdjM",
"url": "https://api.github.com/repos/astral-sh/setup-uv/git/refs/tags/v3",
"object": {
"sha": "57b15becf94238836cd31b932339e7d72a15ef9c",
"type": "tag",
"url": "https://api.github.com/repos/astral-sh/setup-uv/git/tags/57b15becf94238836cd31b932339e7d72a15>
}
}
$ gh api /repos/astral-sh/setup-uv/git/tags/57b15becf94238836cd31b932339e7d72a15ef9c
{
"node_id": "TA_kwDOMnghHtoAKDU3YjE1YmVjZjk0MjM4ODM2Y2QzMWI5MzIzMzllN2Q3MmExNWVmOWM",
"sha": "57b15becf94238836cd31b932339e7d72a15ef9c",
"url": "https://api.github.com/repos/astral-sh/setup-uv/git/tags/57b15becf94238836cd31b932339e7d72a15ef>
"tagger": {
"name": "eifinger",
"email": "eifinger@users.noreply.github.com",
"date": "2024-11-15T08:23:29Z"
},
"object": {
**"sha": "e779db74266a80753577425b0f4ee823649f251d",**
"type": "commit",
"url": "https://api.github.com/repos/astral-sh/setup-uv/git/commits/e779db74266a80753577425b0f4ee8236>
},
"tag": "v3",
"message": "Release v3.2.3\n",
"verification": {
"verified": false,
"reason": "unsigned",
"signature": null,
"payload": null,
"verified_at": null
}
}
I will open a PR shortly, but I'd love to hear opinions from @jhrozek and @JAORMX, plus some better testing before we can merge it. |
The command `frizbee actions <action>@<tag>` incorrectly retrieves the tag's ref rather than the commit's one. The tag's ref should instead be used to retrieve the details of the tag, which contain the ref of the commit. This change changes `getCheckSumForTag` to lookup the right field using two subsequent call to GitHub. Fixes #206
Thanks @blkt! Those steps looks right to me, and I greatly appreciate your response! |
I'm still not quite sure why we're getting this unexistent ref to begin with. Have we dug into that? |
The ref does exist: it's just a tag ref, not a commit ref. This ends up working since GitHub knows how to handle both, but GitHub generally only shows commit refs in the UI itself (including on the tags/releases pages). TL;DR both refs are correct, but the commit ref is the "canonical" one as far as GitHub is concerned. |
Ah! That makes sense. And I see @blkt even has a patch in the works |
The command `frizbee actions <action>@<tag>` incorrectly retrieves the tag's ref rather than the commit's one. The tag's ref should instead be used to retrieve the details of the tag, which contain the ref of the commit. This change changes `getCheckSumForTag` to lookup the right field using two subsequent call to GitHub. Fixes #206
The command `frizbee actions <action>@<tag>` incorrectly retrieves the tag's ref rather than the commit's one. The tag's ref should instead be used to retrieve the details of the tag, which contain the ref of the commit. This change changes `getCheckSumForTag` to lookup the right field using two subsequent call to GitHub. Fixes #206
The main difference is that "partial" tags (e.g. |
The command `frizbee actions <action>@<tag>` incorrectly retrieves the tag's ref rather than the commit's one. The tag's ref should instead be used to retrieve the details of the tag, which contain the ref of the commit. This change changes `getCheckSumForTag` to lookup the right field using two subsequent call to GitHub. Fixes #206
I could be wrong, but I think the reason underneath this is convention: the "partial" tags could resolve to commit objects if they were re-tagged using the commit instead of the "full" tag, but in practice GitHub's official actions (and many others) seem to do the former. (The interactions here are very confusing: I think the behavior also varies if the tag is a "plain" tag versus an "annotated" one.) |
See stacklok/frizbee#206 Signed-off-by: William Woodruff <william@trailofbits.com>
See stacklok/frizbee#206. Signed-off-by: William Woodruff <william@yossarian.net>
@JAORMX Thanks for the fix here! Would it be possible to get this landed in a release? Right now |
* ci: harden workflows This hash-pins all of our workflows and fixes some (low-impact) zizmor findings. It also adds a `zizmor` workflow that'll run on pushes and PRs to prevent issues from sneaking in. Signed-off-by: William Woodruff <william@yossarian.net> * ci: zizmor: fix hash pin See stacklok/frizbee#206. Signed-off-by: William Woodruff <william@yossarian.net> --------- Signed-off-by: William Woodruff <william@yossarian.net>
Thank you! |
Describe the issue
Hi there! Thanks for
frizbee
, it's an awesome tool.@chenrui333 ran
frizbee
onzizmor
here: woodruffw/zizmor#90 and it produced a strange (seemingly nonexistent) pinned commit ref.In particular, this:
became this:
However, that commit (
c5df01c9e4233fcd789bd004850aa36809d07727
) doesn't appear to exist at all, either on the upstream or anywhere in the fork network: astral-sh/setup-uv@c5df01cI think the correct ref here should be
3b9817b1bf26186f03ab8277bab9b827ea5cc254
, corresponding to tagsv3
andv3.2.0
: https://github.com/astral-sh/setup-uv/releases/tag/v3.2.0To Reproduce
To reproduce, run
frizbee actions .github/workflows
on https://github.com/woodruffw/zizmor and observe the ref 🙂frizbee version
output:What version are you using?
v0.1.4
The text was updated successfully, but these errors were encountered: