Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions .github/workflows/sentinel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,32 @@ jobs:
doppler-config: ${{ vars.DOPPLER_CONFIG }}
inject-env-vars: true

- name: Check email secrets
- name: Apply GitHub email secret fallback
if: github.event_name != 'schedule' || steps.schedule.outputs.should_run == 'true'
env:
SENTINEL_EMAIL_TO: ${{ secrets.SENTINEL_EMAIL_TO }}
SENTINEL_EMAIL_FROM: ${{ secrets.SENTINEL_EMAIL_FROM }}
SENTINEL_GMAIL_USER: ${{ secrets.SENTINEL_GMAIL_USER }}
SENTINEL_GMAIL_APP_PASSWORD: ${{ secrets.SENTINEL_GMAIL_APP_PASSWORD }}
GITHUB_SENTINEL_EMAIL_TO: ${{ secrets.SENTINEL_EMAIL_TO }}
GITHUB_SENTINEL_EMAIL_FROM: ${{ secrets.SENTINEL_EMAIL_FROM }}
GITHUB_SENTINEL_GMAIL_USER: ${{ secrets.SENTINEL_GMAIL_USER }}
GITHUB_SENTINEL_GMAIL_APP_PASSWORD: ${{ secrets.SENTINEL_GMAIL_APP_PASSWORD }}
GITHUB_SENTINEL_ICLOUD_USER: ${{ secrets.SENTINEL_ICLOUD_USER }}
GITHUB_SENTINEL_ICLOUD_APP_PASSWORD: ${{ secrets.SENTINEL_ICLOUD_APP_PASSWORD }}
run: |
for name in \
SENTINEL_EMAIL_TO \
SENTINEL_EMAIL_FROM \
SENTINEL_GMAIL_USER \
SENTINEL_GMAIL_APP_PASSWORD \
SENTINEL_ICLOUD_USER \
SENTINEL_ICLOUD_APP_PASSWORD
do
fallback_name="GITHUB_${name}"
if [ -z "${!name:-}" ] && [ -n "${!fallback_name:-}" ]; then
echo "${name}=${!fallback_name}" >> "$GITHUB_ENV"
fi
done

- name: Check email secrets
if: github.event_name != 'schedule' || steps.schedule.outputs.should_run == 'true'
run: |
missing=0
for name in \
Expand Down Expand Up @@ -106,13 +125,6 @@ jobs:
- name: Scan
id: scan
if: github.event_name != 'schedule' || steps.schedule.outputs.should_run == 'true'
env:
SENTINEL_EMAIL_TO: ${{ secrets.SENTINEL_EMAIL_TO }}
SENTINEL_EMAIL_FROM: ${{ secrets.SENTINEL_EMAIL_FROM }}
SENTINEL_GMAIL_USER: ${{ secrets.SENTINEL_GMAIL_USER }}
SENTINEL_GMAIL_APP_PASSWORD: ${{ secrets.SENTINEL_GMAIL_APP_PASSWORD }}
SENTINEL_ICLOUD_USER: ${{ secrets.SENTINEL_ICLOUD_USER }}
SENTINEL_ICLOUD_APP_PASSWORD: ${{ secrets.SENTINEL_ICLOUD_APP_PASSWORD }}
run: |
set +e
npm run sentinel -- scan
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ ignoredIssues:

## Email

Le password SMTP non vanno committate. Usa variabili d'ambiente, GitHub Secrets o Portachiavi macOS.
Le password SMTP non vanno committate. Usa variabili d'ambiente, Doppler,
GitHub Secrets o Portachiavi macOS.

Variabili previste:

Expand All @@ -87,7 +88,8 @@ SENTINEL_ICLOUD_USER=
SENTINEL_ICLOUD_APP_PASSWORD=
```

Per il workflow GitHub Actions attuale, che usa il profilo `gmail`, sono obbligatori questi repository secrets prima di avviare una scansione:
Per il workflow GitHub Actions attuale, che usa il profilo `gmail`, queste
variabili devono arrivare da Doppler o, come fallback, da repository secrets:

```bash
SENTINEL_EMAIL_TO
Expand All @@ -96,7 +98,9 @@ SENTINEL_GMAIL_USER
SENTINEL_GMAIL_APP_PASSWORD
```

Se uno di questi secrets manca, il workflow fallisce subito prima di installare dipendenze, eseguire test, build o scan.
Se uno di questi valori manca dopo l'iniezione Doppler e il fallback GitHub
Secrets, il workflow fallisce subito prima di installare dipendenze, eseguire
test, build o scan.

Su macOS, se la password non è in env, Sentinel prova a leggere dal Portachiavi i servizi `sentinel-gmail` o `sentinel-icloud`.

Expand Down
5 changes: 4 additions & 1 deletion docs/TOOLCHAIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Questa pagina descrive runtime, comandi e guardrail effettivi di Sentinel.
| Vercel Blob | privato | payload dinamico dashboard e ultimi report |
| GitHub Actions | `ubuntu-latest`, Node `22` | runtime operativo schedulato/manuale |
| Dependabot | configurazione GitHub | aggiornamenti dipendenze npm e GitHub Actions |
| SMTP Gmail | secret GitHub o env locale | invio email operativo |
| SMTP Gmail | Doppler, secret GitHub o env locale | invio email operativo |
| Portachiavi macOS | servizi `sentinel-gmail` e `sentinel-icloud` | fallback locale per password email |

## Comandi
Expand Down Expand Up @@ -72,6 +72,9 @@ Questa pagina descrive runtime, comandi e guardrail effettivi di Sentinel.
secondo ADR `docs/decisions/0003-tag-e-github-release.md`.
- Il workflow esegue scan, genera `reports/dashboard.html` e può committare
`data/`, `snapshots/` e `reports/`.
- Nel workflow operativo i valori email arrivano da Doppler quando configurato;
i repository secrets `SENTINEL_*` restano fallback e non devono sovrascrivere
variabili già iniettate.
- Il workflow deve fallire se c'è un errore tecnico o se un'email necessaria non
parte.
- Quando GitHub Actions non è disponibile o non è raggiungibile,
Expand Down
Loading