Skip to content

feat: GitHub App authentication - #35

Merged
alpoi merged 3 commits into
mainfrom
feat/github-app-auth
Oct 28, 2026
Merged

alpoi merged 3 commits into
mainfrom
feat/github-app-auth

Conversation

@alpoi

@alpoi alpoi commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lets the plugin authenticate as a GitHub App installation as an alternative to a token. Organizations can govern apps centrally, and the plugin only holds short-lived installation tokens, which ghinstallation renews as they expire.

This is the same change as compliance-framework/plugin-github-repositories#43, which re-implements @gusfcarvalho's compliance-framework/plugin-github-repositories#3. It uses the same config keys:

plugins:
  dependabot:
    config:
      app_id: "123456"
      installation_id: "78901234"
      private_key_file: /etc/ccf/github-app.pem   # or private_key: <PEM or base64 PEM>
      organization: octocat

Changes

  • auth.go: AuthConfig is embedded in PluginConfig (mapstructure:",squash", so the keys stay flat) and carried on ParsedConfig.Auth, which replaces ParsedConfig.Token. It validates the credentials and builds the authenticated http.Client behind the go-github client.

  • Behaviour for existing configs is unchanged:

    • token still wins when set.
    • With no credentials at all, the plugin still calls GitHub unauthenticated, as before.
    • Only incomplete app credentials are a Configure error (for example GitHub App authentication needs installation_id).
  • main_integration_test.go: the PluginConfig literals now set AuthConfig{Token: ...}.

  • Tests for validation, the token, file, base64 and PEM paths, bad input, and decoding of the agent's flat config map. README: an authentication section with a GitHub App setup guide.

  • Underscores, not hyphens, unlike included-repositories and the plugin's other keys. The agent fills plugin config from CCF_* environment variables by uppercasing the key and replacing dots only, so a hyphenated app-id would need CCF_PLUGINS_DEPENDABOT_CONFIG_APP-ID, which shells can't set. local-dev and the hosted demo pass credentials this way, for example CCF_PLUGINS_DEPENDABOT_CONFIG_PRIVATE_KEY. The README notes this.

Wiring

  • gRPC round trip: auth_grpc_test.go sends Configure through go-plugin's in-process gRPC harness (TestPluginGRPCConn with runner.RunnerV2GRPCPlugin), the same path the agent uses. The agent sends config as a flat map<string, string>, and the plugin decodes it after the gRPC hop, so the embedded AuthConfig (mapstructure:",squash") never affects the wire format. The tests cover the token-only config every deployment sends today, an app config with the empty keys agent configs declare, and incomplete app credentials. Without squash they fail.
  • local-dev: compliance-framework/local-dev#135 declares the app keys in the showcase agent config (the agent only fills keys the file declares from CCF_* environment variables) and teaches the demo-go-check-github pre-flight about app credentials.

Testing

  • go vet ./..., go vet -tags integration ./... and go test ./... pass.
  • golangci-lint v2.11.4 with the shared config reports nothing in the changed lines. The seven warnings it prints are already on main.
  • I haven't run it against a real GitHub App installation.

🤖 Generated with Claude Code

Besides a token, the plugin can now authenticate as a GitHub App installation
(app-id, installation-id, and private-key-file or private-key), using
short-lived installation tokens that ghinstallation renews. A token still wins
when set, and with neither the plugin stays unauthenticated as before; only
incomplete app credentials are rejected.

Ports compliance-framework/plugin-github-repositories#43 (itself based on
plugin-github-repositories#3), with this plugin's hyphenated config keys.

Co-authored-by: Gustavo Carvalho <gustavo@externalsecrets.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8cf7b740-a267-4119-bdde-467f7a57d111
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

alpoi and others added 2 commits October 28, 2026 14:49
The agent maps plugin config keys to CCF_* environment variables by
uppercasing them and replacing dots, not hyphens, so app-id and friends could
not be set from the environment (CCF_PLUGINS_DEPENDABOT_CONFIG_APP-ID is not a
valid variable name). Use app_id, installation_id, private_key_file and
private_key, the same keys as plugin-github-repositories and
plugin-github-settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The agent sends plugin config over gRPC as a flat map<string, string>, which
the plugin decodes into PluginConfig with the embedded, squashed AuthConfig.
These tests send Configure through go-plugin's in-process gRPC harness: the
token config every deployment sends today, a GitHub App config (with the
empty keys agent configs declare for environment injection), and incomplete
app credentials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alpoi
alpoi merged commit 6ec409e into main Oct 28, 2026
24 checks passed
@alpoi
alpoi deleted the feat/github-app-auth branch October 28, 2026 15:13
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