diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..de65a5c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +# Reviewers for this repository. Enforce through branch protection ("Require review from Code +# Owners") on main, so the release-critical paths below cannot be changed unreviewed. +* @yunyingk diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..adf3948 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +version: 2 +updates: + # Both workflows pin actions to commit SHAs, so nothing updates them implicitly — this is what + # keeps the pins from silently rotting, and it is the only reviewer-visible record of an action + # bump. + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + groups: + github-actions: + patterns: ["*"] + + - package-ecosystem: bun + directory: / + schedule: + interval: weekly + open-pull-requests-limit: 5 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4563bbb..09e3c56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,10 +22,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - name: Setup Bun - uses: oven-sh/setup-bun@v2 + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: bun-version: 1.3.14 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9486aa..a66f6a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,12 +25,40 @@ jobs: timeout-minutes: 15 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: fetch-depth: 0 + # The tag is the publish trigger, but on its own it says nothing about review: `contents: + # write` plus any pushed tag would ship binaries built from an unreviewed commit, and the + # manual dispatch input can name a tag that was never merged. Require the tagged commit to + # be an ancestor of origin/main, i.e. to have gone through the protected branch. + - name: Verify the release tag is on main + env: + TAG_NAME: ${{ github.event.inputs.tag || github.ref_name }} + run: | + if [ -z "${TAG_NAME}" ]; then + echo "::error::Could not resolve a release tag from this event." + exit 1 + fi + + git fetch --no-tags origin main + if ! git rev-parse --verify --quiet "refs/tags/${TAG_NAME}" >/dev/null; then + if ! git fetch --no-tags origin "refs/tags/${TAG_NAME}:refs/tags/${TAG_NAME}"; then + echo "::error::'${TAG_NAME}' is not a tag in this repository. Pass the release tag as the workflow input." + exit 1 + fi + fi + + TAG_COMMIT=$(git rev-list -n 1 "refs/tags/${TAG_NAME}") + if ! git merge-base --is-ancestor "${TAG_COMMIT}" origin/main; then + echo "::error::Tag ${TAG_NAME} (${TAG_COMMIT}) is not an ancestor of origin/main. Merge it through a PR first, then re-tag." + exit 1 + fi + echo "✓ ${TAG_NAME} -> ${TAG_COMMIT} is on main" + - name: Setup Bun - uses: oven-sh/setup-bun@v2 + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: bun-version: 1.3.14 @@ -75,7 +103,7 @@ jobs: gh release upload "${TAG_NAME}" dist/bin/seal-use-* dist/bin/checksums.txt --repo "${GITHUB_REPOSITORY}" --clobber - name: Upload binaries artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 continue-on-error: true with: name: release-binaries @@ -85,13 +113,15 @@ jobs: publish-gitea: name: 📦 Sync Gitea Mirror needs: build-and-publish-github - if: ${{ always() }} + # Mirror only a release that was actually published. `always()` also ran this after the + # tag-on-main guard refused to publish, so the mirror chased assets that were never built. + if: ${{ !cancelled() && needs.build-and-publish-github.result == 'success' }} runs-on: ubuntu-latest timeout-minutes: 60 continue-on-error: true steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: fetch-depth: 0 diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..26a88d3 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,53 @@ +# Security Policy + +## Reporting a vulnerability + +Please report suspected vulnerabilities privately — do not open a public issue. + +- Preferred: GitHub private vulnerability reporting, via the **Security** tab of + . +- The maintainer listed in `package.json` is the fallback contact. + +Include the version (`seal-use version`), the platform, and a minimal reproduction. Expect an +initial response within a few business days — this is a small project, not a staffed security team. + +## What this tool holds + +`seal-use` keeps tenant credentials on the machine that runs it: + +| Path | Contents | Mode | +| --- | --- | --- | +| `~/.config/seal-use/seal_tokens.json` | Session tokens and derived keys | `0600` | +| `~/.config/seal-use/enterprises/*.json` | Per-enterprise Hose app key/password or Seal bearer token | `0600` | +| `enterprises/*.json` (working tree) | Same, for enterprises added from a checkout | `0600` | +| `~/.config/seal-use/usage.json` | Per-enterprise command counts | `0600` | + +The tool writes these `0600`; a config placed by hand can keep the `0o644` default, so +`seal-use doctor` reports any credential file whose mode is wider than `0600`. Real enterprise +configs are gitignored — never commit them. + +## Trust model and documented limitations + +These are deliberate trade-offs, not unknown bugs. Report them anyway if you can make one worse +than described here. + +- **The local HTTP adapter does not authenticate requests.** `seal-use http` and + `seal-use service start` serve `/api/cli`, `/v1/*` and `/shutdown` on `127.0.0.1:8787` with no + token check and `Access-Control-Allow-Origin: *`; the adapter acts with the credentials already + stored on the machine. It is a local automation surface. Keep it bound to loopback, and do not + run it on a shared or multi-user host. See the `securitySchemes.localSession` note in + `openapi/openapi.yaml`. +- **Self-update and the install script do not verify signatures.** `seal-use update` downloads a + release binary and replaces the running executable; `scripts/install.sh` compares + `checksums.txt` but only warns on a mismatch. Prefer the direct GitHub source + (`SEAL_USE_MIRROR=github`, which skips the third-party mirrors) and pass an explicit + `SEAL_USE_VERSION` when installing. +- **Custom rule linters are code that gets executed.** Files under `/linters/` and + `~/.config/seal-use/linters/` are imported into the CLI process by `seal-use rules lint`, with + that process's filesystem access and enterprise credentials. Treat those directories as trusted + code and do not run the CLI from an untrusted checkout. See `linters/README.md`. + +## Supported versions + +Fixes land on `main` and ship in the next tagged release; only the latest release is supported. +Release binaries are published to GitHub Releases and mirrored to Gitea.