security: require authentication everywhere and drop the default JWT key

- 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>
This commit is contained in:
Cédric Verstraeten
2026-11-21 22:17:28 +00:00
co-authored by Claude Opus 5.5
parent 37ebcfe641
commit c0baade8fd
12 changed files with 467 additions and 86 deletions
+34 -24
View File
@@ -22,10 +22,12 @@ env:
jobs:
# Determine the next version, create the GitHub release and expose the tag.
bump-release:
uses: uug-ai/workflows/.github/workflows/release-bump.yml@main
# Pinned to a reviewed commit of uug-ai/workflows so changes there cannot
# alter this release without a change here. It only needs GITHUB_TOKEN,
# which GitHub provides to called workflows, so no secrets are passed on.
uses: uug-ai/workflows/.github/workflows/release-bump.yml@6c1805abf25ac34add01d4af711277e8a68945ab # main as of 2026-11-20
with:
bump: ${{ github.event.inputs.bump }}
secrets: inherit
# Publish the platform image to the uug-ai GitHub Container Registry
# (ghcr.io/uug-ai/agent-platform).
@@ -56,6 +58,9 @@ jobs:
strategy:
matrix:
architecture: [amd64]
env:
ARCH: ${{ matrix.architecture }}
RELEASE_TAG: ${{ needs.bump-release.outputs.tag }}
steps:
- name: Login to DockerHub
uses: docker/login-action@v3
@@ -66,16 +71,16 @@ jobs:
uses: actions/checkout@v4
- name: Run Build
run: |
docker build --provenance=false --build-arg VERSION=${{ needs.bump-release.outputs.tag }} -t ${{matrix.architecture}} .
CID=$(docker create ${{matrix.architecture}})
docker cp ${CID}:/home/agent ./output-${{matrix.architecture}}
docker rm ${CID}
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-${{matrix.architecture}}.tar -C output-${{matrix.architecture}} . && rm -rf output-${{matrix.architecture}}
run: tar -cf "agent-${ARCH}.tar" -C "output-${ARCH}" . && rm -rf "output-${ARCH}"
- name: Build and push Docker image
run: |
docker tag ${{matrix.architecture}} $REPO-arch:arch-${{matrix.architecture}}-${{ needs.bump-release.outputs.tag }}
docker push $REPO-arch:arch-${{matrix.architecture}}-${{ needs.bump-release.outputs.tag }}
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:
@@ -90,6 +95,9 @@ jobs:
strategy:
matrix:
architecture: [arm64]
env:
ARCH: ${{ matrix.architecture }}
RELEASE_TAG: ${{ needs.bump-release.outputs.tag }}
steps:
- name: Login to DockerHub
uses: docker/login-action@v3
@@ -100,16 +108,16 @@ jobs:
uses: actions/checkout@v4
- name: Run Build
run: |
docker build --provenance=false --build-arg VERSION=${{ needs.bump-release.outputs.tag }} -t ${{matrix.architecture}} .
CID=$(docker create ${{matrix.architecture}})
docker cp ${CID}:/home/agent ./output-${{matrix.architecture}}
docker rm ${CID}
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-${{matrix.architecture}}.tar -C output-${{matrix.architecture}} . && rm -rf output-${{matrix.architecture}}
run: tar -cf "agent-${ARCH}.tar" -C "output-${ARCH}" . && rm -rf "output-${ARCH}"
- name: Build and push Docker image
run: |
docker tag ${{matrix.architecture}} $REPO-arch:arch-${{matrix.architecture}}-${{ needs.bump-release.outputs.tag }}
docker push $REPO-arch:arch-${{matrix.architecture}}-${{ needs.bump-release.outputs.tag }}
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:
@@ -119,6 +127,8 @@ jobs:
create-manifest:
runs-on: ubuntu-24.04
needs: [bump-release, build-amd64, build-arm64]
env:
RELEASE_TAG: ${{ needs.bump-release.outputs.tag }}
steps:
- name: Login to DockerHub
uses: docker/login-action@v3
@@ -127,16 +137,16 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create and push multi-arch manifest
run: |
docker manifest create $REPO:${{ needs.bump-release.outputs.tag }} \
$REPO-arch:arch-amd64-${{ needs.bump-release.outputs.tag }} \
$REPO-arch:arch-arm64-${{ needs.bump-release.outputs.tag }}
docker manifest push $REPO:${{ needs.bump-release.outputs.tag }}
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-${{ needs.bump-release.outputs.tag }} \
$REPO-arch:arch-arm64-${{ needs.bump-release.outputs.tag }}
docker manifest push $REPO:latest
docker manifest create "${REPO}:latest" \
"${REPO}-arch:arch-amd64-${RELEASE_TAG}" \
"${REPO}-arch:arch-arm64-${RELEASE_TAG}"
docker manifest push "${REPO}:latest"
create-release:
runs-on: ubuntu-24.04
+41 -22
View File
@@ -11,6 +11,9 @@ on:
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:
@@ -20,7 +23,15 @@ jobs:
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:
@@ -30,16 +41,16 @@ jobs:
uses: actions/checkout@v4
- name: Run Build
run: |
docker build --provenance=false --build-arg VERSION=${{github.event.inputs.tag || github.ref_name}} -t ${{matrix.architecture}} .
CID=$(docker create ${{matrix.architecture}})
docker cp ${CID}:/home/agent ./output-${{matrix.architecture}}
docker rm ${CID}
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-${{matrix.architecture}}.tar -C output-${{matrix.architecture}} . && rm -rf output-${{matrix.architecture}}
run: tar -cf "agent-${ARCH}.tar" -C "output-${ARCH}" . && rm -rf "output-${ARCH}"
- name: Build and push Docker image
run: |
docker tag ${{matrix.architecture}} $REPO-arch:arch-${{matrix.architecture}}-${{github.event.inputs.tag || github.ref_name}}
docker push $REPO-arch:arch-${{matrix.architecture}}-${{github.event.inputs.tag || github.ref_name}}
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:
@@ -53,7 +64,15 @@ jobs:
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:
@@ -63,16 +82,16 @@ jobs:
uses: actions/checkout@v4
- name: Run Build
run: |
docker build --provenance=false --build-arg VERSION=${{github.event.inputs.tag || github.ref_name}} -t ${{matrix.architecture}} .
CID=$(docker create ${{matrix.architecture}})
docker cp ${CID}:/home/agent ./output-${{matrix.architecture}}
docker rm ${CID}
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-${{matrix.architecture}}.tar -C output-${{matrix.architecture}} . && rm -rf output-${{matrix.architecture}}
run: tar -cf "agent-${ARCH}.tar" -C "output-${ARCH}" . && rm -rf "output-${ARCH}"
- name: Build and push Docker image
run: |
docker tag ${{matrix.architecture}} $REPO-arch:arch-${{matrix.architecture}}-${{github.event.inputs.tag || github.ref_name}}
docker push $REPO-arch:arch-${{matrix.architecture}}-${{github.event.inputs.tag || github.ref_name}}
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:
@@ -90,16 +109,16 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create and push multi-arch manifest
run: |
docker manifest create $REPO:${{ github.event.inputs.tag || github.ref_name }} \
$REPO-arch:arch-amd64-${{github.event.inputs.tag || github.ref_name}} \
$REPO-arch:arch-arm64-${{github.event.inputs.tag || github.ref_name}}
docker manifest push $REPO:${{ github.event.inputs.tag || github.ref_name }}
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-${{github.event.inputs.tag || github.ref_name}} \
$REPO-arch:arch-arm64-${{github.event.inputs.tag || github.ref_name}}
docker manifest push $REPO:latest
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: