Skip to content

feat: support CI/CD login from Forgejo Actions (Codeberg) - #580

Merged
EthanHeilman merged 21 commits into
openpubkey:mainfrom
Blacks-Army:feat/forgejo-actions
Aug 5, 2026
Merged

EthanHeilman merged 21 commits into
openpubkey:mainfrom
Blacks-Army:feat/forgejo-actions

Conversation

@Blacks-Army

@Blacks-Army Blacks-Army commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #519

Adds opkssh login forgejo (alias codeberg), analogous to opkssh login github, so workflows on Forgejo instances such as Codeberg can authenticate over SSH with their OIDC token.

  • The client auto-detects the Forgejo Actions environment and derives the instance issuer (<instance>/api/actions), so no client config is needed.
  • The server verifies any issuer ending in /api/actions.
  • Docs: docs/forgejo-actions.md. Requires Forgejo v15.0 or later.

The provider lives in the openpubkey library (depends on openpubkey/openpubkey#386).

Wires opkssh to the Forgejo Actions provider (forgejo/codeberg aliases,
client login and server verification). The provider itself lives in the
openpubkey library.

Signed-off-by: Blacks-Army <104644957+Blacks-Army@users.noreply.github.com>
@Blacks-Army
Blacks-Army force-pushed the feat/forgejo-actions branch from 7212dbf to e7360b9 Compare July 20, 2026 21:41
Drop --print-id-token, the providers/auth_id echoes and the debug dump
step so a run on a public instance does not leak the raw ID Token or
opkssh internals. The final SSH whoami is the proof the flow works.
@Blacks-Army
Blacks-Army force-pushed the feat/forgejo-actions branch from e7360b9 to 2d18b06 Compare July 20, 2026 21:44
@EthanHeilman

Copy link
Copy Markdown
Member

@Blacks-Army Now pointed at OpenPubkey with Forgejo support

@Blacks-Army
Blacks-Army force-pushed the feat/forgejo-actions branch from 238d8b5 to ffadbb6 Compare July 22, 2026 13:45
…Writer/ErrorWriter fields

openpubkey v0.26.1 added OutputWriter/ErrorWriter fields to providers.StandardOp,
which now serialize into the chooser JSON these tests compare against.
…romAuthorizedKey

golang.org/x/crypto v0.54.0 (pulled in via the openpubkey bump) now
strictly validates that the declared key type in an authorized_keys
line matches the type encoded in the key blob, breaking these tests
which passed the literal string "cert-type" instead of the real
algorithm-specific type (e.g. ecdsa-sha2-nistp256-cert-v01@openssh.com).
@Blacks-Army

Copy link
Copy Markdown
Contributor Author

@EthanHeilman

All checks have passed.

Comment thread commands/config/providerconfig.go Resolved
Comment thread commands/login.go Resolved
Comment thread commands/config/providerconfig.go Resolved
@Blacks-Army
Blacks-Army requested a review from EthanHeilman July 22, 2026 21:12
@Blacks-Army

Copy link
Copy Markdown
Contributor Author

@EthanHeilman

FYI: Test over there is still passing with the changes https://codeberg.org/Blacks-Army/opkssh/actions/runs/4/jobs/0/attempt/1

Address review feedback on the Forgejo/GitHub Actions provider detection:
- Detect GitHub positively via its token request URL host instead of
  inferring it from a failed Forgejo check, so a third Actions-compatible
  runner isn't misreported as GitHub.
- Require the cicdUnusedClientID sentinel before routing an issuer into the
  Forgejo path, so an unrelated OP whose issuer coincidentally ends in
  "/api/actions" isn't misrouted.
- Wire up GitLab CI/CD as a supported CI/CD provider (was implemented in
  openpubkey/providers but never connected here). IsCICDProvider now checks
  by alias rather than issuer, since GitLab CI/CD shares its issuer with the
  browser-based GitLab OP.
@Blacks-Army
Blacks-Army force-pushed the feat/forgejo-actions branch from 0b28e19 to a8711ba Compare July 22, 2026 21:23
@Blacks-Army

Blacks-Army commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor Author

I don't know why the Pipelines were cancelled. @EthanHeilman can you please rerun them? Seems like I cannot do it..

@Blacks-Army

Copy link
Copy Markdown
Contributor Author

@EthanHeilman No rush at all, I was just wondering if you have a rough idea of when my PR might be merged and whether it’s expected to be part of the next release.

@EthanHeilman

Copy link
Copy Markdown
Member

@Blacks-Army I'm hoping to merge it soon. It is the last major feature planned for the upcoming release

@EthanHeilman EthanHeilman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

EthanHeilman added a commit that referenced this pull request Aug 5, 2026
Updates dependency OpenPubkey from v0.25.0 to v0.27.0

v0.27.0 adds a output writer to control where output in the web chooser or standard provider emit output and error. By default it suppresses outputs. Alongside this upgrade we set the output to stdout and stderr to maintain current behavior
openpubkey/openpubkey#390

While there this behavior is covered by unittests, I also manually tested that the output was produced.

This change was originally in #580 but I pulled it out as a separate PR. The broken tests are fixed in #580.
@EthanHeilman
EthanHeilman merged commit c422dac into openpubkey:main Aug 5, 2026
30 of 31 checks passed
@Blacks-Army

Copy link
Copy Markdown
Contributor Author

Hey @EthanHeilman, I’d love to use this feature in the near future. Is there perhaps an ETA for the next release? The last one was more than three months ago.

@EthanHeilman

Copy link
Copy Markdown
Member

@Blacks-Army Release v0.17.0 is out!
https://github.com/openpubkey/opkssh/releases/tag/v0.17.0

sdwilsh pushed a commit to sdwilsh/ansible-playbooks that referenced this pull request Oct 7, 2026
##### [\`v0.17.0\`](https://github.com/openpubkey/opkssh/releases/tag/v0.17.0)

##### 🚀 Features

- feat: support CI/CD login from Forgejo Actions (Codeberg) [@Blacks-Army](https://github.com/Blacks-Army) ([#580](openpubkey/opkssh#580))
- ssh-agent off by default [@EthanHeilman](https://github.com/EthanHeilman) ([#626](openpubkey/opkssh#626))
- feat: add GitLab CI provider support [@cgroschupp](https://github.com/cgroschupp) ([#559](openpubkey/opkssh#559))
- fix(verify): Rejects unsafe principals in authorized_keys [@EthanHeilman](https://github.com/EthanHeilman) ([#597](openpubkey/opkssh#597))
- Warn when a policy row matches on an unverified email [@arpitjain099](https://github.com/arpitjain099) ([#594](openpubkey/opkssh#594))
- Support sshd_session_t SELinux domain in installer [@ozan956](https://github.com/ozan956) ([#614](openpubkey/opkssh#614))
- login: load certificate into ssh-agent with configurable lifetime [@sini](https://github.com/sini) ([#611](openpubkey/opkssh#611))
- policy/plugins: marshal GROUPS and AUD env JSON with encoding/json [@SashaMIT](https://github.com/SashaMIT) ([#601](openpubkey/opkssh#601))

##### 🐛 Bug Fixes

- fix(verify): Rejects unsafe principals in authorized_keys [@EthanHeilman](https://github.com/EthanHeilman) ([#597](openpubkey/opkssh#597))
- fix: Policy footguns [@EthanHeilman](https://github.com/EthanHeilman) ([#596](openpubkey/opkssh#596))
- fix: Regression test for --private-key-file arg higher precedence over \~/.ssh/opkssh [@EthanHeilman](https://github.com/EthanHeilman) ([#592](openpubkey/opkssh#592))
- Accept a string email_verified claim in the plugin env vars [@arpitjain099](https://github.com/arpitjain099) ([#595](openpubkey/opkssh#595))
- Deny malformed oidc policy rows instead of panicking [@arpitjain099](https://github.com/arpitjain099) ([#593](openpubkey/opkssh#593))

##### Chores

- dep: Update to OpenPubkey v0.27.0 [@EthanHeilman](https://github.com/EthanHeilman) ([#598](openpubkey/opkssh#598))
- fix(deps): Update release-drafter/release-drafter action to v7.7.0 @[renovate\[bot\]](https://github.com/apps/renovate) ([#590](openpubkey/opkssh#590))
- fix(deps): Update actions/setup-go action to v7 @[renovate\[bot\]](https://github.com/apps/renovate) ([#578](openpubkey/opkssh#578))
- fix(deps): Update release-drafter/release-drafter action to v7.6.0 @[renovate\[bot\]](https://github.com/apps/renovate) ([#581](openpubkey/opkssh#581))
- \[fix] Windows linter errors [@EthanHeilman](https://github.com/EthanHeilman) ([#577](openpubkey/opkssh#577))
- fix(deps): Update zizmorcore/zizmor-action action to v0.6.0 @[renovate\[bot\]](https://github.com/apps/renovate) ([#575](openpubkey/opkssh#575))
- fix(deps): Update Docker @[renovate\[bot\]](https://github.com/apps/renovate) ([#568](openpubkey/opkssh#568))
- Bump testcontainers-go to 0.43.0 [@EthanHeilman](https://github.com/EthanHeilman) ([#571](openpubkey/opkssh#571))
- Update CLI documentation @[github-actions\[bot\]](https://github.com/apps/github-actions) ([#627](openpubkey/opkssh#627))
- fix(deps): Update dependency ubuntu to v26 @[renovate\[bot\]](https://github.com/apps/renovate) ([#616](openpubkey/opkssh#616))
- chore(deps): bump github.com/moby/go-archive from 0.2.0 to 0.3.0 @[dependabot\[bot\]](https://github.com/apps/dependabot) ([#608](openpubkey/opkssh#608))
- fix: reject empty identity attributes in policy [@SashaMIT](https://github.com/SashaMIT) ([#603](openpubkey/opkssh#603))
- fix(deps): Update go toolchain directive to v1.26.6 @[renovate\[bot\]](https://github.com/apps/renovate) ([#605](openpubkey/opkssh#605))

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

Forgejo or Codeberg support

2 participants