diff --git a/.github/workflows/secret-files-check.yml b/.github/workflows/secret-files-check.yml new file mode 100644 index 0000000..9037244 --- /dev/null +++ b/.github/workflows/secret-files-check.yml @@ -0,0 +1,46 @@ +name: Secret files check + +# Zachytí verzované soubory s klíči a tajemstvími, které GitHub secret scanning +# nevidí (binární keystory .p12/.pfx/.jks, .env, privátní klíče). ADR 008. +# Vypisuje jen CESTY souborů, nikdy jejich obsah. + +on: + push: + branches: ["main", "master"] + pull_request: + branches: ["main", "master"] + +jobs: + secret-files: + name: Secret files check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Verzované soubory s klíči a tajemstvími + shell: bash + run: | + set -u + bad=0 + # 1) Podle názvu souboru: .env a binární keystory (šablony .example/.sample/.template/.dist jsou povolené). + # Soubory .pem/.key se posuzují jen podle obsahu (krok 2), protože mohou nést i veřejné certifikáty. + names=$(git ls-files | grep -Ei '(^|/)(\.env(\.[A-Za-z0-9_-]+)?|[^/]*\.(p12|pfx|jks|keystore))$' \ + | grep -Eiv '\.(example|sample|template|dist)$' || true) + if [ -n "$names" ]; then + echo "::error::Ve verzi jsou soubory, které nepatří do gitu (jen cesty):" + echo "$names" | sed 's/^/ - /' + bad=1 + fi + # 2) Podle obsahu: hlavička privátního klíče (vypíše jen názvy souborů) + keys=$(git grep -lI -E -e '-----BEGIN ((RSA|EC|DSA|OPENSSH|ENCRYPTED) )?PRIVATE KEY-----' -- . ':!*.md' ':!docs' ':!tests' || true) + if [ -n "$keys" ]; then + echo "::error::Soubory s hlavičkou privátního klíče (jen cesty):" + echo "$keys" | sed 's/^/ - /' + bad=1 + fi + if [ "$bad" -ne 0 ]; then + echo "Postup: soubor odstranit z gitu, klíč považovat za kompromitovaný a rotovat (ADR 008). Vzor držet jako *.example." + exit 1 + fi + echo "OK: žádné verzované klíče ani .env." diff --git a/.gitignore b/.gitignore index 80d65f1..95dd040 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,7 @@ pip-selfcheck.json *.p12 *.pfx *.jks + +# lokální konfigurace (vzor: template.env) +elk/.env +elk-dev/.env diff --git a/elk-dev/.env b/elk-dev/.env deleted file mode 100644 index f99c11a..0000000 --- a/elk-dev/.env +++ /dev/null @@ -1,2 +0,0 @@ -ELK_VERSION=7.15.1 -SERVER_NAME=ronald.sysnet.cz \ No newline at end of file diff --git a/elk/.env b/elk/.env deleted file mode 100644 index 2c47ee4..0000000 --- a/elk/.env +++ /dev/null @@ -1,2 +0,0 @@ -ELK_VERSION=7.6.2 -SERVER_NAME=eap.sysnet.cz \ No newline at end of file diff --git a/qgis/.env.windows b/qgis/.env.windows.example similarity index 100% rename from qgis/.env.windows rename to qgis/.env.windows.example diff --git a/qgis/.gitignore b/qgis/.gitignore index 310c254..5db1a7d 100644 --- a/qgis/.gitignore +++ b/qgis/.gitignore @@ -9,3 +9,9 @@ .env + +# lokální kopie z *.example (ADR 008) + +elk/.env +elk-dev/.env +.env.windows diff --git a/qgis/README.md b/qgis/README.md index 61825ba..8efda91 100644 --- a/qgis/README.md +++ b/qgis/README.md @@ -43,9 +43,10 @@ You can execute same commands as Linux part given above if you use `make` (optio Or in command powershell execute: ``` +copy .env.windows.example .env.windows docker-compose --env-file .env.windows up ``` -Or if you want to test specific version, you can edit .env.windows and change (here last 3.3.x version): +`.env.windows` is a local copy (not versioned, see `.gitignore`). Or if you want to test specific version, you can edit it and change (here last 3.3.x version): ``` LIZMAP_VERSION_TAG=3.3