Compare commits

...
4 Commits
Author SHA1 Message Date
BlackAngelTV 10688cfe6f fix(ci): keep packaging files and shebang noise out of the shell scan
security / secrets (push) Successful in 10s
security / shell (push) Successful in 4s
security / sast (push) Successful in 25s
security / dependencies (push) Successful in 48s
version / print-version (push) Successful in 4s
2026-12-06 18:47:28 +01:00
BlackAngelTV 20e8359cd3 ci(security): add secret, dependency, shell and injection scans
security / secrets (push) Successful in 12s
security / dependencies (push) Successful in 10s
security / shell (push) Failing after 5s
version / print-version (push) Successful in 6s
security / sast (push) Successful in 24s
2026-12-06 18:40:17 +01:00
BlackAngelTV ec93adedcc chore(release): 0.3.1
version / print-version (push) Successful in 2s
package / package (push) Successful in 14s
2026-11-20 10:43:21 +01:00
BlackAngelTV 6e5738635c docs: explain how to register a runner 2026-11-20 10:43:21 +01:00
6 changed files with 298 additions and 2 deletions

No files matched your search

+137
View File
@@ -0,0 +1,137 @@
name: security
# Shared security gate for FWS repositories: leaked credentials, known
# vulnerabilities in the dependencies, shell injection patterns and, through
# opengrep, the language level injection rules (SQL, command, template, XSS).
# Every tool is a static binary downloaded at run time so the job does not
# depend on what the runner image happens to ship.
on:
push:
pull_request:
schedule:
- cron: '0 4 * * 1'
workflow_dispatch:
permissions:
contents: read
env:
GITLEAKS_VERSION: '8.28.0'
OSV_SCANNER_VERSION: '2.7.1'
SHELLCHECK_VERSION: '0.10.0'
OPENGREP_VERSION: '2.1.0'
jobs:
secrets:
name: secrets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# `dir` scans the checkout rather than the history: a credential that was
# removed from the tree must not keep the gate red forever, and the tree
# is what a pull request introduces. A repository that needs to allowlist
# fixtures ships a .gitleaks.toml next to this file.
- name: Scan the tree for credentials
run: |
set -euo pipefail
curl -fsSL -o "$RUNNER_TEMP/gitleaks.tgz" \
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
tar -xzf "$RUNNER_TEMP/gitleaks.tgz" -C "$RUNNER_TEMP" gitleaks
config=()
[ -f .gitleaks.toml ] && config=(--config .gitleaks.toml)
"$RUNNER_TEMP/gitleaks" dir . --no-banner --redact --verbose --exit-code 1 "${config[@]}"
dependencies:
name: dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# OSV reads the lockfiles it recognises (npm, pip, Go, Cargo, Composer…)
# and answers from osv.dev. A repository without a lockfile passes instead
# of failing, so the same workflow fits every stack in the organisation.
- name: Scan dependencies for known vulnerabilities
run: |
set -euo pipefail
curl -fsSL -o "$RUNNER_TEMP/osv-scanner" \
"https://github.com/google/osv-scanner/releases/download/v${OSV_SCANNER_VERSION}/osv-scanner_linux_amd64"
chmod +x "$RUNNER_TEMP/osv-scanner"
"$RUNNER_TEMP/osv-scanner" scan source --recursive --allow-no-lockfiles --format table .
shell:
name: shell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install shellcheck
run: |
set -euo pipefail
curl -fsSL -o "$RUNNER_TEMP/shellcheck.tar.xz" \
"https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz"
tar -xJf "$RUNNER_TEMP/shellcheck.tar.xz" -C "$RUNNER_TEMP"
- name: Collect the shell scripts
run: |
set -euo pipefail
# PKGBUILD files are bash without a shebang, so shellcheck would report
# SC2148 on every one of them: makepkg sources them, the gate does not.
git ls-files -z '*.sh' '*.bash' > "$RUNNER_TEMP/scripts"
printf '%s shell files to check\n' "$(tr -cd '\0' < "$RUNNER_TEMP/scripts" | wc -c)"
# SC2086/SC2046 and friends are the shapes an injection takes in shell.
# They stay advisory for now: existing scripts would turn the gate red on
# their first run, so warnings are reported and errors block. SC2148 (no
# shebang) and SC2068 (array quoting, inherited from vendored shell
# integrations) are not signals this gate can act on.
- name: Shellcheck warnings (advisory)
continue-on-error: true
run: |
set -o pipefail
[ -s "$RUNNER_TEMP/scripts" ] || { echo "No shell scripts in this repository."; exit 0; }
xargs -0 -a "$RUNNER_TEMP/scripts" -r \
"$RUNNER_TEMP/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" -x --format=gcc --severity=warning \
--exclude=SC2148,SC2068
- name: Shellcheck errors
run: |
set -euo pipefail
[ -s "$RUNNER_TEMP/scripts" ] || { echo "No shell scripts in this repository."; exit 0; }
xargs -0 -a "$RUNNER_TEMP/scripts" -r \
"$RUNNER_TEMP/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" -x --severity=error \
--exclude=SC2148,SC2068
sast:
name: sast
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Install opengrep
run: |
set -euo pipefail
curl -fsSL -o "$RUNNER_TEMP/opengrep" \
"https://github.com/opengrep/opengrep/releases/download/v${OPENGREP_VERSION}/opengrep_linux_x86"
chmod +x "$RUNNER_TEMP/opengrep"
# Advisory on purpose: the rules flag real injection shapes (SQL, command,
# template, XSS) but also patterns that a codebase already reviewed. Run
# it blocking once the reported findings have been triaged and the false
# positives allowlisted in .semgrepignore.
- name: Injection and unsafe-pattern scan (advisory)
continue-on-error: true
run: |
set -uo pipefail
args=()
git ls-files '*.php' | grep -q . && args+=(--config p/php) || true
git ls-files '*.js' '*.mjs' '*.cjs' '*.ts' | grep -q . && args+=(--config p/javascript) || true
git ls-files '*.py' | grep -q . && args+=(--config p/python) || true
git ls-files '*.go' | grep -q . && args+=(--config p/golang) || true
if [ "${#args[@]}" -eq 0 ]; then
echo "No supported source files in this repository."
exit 0
fi
"$RUNNER_TEMP/opengrep" scan "${args[@]}" --severity ERROR \
--exclude 3rdparty --exclude node_modules --exclude vendor --exclude external .
+1 -1
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)
project(FWS-DeskManager VERSION 0.3.0 LANGUAGES CXX)
project(FWS-DeskManager VERSION 0.3.1 LANGUAGES CXX)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR "FWS-DeskManager targets Linux with systemd-logind.")
+7
View File
@@ -207,6 +207,13 @@ src/session-switcher.{h,cpp} Activation de session, retour au greeter
src/session-launcher.{h,cpp} Démarrage sans greeter (autologin ponctuel)
```
## Intégration continue
Deux workflows Gitea : `version.yml` (lecture du fichier `version`) et
`package.yml` (paquet Arch signé, release et publication sur `repo.laxacube.ch`,
déclenché uniquement par un changement de `version`). Ils tournent sur des runners
auto-hébergés ; voir [`docs/runner.md`](docs/runner.md) pour en ajouter un.
## Feuille de route
Issues suivies dans le projet **FWS - DeskManager** sur Gitea. Prochaines étapes :
+151
View File
@@ -0,0 +1,151 @@
# Ajouter un runner
Les workflows de ce dépôt tournent sur des runners **auto-hébergés**, pas sur
l'infrastructure de Gitea. Les runners d'organisation `arch-host-docker-*` déclarent
chacun deux labels :
| Workflow | Label demandé (`runs-on`) | Ce qu'il faut sur la machine |
|----------|---------------------------|------------------------------|
| `version.yml` | `ubuntu-latest` | rien de particulier (lecture du fichier `version`) |
| `package.yml` | `arch-host` | Arch Linux, `makepkg` et les dépendances du `PKGBUILD` |
Un job n'est pris que par un runner déclarant **exactement** le nom du label. Ajouter
une machine revient donc à lui donner les labels voulus.
## 1. Prérequis sur la machine
Pour un runner `arch-host` sur Arch Linux :
```bash
sudo pacman -S --needed base-devel git cmake pkgconf gtk4 polkit jq curl nodejs
```
- `base-devel` fournit `makepkg` et `fakeroot` ; `jq` et `curl` servent aux appels API
des workflows, `gpg` (déjà présent) signe le paquet.
- **`nodejs` est obligatoire même en mode hôte** : les actions comme
`actions/checkout@v4` sont des actions JavaScript exécutées par le runner.
- Le runner doit tourner sous un **utilisateur non-root** : `makepkg` refuse de
s'exécuter en root.
- Éviter un répertoire de travail sur un montage NTFS : pacman crée des répertoires
contenant `:` (epoch) que NTFS refuse.
## 2. Enregistrer le runner
Le projet s'appelle désormais [`gitea/runner`](https://gitea.com/gitea/runner)
(anciennement `act_runner`) ; le binaire est `gitea-runner`, version actuelle `v6.0.1`.
1. Récupérer un **token d'enregistrement** (usage unique, expire en une heure) :
```bash
# runner d'organisation (même endpoint sous /repos/FWS/FWS-DeskManger pour un
# runner limité à ce dépôt)
curl -sS -X POST -H "Authorization: token $GITEA_TOKEN" \
https://gitea.nocode-var.tech/api/v1/orgs/FWS/actions/runners/registration-token \
| jq -r .token
```
Le même token s'obtient dans l'interface : *Settings de l'organisation → Actions →
Runners*. Le token d'administration (`/admin/actions/runners`) enregistre un runner
pour toute l'instance.
2. Installer le binaire et l'enregistrer :
```bash
mkdir -p ~/gitea-runner && cd ~/gitea-runner
curl -sSLo gitea-runner \
https://gitea.com/gitea/runner/releases/download/v6.0.1/gitea-runner-6.0.1-linux-amd64
chmod +x gitea-runner
./gitea-runner register --no-interactive \
--instance https://gitea.nocode-var.tech \
--token "<TOKEN_D_ENREGISTREMENT>" \
--name arch-host-docker-5 \
--labels "arch-host:host,ubuntu-latest:host"
```
Un label s'écrit `<nom>[:<schema>]` : `host` exécute les étapes **directement sur
la machine** (schéma par défaut), `docker://<image>` dans un conteneur,
`kubernetes://<image>` dans un pod. Pour ne prendre que le packaging, garder
seulement `arch-host:host`.
L'enregistrement écrit un fichier `.runner` : c'est l'identité du runner, il est
**secret** et ne doit jamais être versionné.
## 3. Configurer et lancer
```bash
./gitea-runner config init # écrit config.yaml avec les valeurs par défaut
```
Les seules clés à ajuster :
```yaml
runner:
file: .runner
capacity: 1 # un build à la fois : makepkg est gourmand
timeout: 3h
host:
workdir_parent: /var/lib/gitea-runner # défaut : $HOME/.cache/act/
```
Puis un service systemd, avec un utilisateur dédié :
```ini
# /etc/systemd/system/gitea-runner.service
[Unit]
Description=Gitea Actions runner
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=gitea-runner
WorkingDirectory=/home/gitea-runner/gitea-runner
ExecStart=/home/gitea-runner/gitea-runner/gitea-runner daemon --config /home/gitea-runner/gitea-runner/config.yaml
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
```
```bash
sudo systemctl daemon-reload
sudo systemctl enable --now gitea-runner
journalctl -u gitea-runner -f # doit afficher le polling des tâches
```
Dans le compte courant : `systemctl --user enable --now gitea-runner`, avec
`loginctl enable-linger` pour que le service survive à la déconnexion.
## 4. Vérifier
```bash
# runners d'organisation (remplacer /orgs/FWS par /repos/FWS/FWS-DeskManger
# pour un runner enregistré au niveau du dépôt)
curl -sS -H "Authorization: token $GITEA_TOKEN" \
https://gitea.nocode-var.tech/api/v1/orgs/FWS/actions/runners \
| jq -r '.[] | [.name, .status, ([.labels[].name] | join(","))] | @tsv'
```
Le nouveau runner doit apparaître en `online` avec ses labels, et *Settings → Actions
→ Runners* doit le montrer **Idle**. Ensuite : *Actions → version → Run workflow* ; le
job doit s'exécuter sur cette machine et afficher `FWS-DeskManager version: …`.
## Bon à savoir
- Plusieurs runners avec le même label = répartition automatique des jobs. La
publication d'une release reste sérialisée par le `concurrency: package` du
workflow, donc deux runners ne peuvent pas se disputer le même tag.
- Les secrets (`GPG_PRIVATE_KEY`, `REPO_TOKEN`, `GITEA_TOKEN`) sont fournis par Gitea
au moment du job : rien à stocker sur la machine. En contrepartie, le runner lit les
secrets du dépôt — machine de confiance, utilisateur dédié, aucun accès à des
fichiers personnels.
- Supprimer un runner (interface, ou
`DELETE /api/v1/orgs/FWS/actions/runners/{id}`) révoque son `.runner` ; le token
d'enregistrement expire seul. Un `config.yml` local sans `.runner` ne se réenregistre
pas : le dossier peut être supprimé sans risque.
- Un runner peut cumuler les schémas : `arch-host:host` et
`ubuntu-latest:docker://node:22` si Docker ou Podman (`podman.socket` actif) est
installé. Dans ce cas, les actions JavaScript tournent dans l'image, pas sur l'hôte.
@@ -48,6 +48,7 @@
</categories>
<releases>
<release version="0.3.1" date="2026-11-20"/>
<release version="0.3.0" date="2026-11-20"/>
<release version="0.2.0" date="2026-11-16"/>
</releases>
+1 -1
View File
@@ -1 +1 @@
0.3.0
0.3.1