Skip to content

fix: harden installer and stores; bump Go 1.27, dependencies, and actions - #40

Merged
sgtoj merged 2 commits into
mainfrom
chore/deps-and-bugfixes
Nov 4, 2026
Merged

sgtoj merged 2 commits into
mainfrom
chore/deps-and-bugfixes

Conversation

@sgtoj

@sgtoj sgtoj commented Nov 4, 2026

Copy link
Copy Markdown
Member

Summary

Routine dependency chores plus a round of bug and security fixes found while reviewing the library. Split into two commits: build(deps) for version bumps and fix for code changes.

Dependencies

Dependency From To
Go (go.mod, CI, example image) 1.25 1.27
alpine (example runtime image) 3.21 3.24
github.com/aws/aws-sdk-go-v2 1.41.1 1.47.5
github.com/aws/aws-sdk-go-v2/config 1.32.7 1.33.13
github.com/aws/aws-sdk-go-v2/service/ssm 1.67.8 1.81.2
github.com/chainguard-dev/clog 1.8.0 1.8.1
actions/checkout 6.0.2 7.0.1
actions/setup-go 6.2.0 7.0.0
mathieudutour/github-tag-action 6.2.0 7.0.0
ncipollo/release-action 1.20.0 1.21.0

All actions are pinned to commit SHAs with # vX.X.X comments and are the latest releases older than 5 days. amannn/action-semantic-pull-request is already at its latest (v6.1.1).

github-tag-action v7 changes release semantics (see its migration guide): it emits an empty new_tag when there are no eligible commits, feat!: now triggers a major bump, and commits containing [no-release]/[skip-release] are excluded. The release workflow now skips "Create Release" when no tag is produced and serializes runs with a concurrency group. The existing custom_release_rules format is unchanged in v7.

Note that bumping the go directive to 1.27 requires consumers of this library to use Go 1.27+.

Fixes

Security

  • Credential overwrite after disabling the installer. /callback ignored the disabled flag, so anyone who could reach it could exchange a code from their own GitHub App manifest and replace the saved credentials. It now returns 404 once the installer is disabled.
  • Readiness gate bypass. Allowed paths were matched as raw string prefixes on the uncleaned path, so /setupadmin and /setup/../webhook passed the gate before the service was ready, and an empty AllowedPaths entry opened the gate entirely. Allowed paths now match on segment boundaries, non-canonical paths (dot segments, repeated slashes) never bypass the gate, and empty entries are ignored.
  • Path traversal in LocalFileStore. Custom field keys were turned into filenames without validation, allowing writes outside the store directory (../../x, absolute paths) or overwriting managed files (e.g. PRIVATE_KEY.PEM, or creating the installer-disabled marker). Such keys are now rejected before anything is written.
  • The installer now path-escapes the org name and app slug when building URLs.

Correctness

  • SSM saves always failed when tags were configured. PutParameter was sent with both Tags and Overwrite, which SSM rejects. Parameters are now created with tags and fall back to an untagged overwrite when they already exist. The test mock now enforces SSM's rules so this is covered.
  • .env store corrupted unrelated lines. Every save re-serialized the whole file: escaped quotes gained backslashes each time, inline comments were absorbed into values, and single-quoted values lost their quotes. Only updated keys are rewritten now, and appended keys are written in a stable order.
  • Runtime stuck not-ready after a successful reload. If Start gave up (e.g. using StartAsync before the installer was completed), a later successful reload from the installer or SIGHUP never opened the gate. Successful reloads now mark the runtime ready, and reload failures are logged instead of silently dropped.
  • MaxRetries <= 0 reported success without loading. configwait.Wait, the Lambda loader, and ssmresolver.ResolveEnvironmentWithRetry now always attempt at least once.
  • OnCredentialsSaved was invoked before the credentials were saved (contrary to its docs) and ran even when the save failed. It now runs only after a successful save.
  • SSM parameter ARNs in non-aws partitions (aws-us-gov, aws-cn, aws-iso*) are now recognized.
  • A trailing slash in GITHUB_URL no longer produces a malformed API URL.
  • EnsureLoaded and Reload docs now describe the actual behavior.

Behavior changes to be aware of

  • AllowedPaths entries no longer act as raw string prefixes: "/api" still allows "/api/..." but no longer "/apikeys". Requests with non-canonical paths get a 503 before the service is ready.
  • LocalFileStore.Save returns an error for custom field keys that are not plain file names or that collide with reserved credential files.

Testing

  • go vet, gofmt, go mod tidy -diff, and actionlint are clean.
  • Unit and integration tests pass with -race.
  • Every new regression test was confirmed to fail against the previous code. That includes a new integration scenario, disabled_installer_rejects_callback, which shows the stored app being replaced on the old code.
  • The example Docker image builds on golang:1.27-alpine / alpine:3.24.

Supersedes #25, #29, #37, #38, #39.

🤖 Generated with Claude Code

sgtoj and others added 2 commits November 4, 2026 10:15
- go from 1.25 to 1.27 (go.mod, CI, example image golang:1.27-alpine)
- example runtime image alpine from 3.21 to 3.24
- github.com/aws/aws-sdk-go-v2 from 1.41.1 to 1.47.5
- github.com/aws/aws-sdk-go-v2/config from 1.32.7 to 1.33.13
- github.com/aws/aws-sdk-go-v2/service/ssm from 1.67.8 to 1.81.2
- github.com/chainguard-dev/clog from 1.8.0 to 1.8.1
- actions/checkout from 6.0.2 to 7.0.1
- actions/setup-go from 6.2.0 to 7.0.0
- mathieudutour/github-tag-action from 6.2.0 to 7.0.0
- ncipollo/release-action from 1.20.0 to 1.21.0
- release: skip creating a release when github-tag-action v7 produces no
  tag, and serialize release runs with a concurrency group

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- installer: reject /callback once the installer is disabled so saved
  credentials cannot be replaced by exchanging another app's code
- installer: invoke OnCredentialsSaved only after a successful save
- installer: escape org and app slug in generated URLs and trim a
  trailing slash from GITHUB_URL
- configwait: match allowed paths on segment boundaries and never let
  non-canonical paths (dot segments, repeated slashes) bypass the gate;
  ignore empty allowed-path entries
- configstore/files: reject custom field keys that escape the store
  directory or collide with reserved credential files
- configstore/aws-ssm: create tagged parameters without overwrite and
  fall back to an untagged overwrite, since SSM rejects tags+overwrite
- configstore/envfile: rewrite only updated keys and preserve all other
  lines verbatim instead of re-quoting the whole file on every save
- ghappsetup/configwait: mark the runtime ready after a successful
  reload and log reload failures
- configwait/ghappsetup/ssmresolver: always attempt at least once when
  MaxRetries is zero or negative instead of reporting success
- ssmresolver: recognize SSM ARNs in all AWS partitions
- ghappsetup: correct EnsureLoaded and Reload documentation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.

1 participant