Skip to content

Conversation

ilyagr
Copy link
Contributor

@ilyagr ilyagr commented Aug 22, 2025

By request of @grahamc.

I went through the steps (https://flakehub.com/new), but I'm not sure what the result of turning on this action will be (Update: and zizmor is unhappy about it).

(To be clear, IMO we should absolutely not merge this until one of us actually understands what's happening inside this action and feels they can maintain it)

We'd have to find out whether it works during the next release. For example, I had to sign in to Flakehub to generate this file, but I see nothing in it that associates me to it.

Discord discussion

TODO: Commit description if we're moving forward.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes

Comment on lines +19 to +21
- uses: "actions/checkout@v4"
with:
ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}"

Check warning

Code scanning / zizmor

credential persistence through GitHub Actions artifacts Warning

credential persistence through GitHub Actions artifacts
- uses: "actions/checkout@v4"
with:
ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}"
- uses: "DeterminateSystems/determinate-nix-action@v3"

Check failure

Code scanning / zizmor

unpinned action reference Error

unpinned action reference
with:
ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}"
- uses: "DeterminateSystems/determinate-nix-action@v3"
- uses: "DeterminateSystems/flakehub-push@main"

Check failure

Code scanning / zizmor

unpinned action reference Error

unpinned action reference
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- uses: "DeterminateSystems/flakehub-push@main"
- uses: DeterminateSystems/flakehub-push@71f57208810a5d299fc6545350981de98fdbc860

flakehub-publish:
runs-on: "ubuntu-latest"
permissions:
id-token: "write"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what this is...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It allows GHA actions to request a JWT token on behalf of your repository. It's how flakehub-push authenticates with FlakeHub, instead of static tokens. Recently, crates.io started supporting doing the same thing: https://crates.io/docs/trusted-publishing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was guessing this is authorization-related, but I worry that I don't understand where the secret is coming from and what has access to it.

I think the link to https://flakehub.com/user/settings?editview=organizations explains it. It results in requesting these permissions:

image

I haven't hit that button yet. I could try it, not sure if Google org's policies will allow it, but since I got to that screen -- probably?

But at least now it's clear to me what part of this process you need a maintainer for.

Cc: @aesipp, you might be a better person to think about this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally understand. Just for general notes:
The JWT is created by Github's infrastructure: https://docs.github.com/en/actions/concepts/security/openid-connect

Any software that runs during this workflow is able to request one during the run. Since it is a JWT, it is passed to FlakeHub's backend for authentication. The token that flakehub-push requests has its audience to https://api.flakehub.com:

fwiw the token doesn't grant any special powers within GitHub services, only services that have setup a trust relationship on their end.

I'm also happy to discuss/work with @thoughtpolice on it :) thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't imagine it's an immediate problem. It's just that we need to keep in mind that we are taking care of this token now, and have to be careful so that Bad Guys (tm) don't get a hold of it and publish Evil Stuff (tm) to Flakehub.

For this reason, I mildly prefer our current manual way of publishing to crates.io. Now that I think of it, perhaps it'd then be consistent to either publish to Flakehub manually, or not to do it, or to decide to automate the publishing to crates.io after all (as @thoughtpolice once wanted to do).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. There is no long-term token, so it'd have to be some bad-guy actor that abuses it during an actual execution of this workflow. It is possible, but mitigated in terms of access and duration. I understand the concern, though.

Unfortunately, we don't actually support publishing to FlakeHub manually right now. Only authenticated GitHub Actions / GitLab / a few other platforms are trusted for publishing. This is largely striving towards achieving greater SLSA levels.

Copy link
Member

@grahamc grahamc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed up the zizmor notes.

Also note: since the workflow has workflow_dispatch you can test it against an existing release.

Comment on lines +19 to +20
- uses: "actions/checkout@v4"
with:
Copy link
Member

@grahamc grahamc Aug 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- uses: "actions/checkout@v4"
with:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
with:
persist-credentials: false

- uses: "actions/checkout@v4"
with:
ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}"
- uses: "DeterminateSystems/determinate-nix-action@v3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- uses: "DeterminateSystems/determinate-nix-action@v3"
- uses: DeterminateSystems/determinate-nix-action@b7303d63f88908d15f0bcb207e60b3a0ea7f1712

with:
ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}"
- uses: "DeterminateSystems/determinate-nix-action@v3"
- uses: "DeterminateSystems/flakehub-push@main"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- uses: "DeterminateSystems/flakehub-push@main"
- uses: DeterminateSystems/flakehub-push@71f57208810a5d299fc6545350981de98fdbc860

steps:
- uses: "actions/checkout@v4"
with:
ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grahamc , I don't know whether you can see it, but some security scan (maybe running zizmor with other settings) is unhappy with this line. It's a warning (not an error) that says:

artipacked: credential persistence through GitHub Actions artifacts

Docs: https://docs.zizmor.sh/audits/#artipacked

I haven't looked at what it means, nor whether it's inherent to what the action is doing or could be easily worked around by changing the action a little bit (in which case, you should probably change it for everybody).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I saw that, thanks. That issue is because the template didn't specify persist-credentials: false (fixed: #7328 (comment)). I opened up a ticket internally to fix the wizard 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: The wizard has been fixed, thanks for flagging it: https://flakehub.com/new

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants