mirror of
https://github.com/kerberos-io/agent.git
synced 2026-11-21 22:50:39 +00:00
- JWT signing key: without AGENT_JWT_SECRET, generate a random secret on first start and keep it in data/config/jwt_secret (0600) instead of falling back to a publicly known constant. AGENT_JWT_SECRET still takes precedence, so deployments that share a key with Kerberos Factory are unchanged. - Only tokens for the configured account are authorised, and malformed token claims are rejected instead of panicking. - /ws (live view) and /file (recordings) now require a valid token. The UI passes it as ?token=, since browsers cannot set headers on WebSocket connections or <video src>; it no longer opens the socket before sign-in. /file no longer sends its own wildcard CORS header. - pprof is off by default; AGENT_ENABLE_PPROF=true registers it behind auth. - Release workflows pass tags to shell steps through quoted environment variables and validate them; the shared release-bump workflow is pinned to a commit and no longer receives inherited secrets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
142 lines
4.7 KiB
YAML
142 lines
4.7 KiB
YAML
name: Create a new release
|
|
on:
|
|
release:
|
|
types: [created]
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Tag for the Docker image"
|
|
required: true
|
|
default: "test"
|
|
|
|
env:
|
|
REPO: kerberos/agent
|
|
# Expressions are passed to shell steps through the environment and quoted,
|
|
# never interpolated into the script, so a crafted tag cannot inject commands.
|
|
RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }}
|
|
|
|
jobs:
|
|
build-amd64:
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: write
|
|
strategy:
|
|
matrix:
|
|
architecture: [amd64]
|
|
env:
|
|
ARCH: ${{ matrix.architecture }}
|
|
steps:
|
|
- name: Validate release tag
|
|
run: |
|
|
if [[ ! "${RELEASE_TAG}" =~ ^[A-Za-z0-9._-]+$ ]]; then
|
|
echo "Invalid release tag: only letters, digits, '.', '_' and '-' are allowed." >&2
|
|
exit 1
|
|
fi
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Run Build
|
|
run: |
|
|
docker build --provenance=false --build-arg VERSION="${RELEASE_TAG}" -t "${ARCH}" .
|
|
CID=$(docker create "${ARCH}")
|
|
docker cp "${CID}:/home/agent" "./output-${ARCH}"
|
|
docker rm "${CID}"
|
|
- name: Strip binary
|
|
run: tar -cf "agent-${ARCH}.tar" -C "output-${ARCH}" . && rm -rf "output-${ARCH}"
|
|
- name: Build and push Docker image
|
|
run: |
|
|
docker tag "${ARCH}" "${REPO}-arch:arch-${ARCH}-${RELEASE_TAG}"
|
|
docker push "${REPO}-arch:arch-${ARCH}-${RELEASE_TAG}"
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: agent-${{matrix.architecture}}.tar
|
|
path: agent-${{matrix.architecture}}.tar
|
|
|
|
build-arm64:
|
|
runs-on: ubuntu-24.04-arm
|
|
permissions:
|
|
contents: write
|
|
strategy:
|
|
matrix:
|
|
architecture: [arm64]
|
|
env:
|
|
ARCH: ${{ matrix.architecture }}
|
|
steps:
|
|
- name: Validate release tag
|
|
run: |
|
|
if [[ ! "${RELEASE_TAG}" =~ ^[A-Za-z0-9._-]+$ ]]; then
|
|
echo "Invalid release tag: only letters, digits, '.', '_' and '-' are allowed." >&2
|
|
exit 1
|
|
fi
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Run Build
|
|
run: |
|
|
docker build --provenance=false --build-arg VERSION="${RELEASE_TAG}" -t "${ARCH}" .
|
|
CID=$(docker create "${ARCH}")
|
|
docker cp "${CID}:/home/agent" "./output-${ARCH}"
|
|
docker rm "${CID}"
|
|
- name: Strip binary
|
|
run: tar -cf "agent-${ARCH}.tar" -C "output-${ARCH}" . && rm -rf "output-${ARCH}"
|
|
- name: Build and push Docker image
|
|
run: |
|
|
docker tag "${ARCH}" "${REPO}-arch:arch-${ARCH}-${RELEASE_TAG}"
|
|
docker push "${REPO}-arch:arch-${ARCH}-${RELEASE_TAG}"
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: agent-${{matrix.architecture}}.tar
|
|
path: agent-${{matrix.architecture}}.tar
|
|
|
|
create-manifest:
|
|
runs-on: ubuntu-24.04
|
|
needs: [build-amd64, build-arm64]
|
|
steps:
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Create and push multi-arch manifest
|
|
run: |
|
|
docker manifest create "${REPO}:${RELEASE_TAG}" \
|
|
"${REPO}-arch:arch-amd64-${RELEASE_TAG}" \
|
|
"${REPO}-arch:arch-arm64-${RELEASE_TAG}"
|
|
docker manifest push "${REPO}:${RELEASE_TAG}"
|
|
- name: Create and push latest manifest
|
|
run: |
|
|
docker manifest create "${REPO}:latest" \
|
|
"${REPO}-arch:arch-amd64-${RELEASE_TAG}" \
|
|
"${REPO}-arch:arch-arm64-${RELEASE_TAG}"
|
|
docker manifest push "${REPO}:latest"
|
|
if: github.event.inputs.tag == 'test'
|
|
|
|
create-release:
|
|
runs-on: ubuntu-24.04
|
|
needs: [build-amd64, build-arm64]
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
- name: Create a release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
latest: true
|
|
allowUpdates: true
|
|
name: ${{ github.event.inputs.tag || github.ref_name }}
|
|
tag: ${{ github.event.inputs.tag || github.ref_name }}
|
|
generateReleaseNotes: false
|
|
omitBodyDuringUpdate: true
|
|
artifacts: "agent-*.tar/agent-*.tar"
|