Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
603ba976e1 | ||
|
|
ad1cea23ab | ||
|
|
b5b5a0e820 | ||
|
|
60666bf79d | ||
|
|
099ffe7e8f | ||
|
|
bd5507d6ef | ||
|
|
3ba8b7b667 | ||
|
|
52dcbf3607 | ||
|
|
e28a537f79 | ||
|
|
b87ac72d78 | ||
|
|
ca367b6918 | ||
|
|
9037f2dd69 | ||
|
|
3a27fde176 | ||
|
|
d3acae2bd8 | ||
|
|
ad0a715a4c | ||
|
|
f7095f8057 | ||
|
|
67fbda60d3 | ||
|
|
5280b84d12 | ||
|
|
b42a81018c | ||
|
|
5c85763de1 | ||
|
|
2aacb60102 | ||
|
|
c4247b8bbc | ||
|
|
c29bafeccc | ||
|
|
fe4bed91d7 | ||
|
|
3abf908ca4 | ||
|
|
9c8e8f54dc | ||
|
|
1e59781d77 | ||
|
|
ead3393211 | ||
|
|
48beb692dc | ||
|
|
fe4b189697 | ||
|
|
c1e79d07e4 | ||
|
|
5de962b2c6 | ||
|
|
bc150bf225 | ||
|
|
31b8a86861 | ||
|
|
dda60313f0 |
@@ -47,6 +47,16 @@ OBSIGATE_ADMIN_PASSWORD=chab30
|
|||||||
# Ignored directories (séparés par des virgules)
|
# Ignored directories (séparés par des virgules)
|
||||||
# OBSIGATE_IGNORED_DIRS=.obsidian,.trash,.git,__pycache__,node_modules,.obsigate-backup
|
# OBSIGATE_IGNORED_DIRS=.obsidian,.trash,.git,__pycache__,node_modules,.obsigate-backup
|
||||||
|
|
||||||
|
# Vaults DIR (DIR_N_NAME / DIR_N_PATH dans le compose) — options par vault :
|
||||||
|
# DIR_N_READONLY=true : lecture seule déclarée (mutations refusées
|
||||||
|
# en 403, actions d'écriture masquées dans l'UI)
|
||||||
|
# DIR_N_IGNORED_DIRS=.home,.venv : noms de dossiers cachés pour CE vault
|
||||||
|
# (toute profondeur, en plus du global)
|
||||||
|
# DIR_N_IGNORED_PATHS=Executeurs/*/data,Executeurs/*/.env
|
||||||
|
# : motifs fnmatch sur le chemin relatif dans
|
||||||
|
# le vault (un dossier qui matche cache son
|
||||||
|
# sous-arbre) — navigation, lecture, index
|
||||||
|
|
||||||
# Audit
|
# Audit
|
||||||
# OBSIGATE_AUDIT_MAX_SIZE=10485760
|
# OBSIGATE_AUDIT_MAX_SIZE=10485760
|
||||||
|
|
||||||
|
|||||||
+29
-17
@@ -12,7 +12,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
# ── Lint ──────────────────────────────────────────────────────────
|
# ── Lint ──────────────────────────────────────────────────────────
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ci-deepin
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ jobs:
|
|||||||
# ── Tests ─────────────────────────────────────────────────────────
|
# ── Tests ─────────────────────────────────────────────────────────
|
||||||
test:
|
test:
|
||||||
needs: lint
|
needs: lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ci-deepin
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ jobs:
|
|||||||
|
|
||||||
# ── Security scan ─────────────────────────────────────────────────
|
# ── Security scan ─────────────────────────────────────────────────
|
||||||
security:
|
security:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ci-deepin
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ jobs:
|
|||||||
# ── Docker build ──────────────────────────────────────────────────
|
# ── Docker build ──────────────────────────────────────────────────
|
||||||
build:
|
build:
|
||||||
needs: test
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ci-deepin
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ jobs:
|
|||||||
# ── E2E Tests (Playwright) ─────────────────────────────────────────
|
# ── E2E Tests (Playwright) ─────────────────────────────────────────
|
||||||
e2e:
|
e2e:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ci-deepin
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -272,7 +272,13 @@ jobs:
|
|||||||
- name: Start ObsiGate
|
- name: Start ObsiGate
|
||||||
run: |
|
run: |
|
||||||
docker rm -f obsigate-e2e 2>/dev/null || true
|
docker rm -f obsigate-e2e 2>/dev/null || true
|
||||||
docker create --name obsigate-e2e -p 2029:8080 \
|
# DinD robuste : PAS de port publié (les ports 2029 fuités par des
|
||||||
|
# runs antérieurs font échouer « docker start », et l'IP passerelle
|
||||||
|
# du job n'est pas toujours joignable → boucle de health curls sans
|
||||||
|
# timeout qui pendaient 150 s chacun). À la place, l'app est
|
||||||
|
# rattachée au réseau du job et jointable par nom DNS embarqué.
|
||||||
|
JOBNET=$(docker inspect -f '{{range $k, $v := .NetworkSettings.Networks}}{{$k}} {{end}}' "$(hostname)" 2>/dev/null | awk '{print $1}')
|
||||||
|
docker create --name obsigate-e2e \
|
||||||
-v $(pwd)/test_vault:/vaults/TestVault \
|
-v $(pwd)/test_vault:/vaults/TestVault \
|
||||||
-v $(pwd)/test_dir:/vaults/TestDir \
|
-v $(pwd)/test_dir:/vaults/TestDir \
|
||||||
-e VAULT_1_NAME=TestVault \
|
-e VAULT_1_NAME=TestVault \
|
||||||
@@ -288,17 +294,22 @@ jobs:
|
|||||||
# fixtures avant le démarrage (l'indexeur scanne au démarrage).
|
# fixtures avant le démarrage (l'indexeur scanne au démarrage).
|
||||||
docker cp test_vault/. obsigate-e2e:/vaults/TestVault
|
docker cp test_vault/. obsigate-e2e:/vaults/TestVault
|
||||||
docker cp test_dir/. obsigate-e2e:/vaults/TestDir
|
docker cp test_dir/. obsigate-e2e:/vaults/TestDir
|
||||||
|
if [ -n "$JOBNET" ]; then docker network connect "$JOBNET" obsigate-e2e || true; fi
|
||||||
docker start obsigate-e2e
|
docker start obsigate-e2e
|
||||||
# Le port publié est joignable via l'IP de la passerelle (localhost
|
if [ -n "$JOBNET" ]; then
|
||||||
# du job container ne voit pas le port publié sur l'hôte).
|
APP_URL="http://obsigate-e2e:8080"
|
||||||
GW=$(ip route show default | awk '{print $3}' || echo 172.17.0.1)
|
else
|
||||||
echo "Gateway IP: $GW"
|
echo "Réseau du job introuvable (JOBNET vide) — impossible de localiser l'app sans port publié"
|
||||||
# Wait for health check
|
exit 1
|
||||||
for i in $(seq 1 30); do
|
fi
|
||||||
if curl -sf "http://$GW:2029/api/health"; then echo "Health OK"; break; fi
|
echo "APP_URL: $APP_URL"
|
||||||
|
# --max-time : ne JAMAIS pendre sans timeout (bug d'origine : curls
|
||||||
|
# sans timeout = 150 s × 31 tentatives, job « bloqué »).
|
||||||
|
for i in $(seq 1 40); do
|
||||||
|
if curl -sf --max-time 3 "$APP_URL/api/health"; then echo "Health OK"; break; fi
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
curl -sf "http://$GW:2029/api/health" >/dev/null || { echo "App not reachable at $GW:2029"; exit 1; }
|
curl -sf --max-time 5 "$APP_URL/api/health" >/dev/null || { echo "App not reachable at $APP_URL"; docker logs --tail 40 obsigate-e2e; exit 1; }
|
||||||
# Les fixtures sont copiées via `docker cp` en root → rendre le vault
|
# Les fixtures sont copiées via `docker cp` en root → rendre le vault
|
||||||
# inscriptible par l'utilisateur non-root de l'app (UID 1000), sinon
|
# inscriptible par l'utilisateur non-root de l'app (UID 1000), sinon
|
||||||
# toute création/édition de fichier renvoie 403 « Vault is read-only ».
|
# toute création/édition de fichier renvoie 403 « Vault is read-only ».
|
||||||
@@ -306,9 +317,10 @@ jobs:
|
|||||||
|
|
||||||
- name: Run E2E tests
|
- name: Run E2E tests
|
||||||
run: |
|
run: |
|
||||||
GW=$(ip route show default | awk '{print $3}' || echo 172.17.0.1)
|
BASE_URL="http://obsigate-e2e:8080"
|
||||||
echo "Using BASE_URL=http://$GW:2029"
|
docker exec obsigate-e2e true >/dev/null 2>&1 || { echo "obsigate-e2e n'est pas en marche"; exit 1; }
|
||||||
BASE_URL="http://$GW:2029" npx playwright test --project=chromium-desktop --reporter=list
|
echo "Using BASE_URL=$BASE_URL"
|
||||||
|
BASE_URL="$BASE_URL" npx playwright test --project=chromium-desktop --reporter=list
|
||||||
|
|
||||||
- name: Upload test results
|
- name: Upload test results
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
+19
-1
@@ -6,7 +6,7 @@ Format basé sur [Keep a Changelog](https://keepachangelog.com/fr/1.1.0/),
|
|||||||
et [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
et [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
> **En cours de développement** : les changements à venir sont listés dans la section
|
> **En cours de développement** : les changements à venir sont listés dans la section
|
||||||
> [Unreleased](#unreleased). La dernière version livrée est **2.82.6**.
|
> [Unreleased](#unreleased). La dernière version livrée est **2.83.0**.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -14,6 +14,24 @@ et [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## [2.83.0] — 2026-11-03
|
||||||
|
|
||||||
|
- **Vaults DIR : exclusions par vault et lecture seule déclarable** (prépare le vault « Spark ») : trois nouvelles variables par vault DIR — `DIR_N_READONLY=true` (les mutations sont refusées en 403 « read_only » et l'arborescence n'affiche plus les actions d'écriture pour ce vault), `DIR_N_IGNORED_DIRS=.home,.venv,…` (noms de dossiers cachés à toute profondeur, en plus du global `IGNORED_DIRS`) et `DIR_N_IGNORED_PATHS=Executeurs/*/data,…` (motifs fnmatch sur le chemin relatif ; un dossier qui matche cache tout son sous-arbre). Les exclusions s'appliquent désormais **partout** — navigation (`/api/browse`), lecture (`/api/file`, `raw`, téléchargement : 404), liste des chemins et indexation — et plus seulement à l'indexeur. `/api/vaults` expose `readonly` pour chaque vault. Sans ces variables, comportement inchangé. Fiche : `docs/features/spark-vault-dir.md`. Tests : `tests/test_spark_vault_dir.py`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [2.82.8] — 2026-10-30
|
||||||
|
|
||||||
|
- **Panneau détail d'un secret : Afficher/Masquer + Copier la valeur** (PR #57) : la valeur reste masquée (••••••) par défaut ; Afficher la révèle en place, Masquer l'efface (effacée aussi dès que le détail change). « Copier la valeur » copie au presse-papiers sans afficher. Le bouton « Copier » existant ne copiait que la référence.
|
||||||
|
- **Nouvel endpoint `POST /api/coffres/{slug}/secrets/{nom}/reveler`** : session + gestion du coffre exigées (propriétaire, ou admin sur coffre d'instance) ; un lecteur par octroi utilisateur reçoit 403. Chaque révélation est auditée (`revelation_manuelle`) et met à jour la dernière utilisation. Ce n'est pas une distribution : aucun octroi créé, aucun consommateur ne reçoit la valeur.
|
||||||
|
- **Suppression de la « Copie manuelle à usage unique »** par consommateur temporaire : elle échouait systématiquement (aucun octroi pour le consommateur temporaire, donc 403 octroi_absent) ; « Copier la valeur » la remplace.
|
||||||
|
- **Tests** : `tests/test_coffre_secrets.py` 44/44 (5 nouveaux TestRevelation).
|
||||||
|
|
||||||
|
## [2.82.7] — 2026-10-29
|
||||||
|
|
||||||
|
- **Barre commune (dracodev-commons v0.1.11 vendangée)** : la marque de la barre n'est plus le logo rouge — c'est l'étoile Spark monochrome (`frontend/img/brand-spark.png`, servi en `/static/img/brand-spark.png`, 26 px), blanche sur barre foncée et noire sur barre claire : ObsiGate pose déjà `data-theme` sur `<html>` (sombre par défaut, mode persisté), donc la règle vendangée `[data-theme="dark"] .draco-bar .draco-brand-mark img { filter: none; }` s'applique directement et aucune surcharge propre n'est nécessaire. L'onglet Console Spark (et son entrée de menu, qui le clone) GARDE le logo rouge. Le bouton avatar Spark flottant bas-centre gagne un anneau rouge `#c00000` (bordure 3 px, `var(--agent)`), via le CSS vendangé.
|
||||||
|
- **Pages concernées** : la barre est rendue en ligne dans `frontend/index.html` et dans sa copie de `frontend/recherche.html` — les deux sont portées à la v0.1.11 ; `frontend/draco-barre.css` remplacé verbatim par la v0.1.11, `frontend/draco-barre.js` inchangé (identique à commons, lui-même inchangé en v0.1.11). Le reste de l'intégration est inchangé. Précision : sur `/recherche`, copie statique, le bouton flottant y est visuel seulement, comme au lot précédent — l'ouverture du panneau vit dans la SPA.
|
||||||
|
|
||||||
## [2.82.6] — 2026-10-29
|
## [2.82.6] — 2026-10-29
|
||||||
|
|
||||||
- **Barre commune (dracodev-commons v0.1.10 vendangée)** : le rose Spark `#c2437e` disparaît de la barre — `--agent` passe au rouge Spark `#c00000` (échantillonné dans le logo Spark), l'onglet Console Spark passe à `--app #c00000`, et la marque ✦ devient le logo Spark (26 px). Le bouton « Spark » rose de la barre est supprimé, remplacé par le bouton avatar Spark flottant bas-centre (cercle personnage, `frontend/img/avatar-spark.png`, servi en `/static/img/avatar-spark.png`, `data-act="spark"` → panneau Spark de l'hôte, comme l'ancien bouton). Le bouton Alertes n'affiche plus que la cloche (pastille conservée), donc une barre plus étroite.
|
- **Barre commune (dracodev-commons v0.1.10 vendangée)** : le rose Spark `#c2437e` disparaît de la barre — `--agent` passe au rouge Spark `#c00000` (échantillonné dans le logo Spark), l'onglet Console Spark passe à `--app #c00000`, et la marque ✦ devient le logo Spark (26 px). Le bouton « Spark » rose de la barre est supprimé, remplacé par le bouton avatar Spark flottant bas-centre (cercle personnage, `frontend/img/avatar-spark.png`, servi en `/static/img/avatar-spark.png`, `data-act="spark"` → panneau Spark de l'hôte, comme l'ancien bouton). Le bouton Alertes n'affiche plus que la cloche (pastille conservée), donc une barre plus étroite.
|
||||||
|
|||||||
+3
-3
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
**Porte d'entrée web ultra-léger pour vos vaults Obsidian** — Accédez, naviguez et recherchez dans toutes vos notes Obsidian depuis n'importe quel appareil via une interface web moderne et responsive.
|
**Porte d'entrée web ultra-léger pour vos vaults Obsidian** — Accédez, naviguez et recherchez dans toutes vos notes Obsidian depuis n'importe quel appareil via une interface web moderne et responsive.
|
||||||
|
|
||||||
[]()
|
[]()
|
||||||
[](https://opensource.org/licenses/MIT)
|
[](https://opensource.org/licenses/MIT)
|
||||||
[](https://www.docker.com/)
|
[](https://www.docker.com/)
|
||||||
[](https://www.python.org/)
|
[](https://www.python.org/)
|
||||||
@@ -977,8 +977,8 @@ Ce projet est sous licence **MIT** — voir le fichier [LICENSE](LICENSE) pour l
|
|||||||
|
|
||||||
## 📝 Changelog
|
## 📝 Changelog
|
||||||
|
|
||||||
Consultez le [CHANGELOG.md](./CHANGELOG.md) pour l'historique complet de toutes les versions (v1.0.0 → v2.81.1).
|
Consultez le [CHANGELOG.md](./CHANGELOG.md) pour l'historique complet de toutes les versions (v1.0.0 → v2.83.0).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*Projet : ObsiGate | Version : 2.81.1 | Dernière mise à jour : Septembre 2026*
|
*Projet : ObsiGate | Version : 2.83.0 | Dernière mise à jour : Septembre 2026*
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
**Ultra-light web gateway for your Obsidian vaults** — Access, browse, and search all your Obsidian notes from any device via a modern, responsive web interface.
|
**Ultra-light web gateway for your Obsidian vaults** — Access, browse, and search all your Obsidian notes from any device via a modern, responsive web interface.
|
||||||
|
|
||||||
[]()
|
[]()
|
||||||
[](https://opensource.org/licenses/MIT)
|
[](https://opensource.org/licenses/MIT)
|
||||||
[](https://www.docker.com/)
|
[](https://www.docker.com/)
|
||||||
[](https://www.python.org/)
|
[](https://www.python.org/)
|
||||||
@@ -1152,8 +1152,8 @@ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE)
|
|||||||
|
|
||||||
## 📝 Changelog
|
## 📝 Changelog
|
||||||
|
|
||||||
See [CHANGELOG.md](./CHANGELOG.md) for the complete version history (v1.0.0 → v2.81.1).
|
See [CHANGELOG.md](./CHANGELOG.md) for the complete version history (v1.0.0 → v2.83.0).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*Project: ObsiGate | Version: 2.81.1 | Last updated: September 2026*
|
*Project: ObsiGate | Version: 2.83.0 | Last updated: September 2026*
|
||||||
|
|||||||
+44
-4
@@ -97,6 +97,13 @@ def load_vault_config() -> dict[str, dict[str, Any]]:
|
|||||||
Also reads optional configuration:
|
Also reads optional configuration:
|
||||||
- VAULT_N_ATTACHMENTS_PATH: relative path to attachments folder
|
- VAULT_N_ATTACHMENTS_PATH: relative path to attachments folder
|
||||||
- VAULT_N_SCAN_ATTACHMENTS: "true"/"false" to enable/disable scanning
|
- VAULT_N_SCAN_ATTACHMENTS: "true"/"false" to enable/disable scanning
|
||||||
|
- DIR_N_READONLY: "true"/"false" — vault DIR déclaré en lecture seule
|
||||||
|
(les mutations sont refusées en 403, l'UI masque les actions d'écriture)
|
||||||
|
- DIR_N_IGNORED_DIRS: noms de dossiers ignorés pour ce vault, séparés
|
||||||
|
par des virgules (toute profondeur, en plus du global IGNORED_DIRS)
|
||||||
|
- DIR_N_IGNORED_PATHS: motifs fnmatch sur le chemin relatif POSIX dans
|
||||||
|
le vault, séparés par des virgules (un dossier qui matche cache tout
|
||||||
|
son sous-arbre) — navigation, lecture et indexation les respectent
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Dict mapping vault names to configuration dicts with keys:
|
Dict mapping vault names to configuration dicts with keys:
|
||||||
@@ -104,6 +111,9 @@ def load_vault_config() -> dict[str, dict[str, Any]]:
|
|||||||
- attachmentsPath: relative attachments folder (optional)
|
- attachmentsPath: relative attachments folder (optional)
|
||||||
- scanAttachmentsOnStartup: boolean (default True)
|
- scanAttachmentsOnStartup: boolean (default True)
|
||||||
- type: "VAULT" or "DIR"
|
- type: "VAULT" or "DIR"
|
||||||
|
- readonly: boolean (DIR only, default False)
|
||||||
|
- ignoredDirs: set of directory names (DIR only, default empty)
|
||||||
|
- ignoredPaths: list of fnmatch patterns (DIR only, default empty)
|
||||||
"""
|
"""
|
||||||
vaults: dict[str, dict[str, Any]] = {}
|
vaults: dict[str, dict[str, Any]] = {}
|
||||||
n = 1
|
n = 1
|
||||||
@@ -131,12 +141,23 @@ def load_vault_config() -> dict[str, dict[str, Any]]:
|
|||||||
path = os.environ.get(f"DIR_{n}_PATH")
|
path = os.environ.get(f"DIR_{n}_PATH")
|
||||||
if not name or not path:
|
if not name or not path:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
readonly = os.environ.get(f"DIR_{n}_READONLY", "false").lower() == "true"
|
||||||
|
ignored_dirs = {
|
||||||
|
d.strip() for d in os.environ.get(f"DIR_{n}_IGNORED_DIRS", "").split(",") if d.strip()
|
||||||
|
}
|
||||||
|
ignored_paths = [
|
||||||
|
p.strip() for p in os.environ.get(f"DIR_{n}_IGNORED_PATHS", "").split(",") if p.strip()
|
||||||
|
]
|
||||||
|
|
||||||
vaults[name] = {
|
vaults[name] = {
|
||||||
"path": path,
|
"path": path,
|
||||||
"attachmentsPath": None,
|
"attachmentsPath": None,
|
||||||
"scanAttachmentsOnStartup": False,
|
"scanAttachmentsOnStartup": False,
|
||||||
"type": "DIR"
|
"type": "DIR",
|
||||||
|
"readonly": readonly,
|
||||||
|
"ignoredDirs": ignored_dirs,
|
||||||
|
"ignoredPaths": ignored_paths,
|
||||||
}
|
}
|
||||||
n += 1
|
n += 1
|
||||||
|
|
||||||
@@ -509,7 +530,8 @@ def _scan_vault(
|
|||||||
Args:
|
Args:
|
||||||
vault_name: Display name of the vault.
|
vault_name: Display name of the vault.
|
||||||
vault_path: Absolute filesystem path to the vault root.
|
vault_path: Absolute filesystem path to the vault root.
|
||||||
vault_cfg: Optional vault configuration dict (unused for indexing, kept for compatibility).
|
vault_cfg: Optional vault configuration dict — ses exclusions
|
||||||
|
(``ignoredDirs`` / ``ignoredPaths``) sont appliquées au scan.
|
||||||
previous_files: Optional ``{relative_path: file_info}`` snapshot from a
|
previous_files: Optional ``{relative_path: file_info}`` snapshot from a
|
||||||
previous scan used for differential reuse.
|
previous scan used for differential reuse.
|
||||||
|
|
||||||
@@ -529,6 +551,16 @@ def _scan_vault(
|
|||||||
|
|
||||||
root_resolved = vault_root.resolve(strict=False)
|
root_resolved = vault_root.resolve(strict=False)
|
||||||
|
|
||||||
|
# Exclusions propres au vault (DIR_N_IGNORED_DIRS / DIR_N_IGNORED_PATHS) :
|
||||||
|
# elles s'ajoutent au global IGNORED_DIRS, sans le modifier. Le cfg est
|
||||||
|
# celui passé par l'appelant — l'index global ne contient pas encore ce
|
||||||
|
# vault pendant son premier scan, chemin_exclu() (qui lit l'index) ne
|
||||||
|
# peut donc pas servir ici.
|
||||||
|
from backend.services.vaults import chemin_exclu_dans_config
|
||||||
|
|
||||||
|
cfg = vault_cfg or {}
|
||||||
|
ignored_names = IGNORED_DIRS | set(cfg.get("ignoredDirs") or [])
|
||||||
|
|
||||||
# BUG-032: walk without following symlinks and refuse any symlink that
|
# BUG-032: walk without following symlinks and refuse any symlink that
|
||||||
# escapes the vault root, so external data can never be indexed/exposed.
|
# escapes the vault root, so external data can never be indexed/exposed.
|
||||||
for dirpath, dirnames, filenames in os.walk(vault_root, followlinks=False):
|
for dirpath, dirnames, filenames in os.walk(vault_root, followlinks=False):
|
||||||
@@ -537,7 +569,11 @@ def _scan_vault(
|
|||||||
# Prune ignored and symlinked directories in place (no recursion).
|
# Prune ignored and symlinked directories in place (no recursion).
|
||||||
dirnames[:] = [
|
dirnames[:] = [
|
||||||
d for d in dirnames
|
d for d in dirnames
|
||||||
if d not in IGNORED_DIRS and not (current_dir / d).is_symlink()
|
if d not in ignored_names
|
||||||
|
and not (current_dir / d).is_symlink()
|
||||||
|
and not chemin_exclu_dans_config(
|
||||||
|
cfg, str((current_dir / d).relative_to(vault_root)).replace("\\", "/")
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
for d in dirnames:
|
for d in dirnames:
|
||||||
@@ -565,6 +601,10 @@ def _scan_vault(
|
|||||||
|
|
||||||
rel_path_str = str(fpath.relative_to(vault_root)).replace("\\", "/")
|
rel_path_str = str(fpath.relative_to(vault_root)).replace("\\", "/")
|
||||||
|
|
||||||
|
# Exclusion propre au vault (motif de chemin, ex. un .env ciblé).
|
||||||
|
if chemin_exclu_dans_config(cfg, rel_path_str):
|
||||||
|
continue
|
||||||
|
|
||||||
ext = fpath.suffix.lower()
|
ext = fpath.suffix.lower()
|
||||||
# Also match extensionless files named like Dockerfile, Makefile
|
# Also match extensionless files named like Dockerfile, Makefile
|
||||||
basename_lower = fpath.name.lower()
|
basename_lower = fpath.name.lower()
|
||||||
|
|||||||
@@ -22,10 +22,12 @@ httpx>=0.27.0
|
|||||||
# l'utilisateur). #224 : la version préinstallée dans la toolcache du
|
# l'utilisateur). #224 : la version préinstallée dans la toolcache du
|
||||||
# runner (6.19.0) est frappée par 11 CVE supplémentaires (dont
|
# runner (6.19.0) est frappée par 11 CVE supplémentaires (dont
|
||||||
# CVE-2026-113786, CVE-2026-115572, CVE-2026-115585, CVE-2026-115580),
|
# CVE-2026-113786, CVE-2026-115572, CVE-2026-115585, CVE-2026-115580),
|
||||||
# corrigées au plus tard en 6.21.2 — le plancher doit être >= 6.21.2 :
|
# corrigées au plus tard en 6.21.2. La 6.21.2 est à son tour frappée
|
||||||
|
# (CVE-2026-119203 et suivantes, relevées par le job security sur main),
|
||||||
|
# corrigées en 6.21.4 — le plancher doit être >= 6.21.4 :
|
||||||
# en dessous, pip répond « already satisfied » pour la toolcache et
|
# en dessous, pip répond « already satisfied » pour la toolcache et
|
||||||
# n'aligne jamais (même piège que BUG-093).
|
# n'aligne jamais (même piège que BUG-093).
|
||||||
pypdf>=6.21.2
|
pypdf>=6.21.4
|
||||||
pyotp>=2.10.0
|
pyotp>=2.10.0
|
||||||
segno>=1.5.0
|
segno>=1.5.0
|
||||||
webauthn==2.6.0
|
webauthn==2.6.0
|
||||||
@@ -79,3 +81,9 @@ cryptography>=44.0
|
|||||||
# Plancher de securite : msgpack est transitif, version 1.2.1 relevee par le job
|
# Plancher de securite : msgpack est transitif, version 1.2.1 relevee par le job
|
||||||
# security (pip-audit, bloquant) — CVE-2026-114613, corrigee en 1.2.3.
|
# security (pip-audit, bloquant) — CVE-2026-114613, corrigee en 1.2.3.
|
||||||
msgpack>=1.2.3
|
msgpack>=1.2.3
|
||||||
|
# Plancher de sécurité : pyasn1 est transitive (python-jose/rsa), version
|
||||||
|
# 0.6.4 relevée par le job security (pip-audit, bloquant) —
|
||||||
|
# CVE-2026-119194 à CVE-2026-119197, corrigées en 0.6.5. Sans plancher
|
||||||
|
# explicite, pip répond « already satisfied » pour la toolcache et
|
||||||
|
# n'aligne jamais (même piège que BUG-093).
|
||||||
|
pyasn1>=0.6.5
|
||||||
|
|||||||
@@ -12,6 +12,14 @@ Règles d'or, appliquées côté serveur à chaque requête :
|
|||||||
- Seul ``POST /api/coffres/distribuer`` rend une valeur, et uniquement à
|
- Seul ``POST /api/coffres/distribuer`` rend une valeur, et uniquement à
|
||||||
un consommateur authentifié par jeton (hash + jti, jamais la session
|
un consommateur authentifié par jeton (hash + jti, jamais la session
|
||||||
utilisateur), avec un octroi actif et un contexte obligatoire.
|
utilisateur), avec un octroi actif et un contexte obligatoire.
|
||||||
|
- Seule exception, voulue : ``POST /api/coffres/{slug}/secrets/{nom}/reveler``
|
||||||
|
rend la valeur au gestionnaire du coffre authentifié par sa session
|
||||||
|
(propriétaire, ou admin sur coffre d'instance — jamais un simple
|
||||||
|
lecteur par octroi utilisateur), pour l'affichage et la copie manuelle
|
||||||
|
dans le panneau détail. Chaque révélation est auditée
|
||||||
|
(``revelation_manuelle``) et met à jour la dernière utilisation ; la
|
||||||
|
valeur n'est jamais journalisée et le frontend l'efface dès qu'elle
|
||||||
|
est masquée ou que le détail change.
|
||||||
- Autorisations (spec §6) : le propriétaire seul sur son coffre
|
- Autorisations (spec §6) : le propriétaire seul sur son coffre
|
||||||
personnel ; l'admin gère les coffres d'instance, les consommateurs et
|
personnel ; l'admin gère les coffres d'instance, les consommateurs et
|
||||||
la KEK, jamais le coffre personnel d'autrui ; l'ACL « * » des vaults
|
la KEK, jamais le coffre personnel d'autrui ; l'ACL « * » des vaults
|
||||||
@@ -57,7 +65,6 @@ from backend.coffre_store import (
|
|||||||
SecretExpireError,
|
SecretExpireError,
|
||||||
ValidationError,
|
ValidationError,
|
||||||
compter_octrois_actifs,
|
compter_octrois_actifs,
|
||||||
est_expire,
|
|
||||||
compter_secrets,
|
compter_secrets,
|
||||||
create_coffre,
|
create_coffre,
|
||||||
create_consommateur,
|
create_consommateur,
|
||||||
@@ -65,6 +72,7 @@ from backend.coffre_store import (
|
|||||||
create_secret,
|
create_secret,
|
||||||
delete_secret,
|
delete_secret,
|
||||||
distribuer_valeur,
|
distribuer_valeur,
|
||||||
|
est_expire,
|
||||||
get_coffre,
|
get_coffre,
|
||||||
get_coffre_by_id,
|
get_coffre_by_id,
|
||||||
get_coffre_or_404,
|
get_coffre_or_404,
|
||||||
@@ -622,6 +630,50 @@ async def api_rotate_secret(
|
|||||||
return _metadata_secret(coffre, secret)
|
return _metadata_secret(coffre, secret)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/api/coffres/{slug}/secrets/{nom}/reveler")
|
||||||
|
async def api_reveler_secret(
|
||||||
|
slug: str, nom: str, current_user=Depends(require_auth)
|
||||||
|
):
|
||||||
|
"""Révélation manuelle pour le panneau détail (afficher / copier).
|
||||||
|
|
||||||
|
Session utilisateur + gestion du coffre exigées : un lecteur par
|
||||||
|
octroi utilisateur voit les métadonnées mais ne révèle jamais la
|
||||||
|
valeur. Chaque appel est audité et touche la dernière utilisation.
|
||||||
|
"""
|
||||||
|
_exiger_actives()
|
||||||
|
coffre = _coffre_or_404(slug)
|
||||||
|
_exiger_gerer(current_user, coffre)
|
||||||
|
secret = _secret_or_404(coffre, nom)
|
||||||
|
try:
|
||||||
|
valeur = distribuer_valeur(coffre, secret)
|
||||||
|
except SecretExpireError:
|
||||||
|
_audit(_username(current_user), "revelation_refusee",
|
||||||
|
coffre=coffre["slug"],
|
||||||
|
secret_ref=f"coffre:{coffre['slug']}/{secret['nom']}",
|
||||||
|
resultat="secret_expire")
|
||||||
|
raise HTTPException(status_code=410, detail="secret_expire") from None
|
||||||
|
except KEKAbsenteError:
|
||||||
|
_audit(_username(current_user), "revelation_refusee",
|
||||||
|
coffre=coffre["slug"],
|
||||||
|
secret_ref=f"coffre:{coffre['slug']}/{secret['nom']}",
|
||||||
|
resultat="kek_absente")
|
||||||
|
raise HTTPException(status_code=503, detail="kek_absente") from None
|
||||||
|
except CryptoIndisponibleError:
|
||||||
|
_audit(_username(current_user), "revelation_refusee",
|
||||||
|
coffre=coffre["slug"],
|
||||||
|
secret_ref=f"coffre:{coffre['slug']}/{secret['nom']}",
|
||||||
|
resultat="crypto_indisponible")
|
||||||
|
raise HTTPException(status_code=503,
|
||||||
|
detail="crypto_indisponible") from None
|
||||||
|
toucher_utilisation(secret["id"])
|
||||||
|
_audit(_username(current_user), "revelation_manuelle",
|
||||||
|
coffre=coffre["slug"],
|
||||||
|
secret_ref=f"coffre:{coffre['slug']}/{secret['nom']}",
|
||||||
|
resultat="ok")
|
||||||
|
return {"reference": f"coffre:{coffre['slug']}/{secret['nom']}",
|
||||||
|
"valeur": valeur, "version": secret["version_courante"]}
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/api/coffres/{slug}/secrets/{nom}")
|
@router.delete("/api/coffres/{slug}/secrets/{nom}")
|
||||||
async def api_delete_secret(
|
async def api_delete_secret(
|
||||||
slug: str, nom: str, current_user=Depends(require_auth)
|
slug: str, nom: str, current_user=Depends(require_auth)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ from backend.schemas import (
|
|||||||
from backend.services.files import read_raw_file
|
from backend.services.files import read_raw_file
|
||||||
from backend.services.mutations import file_revision
|
from backend.services.mutations import file_revision
|
||||||
from backend.services.paths import resolve_safe_path
|
from backend.services.paths import resolve_safe_path
|
||||||
from backend.services.vaults import browse_directory, get_vault_root
|
from backend.services.vaults import browse_directory, chemin_exclu, get_vault_root
|
||||||
from backend.share import list_shares
|
from backend.share import list_shares
|
||||||
|
|
||||||
logger = logging.getLogger("obsigate")
|
logger = logging.getLogger("obsigate")
|
||||||
@@ -171,6 +171,9 @@ async def api_file_download(vault_name: str, path: str = Query(..., description=
|
|||||||
if not vault_data:
|
if not vault_data:
|
||||||
raise HTTPException(status_code=404, detail=f"Vault '{vault_name}' not found")
|
raise HTTPException(status_code=404, detail=f"Vault '{vault_name}' not found")
|
||||||
|
|
||||||
|
if chemin_exclu(vault_name, path):
|
||||||
|
raise HTTPException(status_code=404, detail=f"File not found: {path}")
|
||||||
|
|
||||||
vault_root = Path(vault_data["path"])
|
vault_root = Path(vault_data["path"])
|
||||||
file_path = resolve_safe_path(vault_root, path)
|
file_path = resolve_safe_path(vault_root, path)
|
||||||
|
|
||||||
@@ -243,6 +246,8 @@ def api_file_xlsx_dashboard(
|
|||||||
"""
|
"""
|
||||||
if not check_vault_access(vault_name, current_user):
|
if not check_vault_access(vault_name, current_user):
|
||||||
raise HTTPException(status_code=403, detail=f"Accès refusé à la vault '{vault_name}'")
|
raise HTTPException(status_code=403, detail=f"Accès refusé à la vault '{vault_name}'")
|
||||||
|
if chemin_exclu(vault_name, path):
|
||||||
|
raise HTTPException(status_code=404, detail=f"File not found: {path}")
|
||||||
_vault_root = get_vault_root(vault_name)
|
_vault_root = get_vault_root(vault_name)
|
||||||
file_path = resolve_safe_path(_vault_root, path)
|
file_path = resolve_safe_path(_vault_root, path)
|
||||||
if not file_path.is_file():
|
if not file_path.is_file():
|
||||||
@@ -311,6 +316,9 @@ def api_file_xlsx_sheet(
|
|||||||
if not vault_data:
|
if not vault_data:
|
||||||
raise HTTPException(status_code=404, detail=f"Vault '{vault_name}' not found")
|
raise HTTPException(status_code=404, detail=f"Vault '{vault_name}' not found")
|
||||||
|
|
||||||
|
if chemin_exclu(vault_name, path):
|
||||||
|
raise HTTPException(status_code=404, detail=f"File not found: {path}")
|
||||||
|
|
||||||
file_path = resolve_safe_path(Path(vault_data["path"]), path)
|
file_path = resolve_safe_path(Path(vault_data["path"]), path)
|
||||||
if not file_path.is_file():
|
if not file_path.is_file():
|
||||||
raise HTTPException(status_code=404, detail=f"File not found: {path}")
|
raise HTTPException(status_code=404, detail=f"File not found: {path}")
|
||||||
@@ -366,6 +374,9 @@ async def api_file(vault_name: str, path: str = Query(..., description="Relative
|
|||||||
if not vault_data:
|
if not vault_data:
|
||||||
raise HTTPException(status_code=404, detail=f"Vault '{vault_name}' not found")
|
raise HTTPException(status_code=404, detail=f"Vault '{vault_name}' not found")
|
||||||
|
|
||||||
|
if chemin_exclu(vault_name, path):
|
||||||
|
raise HTTPException(status_code=404, detail=f"File not found: {path}")
|
||||||
|
|
||||||
vault_root = Path(vault_data["path"])
|
vault_root = Path(vault_data["path"])
|
||||||
file_path = resolve_safe_path(vault_root, path)
|
file_path = resolve_safe_path(vault_root, path)
|
||||||
|
|
||||||
|
|||||||
@@ -609,6 +609,7 @@ class VaultInfo(BaseModel):
|
|||||||
file_count: int = Field(description="Number of indexed files")
|
file_count: int = Field(description="Number of indexed files")
|
||||||
tag_count: int = Field(description="Number of unique tags")
|
tag_count: int = Field(description="Number of unique tags")
|
||||||
type: str = Field(default="VAULT", description="Type of the vault mapping (VAULT or DIR)")
|
type: str = Field(default="VAULT", description="Type of the vault mapping (VAULT or DIR)")
|
||||||
|
readonly: bool = Field(default=False, description="True when the vault is declared read-only (DIR_N_READONLY) — mutations are refused and the UI hides write actions")
|
||||||
|
|
||||||
|
|
||||||
class BookmarkToggleRequest(BaseModel):
|
class BookmarkToggleRequest(BaseModel):
|
||||||
|
|||||||
@@ -7,13 +7,30 @@ from typing import Any
|
|||||||
|
|
||||||
from backend.services.errors import ServiceError
|
from backend.services.errors import ServiceError
|
||||||
from backend.services.paths import resolve_safe_path
|
from backend.services.paths import resolve_safe_path
|
||||||
from backend.services.vaults import get_vault_root
|
from backend.services.vaults import chemin_exclu, get_vault_root
|
||||||
|
|
||||||
logger = logging.getLogger("obsigate.services.files")
|
logger = logging.getLogger("obsigate.services.files")
|
||||||
|
|
||||||
|
|
||||||
|
def _ensure_not_excluded(vault_name: str, path: str) -> None:
|
||||||
|
"""Raise ``not_found`` (404) when *path* is excluded in this vault.
|
||||||
|
|
||||||
|
Un chemin exclu (DIR_N_IGNORED_DIRS / DIR_N_IGNORED_PATHS) est
|
||||||
|
indiscernable d'un chemin inexistant : même erreur, aucun détail
|
||||||
|
sur la règle qui l'a caché.
|
||||||
|
"""
|
||||||
|
if chemin_exclu(vault_name, path):
|
||||||
|
raise ServiceError(
|
||||||
|
f"File not found: {path}",
|
||||||
|
code="not_found",
|
||||||
|
status=404,
|
||||||
|
details={"vault": vault_name, "path": path},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def read_raw_file(vault_name: str, path: str) -> dict[str, Any]:
|
def read_raw_file(vault_name: str, path: str) -> dict[str, Any]:
|
||||||
"""Return the raw text content of a vault file (no redaction)."""
|
"""Return the raw text content of a vault file (no redaction)."""
|
||||||
|
_ensure_not_excluded(vault_name, path)
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
@@ -56,6 +73,7 @@ def read_file_text(
|
|||||||
ServiceError: ``not_found`` (404), ``file_too_large`` (413) or a read
|
ServiceError: ``not_found`` (404), ``file_too_large`` (413) or a read
|
||||||
error (500).
|
error (500).
|
||||||
"""
|
"""
|
||||||
|
_ensure_not_excluded(vault_name, path)
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
target = resolve_safe_path(root, path)
|
target = resolve_safe_path(root, path)
|
||||||
|
|
||||||
|
|||||||
@@ -69,8 +69,18 @@ def _rel(root: Path, path: Path) -> str:
|
|||||||
return str(path.relative_to(root)).replace("\\", "/")
|
return str(path.relative_to(root)).replace("\\", "/")
|
||||||
|
|
||||||
|
|
||||||
def _ensure_writable(root: Path) -> None:
|
def _ensure_writable(root: Path, vault_name: str | None = None) -> None:
|
||||||
"""Raise ``read_only`` (403) when the vault root is not writable."""
|
"""Raise ``read_only`` (403) when the vault must not be mutated.
|
||||||
|
|
||||||
|
Two sources, same error: the vault is **declared** read-only
|
||||||
|
(``DIR_N_READONLY``, via :func:`vault_readonly`) or its root is
|
||||||
|
not writable on the filesystem (``:ro`` mount).
|
||||||
|
"""
|
||||||
|
if vault_name is not None:
|
||||||
|
from backend.services.vaults import vault_readonly
|
||||||
|
|
||||||
|
if vault_readonly(vault_name):
|
||||||
|
raise ServiceError("Vault is read-only", code="read_only", status=403)
|
||||||
if not os.access(root, os.W_OK):
|
if not os.access(root, os.W_OK):
|
||||||
raise ServiceError("Vault is read-only", code="read_only", status=403)
|
raise ServiceError("Vault is read-only", code="read_only", status=403)
|
||||||
|
|
||||||
@@ -139,7 +149,7 @@ def create_file(
|
|||||||
``unsupported_extension`` (400) or ``already_exists`` (409).
|
``unsupported_extension`` (400) or ``already_exists`` (409).
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
_validate_extension(file_path)
|
_validate_extension(file_path)
|
||||||
|
|
||||||
@@ -190,7 +200,7 @@ def create_directory(vault_name: str, path: str, *, exist_ok: bool = False) -> d
|
|||||||
``already_exists`` (409) when *exist_ok* is False.
|
``already_exists`` (409) when *exist_ok* is False.
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
dir_path = resolve_safe_path(root, path)
|
dir_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if dir_path.exists():
|
if dir_path.exists():
|
||||||
@@ -234,7 +244,7 @@ def edit_file(
|
|||||||
ServiceError: ``not_found`` (404) or ``read_only`` (403).
|
ServiceError: ``not_found`` (404) or ``read_only`` (403).
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if not file_path.exists() or not file_path.is_file():
|
if not file_path.exists() or not file_path.is_file():
|
||||||
@@ -470,7 +480,7 @@ def edit_xlsx_cells(
|
|||||||
reference or value.
|
reference or value.
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if not file_path.exists() or not file_path.is_file():
|
if not file_path.exists() or not file_path.is_file():
|
||||||
@@ -592,7 +602,7 @@ def mutate_xlsx_structure(
|
|||||||
— deletions are NOT recoverable from the viewer (only via the ``.bak``).
|
— deletions are NOT recoverable from the viewer (only via the ``.bak``).
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if not file_path.exists() or not file_path.is_file():
|
if not file_path.exists() or not file_path.is_file():
|
||||||
@@ -1000,7 +1010,7 @@ def mutate_xlsx_style(
|
|||||||
from openpyxl.utils.cell import range_boundaries
|
from openpyxl.utils.cell import range_boundaries
|
||||||
|
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if not file_path.exists() or not file_path.is_file():
|
if not file_path.exists() or not file_path.is_file():
|
||||||
@@ -1255,7 +1265,7 @@ def save_csv_cells(
|
|||||||
from backend.xlsx_reader import sniff_csv_delimiter
|
from backend.xlsx_reader import sniff_csv_delimiter
|
||||||
|
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if not file_path.exists() or not file_path.is_file():
|
if not file_path.exists() or not file_path.is_file():
|
||||||
@@ -1341,7 +1351,7 @@ def append_to_file(
|
|||||||
ServiceError: ``not_found`` (404) or ``read_only`` (403).
|
ServiceError: ``not_found`` (404) or ``read_only`` (403).
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if not file_path.exists() or not file_path.is_file():
|
if not file_path.exists() or not file_path.is_file():
|
||||||
@@ -1382,7 +1392,7 @@ def rename_file(vault_name: str, path: str, new_name: str) -> dict[str, Any]:
|
|||||||
``unsupported_extension`` (400) or ``already_exists`` (409).
|
``unsupported_extension`` (400) or ``already_exists`` (409).
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
old_path = resolve_safe_path(root, path)
|
old_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if not old_path.exists() or not old_path.is_file():
|
if not old_path.exists() or not old_path.is_file():
|
||||||
@@ -1424,7 +1434,7 @@ def rename_directory(vault_name: str, path: str, new_name: str) -> dict[str, Any
|
|||||||
``already_exists`` (409).
|
``already_exists`` (409).
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
old_path = resolve_safe_path(root, path)
|
old_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if not old_path.exists() or not old_path.is_dir():
|
if not old_path.exists() or not old_path.is_dir():
|
||||||
@@ -1467,7 +1477,7 @@ def move_path(vault_name: str, source_path: str, destination_dir: str = "") -> d
|
|||||||
``unsupported_extension`` (400) or ``already_exists`` (409).
|
``unsupported_extension`` (400) or ``already_exists`` (409).
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
|
|
||||||
source = resolve_safe_path(root, source_path)
|
source = resolve_safe_path(root, source_path)
|
||||||
if not source.exists():
|
if not source.exists():
|
||||||
@@ -1546,7 +1556,7 @@ def duplicate_path(vault_name: str, source_path: str, destination_dir: str = "")
|
|||||||
destination is inside the source directory.
|
destination is inside the source directory.
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
|
|
||||||
source = resolve_safe_path(root, source_path)
|
source = resolve_safe_path(root, source_path)
|
||||||
if not source.exists():
|
if not source.exists():
|
||||||
@@ -1764,7 +1774,7 @@ def delete_file(vault_name: str, path: str, *, backup: bool = True) -> dict[str,
|
|||||||
ServiceError: ``not_found`` (404) or ``read_only`` (403).
|
ServiceError: ``not_found`` (404) or ``read_only`` (403).
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if not file_path.exists() or not file_path.is_file():
|
if not file_path.exists() or not file_path.is_file():
|
||||||
@@ -1797,7 +1807,7 @@ def delete_directory(vault_name: str, path: str, *, recursive: bool = True) -> d
|
|||||||
``invalid_arguments`` (400) when targeting the vault root.
|
``invalid_arguments`` (400) when targeting the vault root.
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
dir_path = resolve_safe_path(root, path)
|
dir_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
if not dir_path.exists() or not dir_path.is_dir():
|
if not dir_path.exists() or not dir_path.is_dir():
|
||||||
@@ -1855,7 +1865,7 @@ def restore_backup(
|
|||||||
or ``read_only`` (403).
|
or ``read_only`` (403).
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
|
|
||||||
backup_dir = get_backup_dir(vault_name, path)
|
backup_dir = get_backup_dir(vault_name, path)
|
||||||
@@ -1931,7 +1941,7 @@ def save_raw_file(
|
|||||||
Dict with ``success``, ``vault``, ``path``, and ``size``.
|
Dict with ``success``, ``vault``, ``path``, and ``size``.
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
file_path = resolve_safe_path(root, path)
|
file_path = resolve_safe_path(root, path)
|
||||||
_validate_extension(file_path, allow_images=True, allow_docs=allow_docs)
|
_validate_extension(file_path, allow_images=True, allow_docs=allow_docs)
|
||||||
|
|
||||||
@@ -1980,7 +1990,7 @@ def batch_upload_files(
|
|||||||
and ``errors`` (list of error dicts).
|
and ``errors`` (list of error dicts).
|
||||||
"""
|
"""
|
||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
_ensure_writable(root)
|
_ensure_writable(root, vault_name)
|
||||||
|
|
||||||
clean_target = (target_dir or "").strip().strip("/\\")
|
clean_target = (target_dir or "").strip().strip("/\\")
|
||||||
uploaded: list[str] = []
|
uploaded: list[str] = []
|
||||||
|
|||||||
@@ -215,8 +215,9 @@ def list_paths(vault: str, limit: int = 5000) -> dict[str, Any]:
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from backend.indexer import get_vault_data, path_index
|
from backend.indexer import get_vault_data, path_index
|
||||||
|
from backend.services.vaults import chemin_exclu
|
||||||
|
|
||||||
entries = path_index.get(vault, [])
|
entries = [e for e in path_index.get(vault, []) if not chemin_exclu(vault, e["path"])]
|
||||||
meta: dict[str, dict[str, Any]] = {}
|
meta: dict[str, dict[str, Any]] = {}
|
||||||
data = get_vault_data(vault)
|
data = get_vault_data(vault)
|
||||||
if data:
|
if data:
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Single source of truth consumed by both the REST routes (``/api/vaults``,
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import fnmatch
|
||||||
from datetime import UTC
|
from datetime import UTC
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@@ -15,6 +16,68 @@ from backend.services.errors import ServiceError
|
|||||||
from backend.services.paths import resolve_safe_path
|
from backend.services.paths import resolve_safe_path
|
||||||
|
|
||||||
|
|
||||||
|
def chemin_exclu_dans_config(config: dict[str, Any] | None, rel_path: str) -> bool:
|
||||||
|
"""True si *rel_path* est exclu par la config d'exclusions d'un vault.
|
||||||
|
|
||||||
|
Deux mécanismes, lus dans le dict ``config`` du vault (alimenté par
|
||||||
|
``DIR_N_IGNORED_DIRS`` / ``DIR_N_IGNORED_PATHS``, vaults DIR seulement) :
|
||||||
|
|
||||||
|
- ``ignoredDirs`` : le nom d'un segment du chemin (à toute profondeur)
|
||||||
|
figure dans l'ensemble — ex. ``.home`` cache ``a/.home/x`` ;
|
||||||
|
- ``ignoredPaths`` : motifs fnmatch testés contre le chemin relatif
|
||||||
|
POSIX **et chacun de ses préfixes** — un dossier qui matche cache
|
||||||
|
donc tout son sous-arbre, ex. ``Executeurs/*/data`` cache aussi
|
||||||
|
``Executeurs/Hermes/data/config.md``.
|
||||||
|
|
||||||
|
Tolérant : config absente/vide ou chemin vide → False.
|
||||||
|
"""
|
||||||
|
if not config or not rel_path:
|
||||||
|
return False
|
||||||
|
rel = str(rel_path).replace("\\", "/").strip("/")
|
||||||
|
if not rel:
|
||||||
|
return False
|
||||||
|
segments = rel.split("/")
|
||||||
|
ignored_dirs = config.get("ignoredDirs") or []
|
||||||
|
if any(seg in ignored_dirs for seg in segments):
|
||||||
|
return True
|
||||||
|
prefixes = ["/".join(segments[:i]) for i in range(1, len(segments) + 1)]
|
||||||
|
for pattern in config.get("ignoredPaths") or []:
|
||||||
|
pat = str(pattern).replace("\\", "/").strip("/")
|
||||||
|
if pat and any(fnmatch.fnmatchcase(prefix, pat) for prefix in prefixes):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def chemin_exclu(vault_name: str, rel_path: str) -> bool:
|
||||||
|
"""True si *rel_path* est exclu dans le vault *vault_name*.
|
||||||
|
|
||||||
|
Lit la config du vault via l'index (``get_vault_data``). Tolérant :
|
||||||
|
vault inconnu ou sans config d'exclusions → False.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
from backend.indexer import get_vault_data
|
||||||
|
|
||||||
|
data = get_vault_data(vault_name)
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
if not data:
|
||||||
|
return False
|
||||||
|
return chemin_exclu_dans_config(data.get("config") or {}, rel_path)
|
||||||
|
|
||||||
|
|
||||||
|
def vault_readonly(vault_name: str) -> bool:
|
||||||
|
"""True si le vault est déclaré en lecture seule (DIR_N_READONLY)."""
|
||||||
|
try:
|
||||||
|
from backend.indexer import get_vault_data
|
||||||
|
|
||||||
|
data = get_vault_data(vault_name)
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
if not data:
|
||||||
|
return False
|
||||||
|
return bool((data.get("config") or {}).get("readonly", False))
|
||||||
|
|
||||||
|
|
||||||
def list_accessible_vaults(user: dict[str, Any]) -> list[dict[str, Any]]:
|
def list_accessible_vaults(user: dict[str, Any]) -> list[dict[str, Any]]:
|
||||||
"""Return the vaults *user* may access, with summary metadata."""
|
"""Return the vaults *user* may access, with summary metadata."""
|
||||||
from backend.auth.middleware import check_vault_access
|
from backend.auth.middleware import check_vault_access
|
||||||
@@ -29,6 +92,7 @@ def list_accessible_vaults(user: dict[str, Any]) -> list[dict[str, Any]]:
|
|||||||
"file_count": len(data.get("files", [])),
|
"file_count": len(data.get("files", [])),
|
||||||
"tag_count": len(data.get("tags", {})),
|
"tag_count": len(data.get("tags", {})),
|
||||||
"type": data.get("config", {}).get("type", "VAULT"),
|
"type": data.get("config", {}).get("type", "VAULT"),
|
||||||
|
"readonly": bool(data.get("config", {}).get("readonly", False)),
|
||||||
})
|
})
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@@ -58,7 +122,7 @@ def browse_directory(vault_name: str, path: str = "") -> dict[str, Any]:
|
|||||||
root = get_vault_root(vault_name)
|
root = get_vault_root(vault_name)
|
||||||
target = resolve_safe_path(root, path) if path else root.resolve()
|
target = resolve_safe_path(root, path) if path else root.resolve()
|
||||||
|
|
||||||
if not target.exists():
|
if not target.exists() or (path and chemin_exclu(vault_name, path)):
|
||||||
raise ServiceError(
|
raise ServiceError(
|
||||||
f"Path not found: {path}",
|
f"Path not found: {path}",
|
||||||
code="not_found",
|
code="not_found",
|
||||||
@@ -74,12 +138,15 @@ def browse_directory(vault_name: str, path: str = "") -> dict[str, Any]:
|
|||||||
if hide_hidden and entry.name.startswith("."):
|
if hide_hidden and entry.name.startswith("."):
|
||||||
continue
|
continue
|
||||||
rel = str(entry.relative_to(root)).replace("\\", "/")
|
rel = str(entry.relative_to(root)).replace("\\", "/")
|
||||||
|
if chemin_exclu(vault_name, rel):
|
||||||
|
continue
|
||||||
if entry.is_dir():
|
if entry.is_dir():
|
||||||
# Count only direct children (files and subdirs) for performance.
|
# Count only direct children (files and subdirs) for performance.
|
||||||
try:
|
try:
|
||||||
file_count = sum(
|
file_count = sum(
|
||||||
1 for child in entry.iterdir()
|
1 for child in entry.iterdir()
|
||||||
if (not hide_hidden or not child.name.startswith("."))
|
if (not hide_hidden or not child.name.startswith("."))
|
||||||
|
and not chemin_exclu(vault_name, f"{rel}/{child.name}")
|
||||||
and (child.is_file() and (child.suffix.lower() in SUPPORTED_EXTENSIONS or child.name.lower() in ("dockerfile", "makefile"))
|
and (child.is_file() and (child.suffix.lower() in SUPPORTED_EXTENSIONS or child.name.lower() in ("dockerfile", "makefile"))
|
||||||
or child.is_dir())
|
or child.is_dir())
|
||||||
)
|
)
|
||||||
@@ -200,6 +267,9 @@ def list_all_files(
|
|||||||
stat = entry.stat()
|
stat = entry.stat()
|
||||||
rel_path = str(entry.relative_to(root)).replace("\\", "/")
|
rel_path = str(entry.relative_to(root)).replace("\\", "/")
|
||||||
|
|
||||||
|
if chemin_exclu(vault_name, rel_path):
|
||||||
|
continue
|
||||||
|
|
||||||
if recursive and dir_prefix:
|
if recursive and dir_prefix:
|
||||||
try:
|
try:
|
||||||
rel_to_dir = str(entry.parent.relative_to(dir_path)).replace("\\", "/")
|
rel_to_dir = str(entry.parent.relative_to(dir_path)).replace("\\", "/")
|
||||||
|
|||||||
Generated
+1
-1
@@ -2626,7 +2626,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "obsigate-desktop"
|
name = "obsigate-desktop"
|
||||||
version = "2.82.4"
|
version = "2.83.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "obsigate-desktop"
|
name = "obsigate-desktop"
|
||||||
version = "2.82.4"
|
version = "2.83.0"
|
||||||
description = "ObsiGate Desktop — Porte d'entrée native pour vos vaults Obsidian"
|
description = "ObsiGate Desktop — Porte d'entrée native pour vos vaults Obsidian"
|
||||||
authors = ["Bruno Charest"]
|
authors = ["Bruno Charest"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/nicedoc/obsigate/main/desktop/tauri.conf.schema.json",
|
"$schema": "https://raw.githubusercontent.com/nicedoc/obsigate/main/desktop/tauri.conf.schema.json",
|
||||||
"productName": "ObsiGate",
|
"productName": "ObsiGate",
|
||||||
"version": "2.82.4",
|
"version": "2.83.0",
|
||||||
"identifier": "com.obsigate.desktop",
|
"identifier": "com.obsigate.desktop",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../frontend",
|
"frontendDist": "../frontend",
|
||||||
|
|||||||
@@ -73,6 +73,16 @@ configurée (sinon 503 `kek_absente`).
|
|||||||
SSO : une session utilisateur, même admin, ne distribue jamais
|
SSO : une session utilisateur, même admin, ne distribue jamais
|
||||||
(401 `consommateur_invalide`). Il n'existe pas d'endpoint de
|
(401 `consommateur_invalide`). Il n'existe pas d'endpoint de
|
||||||
distribution par session (voir §6).
|
distribution par session (voir §6).
|
||||||
|
- Révélation manuelle (panneau détail, hors distribution) : `POST
|
||||||
|
/api/coffres/{slug}/secrets/{nom}/reveler` rend la valeur au
|
||||||
|
gestionnaire du coffre authentifié par sa session (propriétaire,
|
||||||
|
ou admin sur coffre d'instance), pour l'afficher ou la copier.
|
||||||
|
Ce n'est pas une distribution : aucun octroi n'est créé, aucun
|
||||||
|
consommateur ne reçoit la valeur, chaque révélation est auditée
|
||||||
|
(`revelation_manuelle`) et met à jour la dernière utilisation.
|
||||||
|
Un lecteur par octroi utilisateur (métadonnées visibles) reçoit
|
||||||
|
403. L'ancienne copie manuelle par consommateur temporaire a
|
||||||
|
été supprimée (elle échouait : 403 octroi_absent).
|
||||||
- Ajouter une app = enregistrer un consommateur + créer des octrois,
|
- Ajouter une app = enregistrer un consommateur + créer des octrois,
|
||||||
**sans modification du coffre** et sans toucher à ses secrets.
|
**sans modification du coffre** et sans toucher à ses secrets.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# ObsiGate — Roadmap
|
# ObsiGate — Roadmap
|
||||||
|
|
||||||
> **Version :** 2.82.4 | **Dernière mise à jour :** 2026-10-28
|
> **Version :** 2.83.0 | **Dernière mise à jour :** 2026-11-03
|
||||||
> **Ce fichier ne contient que le travail à venir** (🔵 En cours + ⚪ Backlog) et un index compact
|
> **Ce fichier ne contient que le travail à venir** (🔵 En cours + ⚪ Backlog) et un index compact
|
||||||
> vers les fonctionnalités livrées.
|
> vers les fonctionnalités livrées.
|
||||||
> - **Méthode de livraison à appliquer pour toute tâche : [DELIVERY_WORKFLOW.md](./DELIVERY_WORKFLOW.md)**
|
> - **Méthode de livraison à appliquer pour toute tâche : [DELIVERY_WORKFLOW.md](./DELIVERY_WORKFLOW.md)**
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
# Vault DIR « Spark » — exclusions par vault et lecture seule déclarable
|
||||||
|
|
||||||
|
## Objectif
|
||||||
|
|
||||||
|
Permettre d'exposer dans ObsiGate des répertoires techniques (code du
|
||||||
|
service d'agents, workspaces du compagnon, coquilles d'exécuteurs) sous un
|
||||||
|
vault `DIR` monté en lecture seule — le vault « Spark » — sans jamais
|
||||||
|
rendre visibles leurs zones sensibles (profils et clés des exécuteurs,
|
||||||
|
`.home` des workspaces, `.venv`, etc.).
|
||||||
|
|
||||||
|
Avant ce chantier, deux manques le bloquaient proprement :
|
||||||
|
|
||||||
|
1. Les exclusions n'existaient qu'au niveau de l'indexeur (`IGNORED_DIRS`,
|
||||||
|
global) : la navigation et la lecture montraient le disque tel quel.
|
||||||
|
2. La lecture seule d'un vault n'était ni déclarable ni affichée : les
|
||||||
|
menus contextuels proposaient renommer / déplacer / supprimer, qui
|
||||||
|
échouaient ensuite côté serveur (montage `:ro`).
|
||||||
|
|
||||||
|
## Contrat de configuration (vaults DIR seulement)
|
||||||
|
|
||||||
|
Lues par `load_vault_config()` (`backend/indexer.py`, boucle `DIR_N`),
|
||||||
|
rangées dans le dict `config` du vault ; les vaults `VAULT` ne sont pas
|
||||||
|
touchés et les défauts (vide / faux) conservent le comportement actuel :
|
||||||
|
|
||||||
|
| Variable | Forme | Effet |
|
||||||
|
|---|---|---|
|
||||||
|
| `DIR_N_READONLY` | `true` / `false` | Mutations refusées en 403 `read_only` ; `readonly: true` exposé par `/api/vaults` ; l'UI masque les actions d'écriture |
|
||||||
|
| `DIR_N_IGNORED_DIRS` | `.home,.venv` | Noms de dossiers cachés à toute profondeur, en plus du global |
|
||||||
|
| `DIR_N_IGNORED_PATHS` | `Executeurs/*/data,Executeurs/*/.env` | Motifs fnmatch sur le chemin relatif POSIX ; un dossier qui matche cache tout son sous-arbre |
|
||||||
|
|
||||||
|
Exemple visé pour le vault Spark :
|
||||||
|
|
||||||
|
```
|
||||||
|
DIR_1_NAME=Spark
|
||||||
|
DIR_1_PATH=/vaults/Spark
|
||||||
|
DIR_1_READONLY=true
|
||||||
|
DIR_1_IGNORED_DIRS=.home,.venv,__pycache__,node_modules,.git
|
||||||
|
DIR_1_IGNORED_PATHS=Executeurs/*/data,Executeurs/*/.env,*/compagnon.json
|
||||||
|
```
|
||||||
|
|
||||||
|
(le montage lui-même — volume `:ro`, arborescence assemblée sur l'hôte —
|
||||||
|
relève de la configuration de déploiement, pas d'ObsiGate.)
|
||||||
|
|
||||||
|
## Implémentation
|
||||||
|
|
||||||
|
- **Helper central** : `chemin_exclu(vault_name, rel_path)` et
|
||||||
|
`chemin_exclu_dans_config(config, rel_path)` dans
|
||||||
|
`backend/services/vaults.py` — segment présent dans `ignoredDirs`, ou
|
||||||
|
fnmatch du chemin ou d'un de ses préfixes contre `ignoredPaths`.
|
||||||
|
Tolérant si vault / config absents. `vault_readonly(vault_name)` au
|
||||||
|
même endroit.
|
||||||
|
- **Navigation** : `browse_directory` filtre les items exclus (et leurs
|
||||||
|
compteurs d'enfants) ; naviguer directement dans un chemin exclu
|
||||||
|
répond 404. `list_all_files` et `list_paths` filtrent aussi.
|
||||||
|
- **Lecture** : un chemin exclu est indiscernable d'un chemin inexistant
|
||||||
|
(404, sans détail sur la règle) — `read_raw_file` / `read_file_text`
|
||||||
|
(`backend/services/files.py`), route `GET /api/file/{vault}` et route
|
||||||
|
de téléchargement (`backend/routers/files_read.py`).
|
||||||
|
- **Indexation** : le scan (`_scan_vault`, qui reçoit le `vault_cfg`)
|
||||||
|
élague les dossiers exclus et saute les fichiers exclus, en plus du
|
||||||
|
global `IGNORED_DIRS` inchangé.
|
||||||
|
- **Lecture seule** : `_ensure_writable(root, vault_name)` dans
|
||||||
|
`backend/services/mutations.py` refuse d'abord sur la déclaration
|
||||||
|
(`DIR_N_READONLY`), avant le garde filesystem existant — toutes les
|
||||||
|
mutations du service (créer, éditer, renommer, déplacer, supprimer,
|
||||||
|
upload, xlsx/csv) passent par ce point.
|
||||||
|
- **API / UI** : `VaultInfo.readonly` (`backend/schemas.py`) rempli par
|
||||||
|
`list_accessible_vaults` ; côté frontend, `vaultIsReadonly(nom)` dans
|
||||||
|
`frontend/js/sidebar.js` alimente `ContextMenuManager`,
|
||||||
|
`attachTreeItemActionButton` et `attachTreeItemLongPress` pour le
|
||||||
|
vault et ses dossiers / fichiers (aucun autre fichier JS touché).
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
`tests/test_spark_vault_dir.py` : parsing des trois variables, helper
|
||||||
|
`chemin_exclu` (noms et motifs), navigation filtrée, lectures exclues en
|
||||||
|
404 (vue fichier, raw, téléchargement), fichier non exclu lisible,
|
||||||
|
indexation filtrée, mutation refusée en 403 sur vault readonly et
|
||||||
|
`/api/vaults` exposant `readonly=true`.
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
v0.1.10 : rose --agent → rouge Spark #c00000 ; marque = logo Spark ;
|
v0.1.10 : rose --agent → rouge Spark #c00000 ; marque = logo Spark ;
|
||||||
bouton Spark supprimé (remplacé par l'avatar flottant bas-centre) ;
|
bouton Spark supprimé (remplacé par l'avatar flottant bas-centre) ;
|
||||||
Alertes icône seule.
|
Alertes icône seule.
|
||||||
|
v0.1.11 : marque = étoile Spark monochrome (blanche barre foncée,
|
||||||
|
noire barre claire) ; anneau rouge #c00000 autour de l'avatar flottant.
|
||||||
Jetons repris du prototype validé Console v7.2.
|
Jetons repris du prototype validé Console v7.2.
|
||||||
Thème : clair par défaut, sombre via [data-theme="dark"] sur <html>
|
Thème : clair par défaut, sombre via [data-theme="dark"] sur <html>
|
||||||
ou prefers-color-scheme si l'app intégratrice ne force rien. */
|
ou prefers-color-scheme si l'app intégratrice ne force rien. */
|
||||||
@@ -41,7 +43,14 @@
|
|||||||
.draco-brand:hover { background: var(--surface-2); }
|
.draco-brand:hover { background: var(--surface-2); }
|
||||||
.draco-brand:focus-visible { outline: 2px solid var(--agent); outline-offset: 2px; }
|
.draco-brand:focus-visible { outline: 2px solid var(--agent); outline-offset: 2px; }
|
||||||
.draco-brand-mark { line-height: 0; }
|
.draco-brand-mark { line-height: 0; }
|
||||||
.draco-brand-mark img { width: 26px; height: 26px; border-radius: 8px; object-fit: cover; display: block; }
|
/* Marque monochrome v0.1.11 : étoile blanche extraite du logo rouge,
|
||||||
|
fond transparent — noire sur barre claire (filtre), blanche sur
|
||||||
|
barre foncée (filtre annulé par les règles thème ci-dessous). */
|
||||||
|
.draco-brand-mark img { width: 26px; height: 26px; object-fit: cover; display: block; filter: brightness(0); }
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.draco-bar .draco-brand-mark img { filter: none; }
|
||||||
|
}
|
||||||
|
[data-theme="dark"] .draco-bar .draco-brand-mark img { filter: none; }
|
||||||
|
|
||||||
/* Menu des applications — construit par le JS depuis les onglets */
|
/* Menu des applications — construit par le JS depuis les onglets */
|
||||||
.draco-apps-menu {
|
.draco-apps-menu {
|
||||||
@@ -156,7 +165,7 @@
|
|||||||
border-radius: 50%; background: transparent; cursor: pointer;
|
border-radius: 50%; background: transparent; cursor: pointer;
|
||||||
box-shadow: 0 8px 28px rgb(0 0 0 / .45);
|
box-shadow: 0 8px 28px rgb(0 0 0 / .45);
|
||||||
}
|
}
|
||||||
.draco-spark-flottant img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: block; }
|
.draco-spark-flottant img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: block; box-sizing: border-box; border: 3px solid var(--agent); }
|
||||||
.draco-spark-flottant:hover { transform: translateX(-50%) scale(1.05); }
|
.draco-spark-flottant:hover { transform: translateX(-50%) scale(1.05); }
|
||||||
.draco-spark-flottant:focus-visible { outline: 2px solid var(--agent); outline-offset: 3px; }
|
.draco-spark-flottant:focus-visible { outline: 2px solid var(--agent); outline-offset: 3px; }
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
+10
-2
@@ -268,7 +268,7 @@
|
|||||||
|
|
||||||
<!-- Main Application (wrapped for show/hide) -->
|
<!-- Main Application (wrapped for show/hide) -->
|
||||||
<!-- Barre d'apps commune dracodev — Fusion #215 (ACC-1.1).
|
<!-- Barre d'apps commune dracodev — Fusion #215 (ACC-1.1).
|
||||||
Snippet FIGÉ vendangé depuis Projets/dracodev-commons v0.1.10
|
Snippet FIGÉ vendangé depuis Projets/dracodev-commons v0.1.11
|
||||||
(ui/barre-apps/) : ne pas modifier la structure ici ; toute
|
(ui/barre-apps/) : ne pas modifier la structure ici ; toute
|
||||||
évolution passe par une nouvelle version de commons.
|
évolution passe par une nouvelle version de commons.
|
||||||
CSS/JS : /static/draco-barre.css, /static/draco-barre.js.
|
CSS/JS : /static/draco-barre.css, /static/draco-barre.js.
|
||||||
@@ -280,6 +280,14 @@
|
|||||||
→ logo Spark 26 px, bouton Spark rose supprimé (remplacé par
|
→ logo Spark 26 px, bouton Spark rose supprimé (remplacé par
|
||||||
l'avatar flottant bas-centre /static/img/avatar-spark.png,
|
l'avatar flottant bas-centre /static/img/avatar-spark.png,
|
||||||
data-act="spark" → panneau Spark), Alertes = cloche seule.
|
data-act="spark" → panneau Spark), Alertes = cloche seule.
|
||||||
|
v0.1.11 (2026-10-29) : marque → étoile Spark monochrome
|
||||||
|
/static/img/brand-spark.png 26 px (blanche sur barre foncée
|
||||||
|
via [data-theme="dark"] d'ObsiGate, noire sur barre claire
|
||||||
|
via le filtre brightness(0) du CSS vendangé — aucune
|
||||||
|
surcharge propre nécessaire, la barre suit déjà
|
||||||
|
data-theme) ; onglet agent GARDANT le logo rouge ;
|
||||||
|
anneau rouge #c00000 (bordure 3 px) autour de l'avatar
|
||||||
|
flottant, via le CSS vendangé.
|
||||||
Chantier 5 (fusion #69/#71, sans bump) : 5e onglet Console Spark
|
Chantier 5 (fusion #69/#71, sans bump) : 5e onglet Console Spark
|
||||||
(data-app="agent", défaut prod ; la réécriture DRACO_URLS
|
(data-app="agent", défaut prod ; la réécriture DRACO_URLS
|
||||||
couvre la clé "agent" comme les autres onglets), après Kanbante ;
|
couvre la clé "agent" comme les autres onglets), après Kanbante ;
|
||||||
@@ -288,7 +296,7 @@
|
|||||||
<div class="draco-bar-zone draco-bar-gauche">
|
<div class="draco-bar-zone draco-bar-gauche">
|
||||||
<button type="button" class="draco-icon-btn" data-act="rail" aria-label="Barre latérale">☰</button>
|
<button type="button" class="draco-icon-btn" data-act="rail" aria-label="Barre latérale">☰</button>
|
||||||
<a class="draco-brand" href="/" data-act="apps" aria-haspopup="true" aria-expanded="false" aria-label="dracodev — changer d'application" title="Changer d'application">
|
<a class="draco-brand" href="/" data-act="apps" aria-haspopup="true" aria-expanded="false" aria-label="dracodev — changer d'application" title="Changer d'application">
|
||||||
<span class="draco-brand-mark"><img src="/static/img/logos/spark.png" alt="" width="26" height="26"></span><span class="draco-brand-name">dracodev</span>
|
<span class="draco-brand-mark"><img src="/static/img/brand-spark.png" alt="" width="26" height="26"></span><span class="draco-brand-name">dracodev</span>
|
||||||
</a>
|
</a>
|
||||||
<nav class="draco-apptabs" aria-label="Applications">
|
<nav class="draco-apptabs" aria-label="Applications">
|
||||||
<a class="draco-apptab" data-app="obsigate" href="https://og.dracodev.net/">
|
<a class="draco-apptab" data-app="obsigate" href="https://og.dracodev.net/">
|
||||||
|
|||||||
+63
-62
@@ -4,9 +4,15 @@
|
|||||||
*
|
*
|
||||||
* Règles de sécurité appliquées ici (jamais assouplies) :
|
* Règles de sécurité appliquées ici (jamais assouplies) :
|
||||||
* - Le backend ne renvoie que des métadonnées (has_value, jamais la valeur,
|
* - Le backend ne renvoie que des métadonnées (has_value, jamais la valeur,
|
||||||
* jamais un texte chiffré, jamais un nonce). Ce module n'affiche donc
|
* jamais un texte chiffré, jamais un nonce). La valeur d'un secret
|
||||||
* jamais de valeur de secret après enregistrement : colonne valeur =
|
* enregistré reste donc masquée (« •••••• ») par défaut ; seul le
|
||||||
* « •••••• » seulement, aucun bouton « afficher ».
|
* gestionnaire du coffre (propriétaire, ou admin sur coffre
|
||||||
|
* d'instance) peut la révéler, via POST .../secrets/{nom}/reveler
|
||||||
|
* (session + gestion, chaque révélation auditée) : bouton
|
||||||
|
* Afficher/Masquer dans le détail, ou « Copier la valeur » sans
|
||||||
|
* l'afficher. La valeur est effacée dès qu'elle est masquée ou que
|
||||||
|
* le détail change ; un simple lecteur par octroi utilisateur ne
|
||||||
|
* révèle jamais.
|
||||||
* - Aucune valeur ne transite par un titre d'onglet, une URL, un hash, un
|
* - Aucune valeur ne transite par un titre d'onglet, une URL, un hash, un
|
||||||
* journal console ou un log. Les variables contenant une valeur sont
|
* journal console ou un log. Les variables contenant une valeur sont
|
||||||
* effacées dès que l'opération est terminée (champ vidé, variable = null).
|
* effacées dès que l'opération est terminée (champ vidé, variable = null).
|
||||||
@@ -14,10 +20,11 @@
|
|||||||
* consommateur (csk_…) et une KEK générée sont rendus UNE fois, dans une
|
* consommateur (csk_…) et une KEK générée sont rendus UNE fois, dans une
|
||||||
* modale, avec un bouton Copier et un avertissement ; la modale fermée,
|
* modale, avec un bouton Copier et un avertissement ; la modale fermée,
|
||||||
* ils sont perdus. Ce ne sont pas des valeurs de secret du coffre.
|
* ils sont perdus. Ce ne sont pas des valeurs de secret du coffre.
|
||||||
* - La copie manuelle à usage unique (admin seulement, voir
|
* - L'ancienne copie manuelle à usage unique par consommateur
|
||||||
* _copieManuelle) passe par un consommateur temporaire créé puis révoqué
|
* temporaire a été supprimée : elle échouait systématiquement
|
||||||
* immédiatement, avec distribution auditée ; il n'existe pas encore
|
* (aucun octroi pour le consommateur temporaire, donc 403
|
||||||
* d'endpoint de distribution par session utilisateur côté backend.
|
* octroi_absent à la distribution). Elle est remplacée par
|
||||||
|
* « Copier la valeur », qui passe par l'endpoint de révélation.
|
||||||
* - Phase 2 (issue #20) : « Importer l'existant » migre les clés de
|
* - Phase 2 (issue #20) : « Importer l'existant » migre les clés de
|
||||||
* data/api_keys.json vers le coffre d'instance « ObsiGate interne »,
|
* data/api_keys.json vers le coffre d'instance « ObsiGate interne »,
|
||||||
* en deux temps (import, puis purge confirmée). Aucune valeur ne
|
* en deux temps (import, puis purge confirmée). Aucune valeur ne
|
||||||
@@ -52,6 +59,8 @@ let _coffresCache = null;
|
|||||||
let _coffresCacheAt = 0;
|
let _coffresCacheAt = 0;
|
||||||
const CACHE_MS = 30000;
|
const CACHE_MS = 30000;
|
||||||
|
|
||||||
|
let _valeurAffichee = null; // valeur révélée du détail courant, sinon null
|
||||||
|
|
||||||
const viewState = {
|
const viewState = {
|
||||||
coffres: [],
|
coffres: [],
|
||||||
currentSlug: null,
|
currentSlug: null,
|
||||||
@@ -354,6 +363,7 @@ function renderAlerts(host) {
|
|||||||
|
|
||||||
function renderDetail(host) {
|
function renderDetail(host) {
|
||||||
const s = viewState.detail;
|
const s = viewState.detail;
|
||||||
|
_valeurAffichee = null;
|
||||||
host.innerHTML = '';
|
host.innerHTML = '';
|
||||||
if (!s) {
|
if (!s) {
|
||||||
host.appendChild(text('p', t('coffres.select_secret'), 'coffres-empty'));
|
host.appendChild(text('p', t('coffres.select_secret'), 'coffres-empty'));
|
||||||
@@ -377,7 +387,9 @@ function renderDetail(host) {
|
|||||||
const dl = el('dl', { class: 'coffres-dl' }, []);
|
const dl = el('dl', { class: 'coffres-dl' }, []);
|
||||||
rows.forEach(([k, v]) => {
|
rows.forEach(([k, v]) => {
|
||||||
dl.appendChild(el('dt', {}, [document.createTextNode(k)]));
|
dl.appendChild(el('dt', {}, [document.createTextNode(k)]));
|
||||||
dl.appendChild(el('dd', {}, [document.createTextNode(v)]));
|
const dd = el('dd', {}, [document.createTextNode(v)]);
|
||||||
|
if (k === t('coffres.value')) dd.id = 'coffres-valeur';
|
||||||
|
dl.appendChild(dd);
|
||||||
});
|
});
|
||||||
host.appendChild(dl);
|
host.appendChild(dl);
|
||||||
const actions = el('div', { class: 'coffres-actions' }, []);
|
const actions = el('div', { class: 'coffres-actions' }, []);
|
||||||
@@ -386,11 +398,36 @@ function renderDetail(host) {
|
|||||||
actions.appendChild(modalBtn(t('coffres.acces'), '', () => {
|
actions.appendChild(modalBtn(t('coffres.acces'), '', () => {
|
||||||
document.getElementById('coffres-acces')?.scrollIntoView({ behavior: 'smooth' });
|
document.getElementById('coffres-acces')?.scrollIntoView({ behavior: 'smooth' });
|
||||||
}));
|
}));
|
||||||
actions.appendChild(modalBtn(t('coffres.manual_copy'), '', () => copieManuelle(s)));
|
const btnAfficher = modalBtn(t('coffres.show_value'), '', async () => {
|
||||||
if (!isAdmin()) {
|
if (_valeurAffichee !== null) {
|
||||||
actions.lastChild.disabled = true;
|
_valeurAffichee = null;
|
||||||
actions.lastChild.title = t('coffres.manual_copy_admin_only');
|
document.getElementById('coffres-valeur').textContent = '••••••';
|
||||||
}
|
btnAfficher.textContent = t('coffres.show_value');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let valeur;
|
||||||
|
try {
|
||||||
|
valeur = await revelerValeur(s);
|
||||||
|
} catch (e) {
|
||||||
|
showToast(e.message || t('common.error'), 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_valeurAffichee = valeur;
|
||||||
|
document.getElementById('coffres-valeur').textContent = valeur;
|
||||||
|
btnAfficher.textContent = t('coffres.hide_value');
|
||||||
|
});
|
||||||
|
actions.appendChild(btnAfficher);
|
||||||
|
actions.appendChild(modalBtn(t('coffres.copy_value'), '', async () => {
|
||||||
|
let valeur;
|
||||||
|
try {
|
||||||
|
valeur = await revelerValeur(s);
|
||||||
|
} catch (e) {
|
||||||
|
showToast(e.message || t('common.error'), 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await copyText(valeur);
|
||||||
|
valeur = null;
|
||||||
|
}));
|
||||||
actions.appendChild(modalBtn(t('coffres.delete'), 'danger', () => supprimerSecret(s)));
|
actions.appendChild(modalBtn(t('coffres.delete'), 'danger', () => supprimerSecret(s)));
|
||||||
host.appendChild(actions);
|
host.appendChild(actions);
|
||||||
|
|
||||||
@@ -819,55 +856,19 @@ function openCreateCoffreModal() {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Copie manuelle à usage unique, admin seulement.
|
/** Révélation manuelle (gestionnaire du coffre seulement, auditée
|
||||||
* Le backend n'expose pas (encore) de distribution par session : on passe
|
* côté backend). Ne conserve rien : l'appelant affiche ou copie
|
||||||
* par un consommateur temporaire créé, utilisé une fois, puis révoqué
|
* puis efface. Un lecteur par octroi utilisateur reçoit 403. */
|
||||||
* immédiatement. La valeur est copiée au presse-papiers sans jamais être
|
async function revelerValeur(s) {
|
||||||
* affichée, puis la variable est effacée, même en cas d'échec. */
|
const ref = (s.reference || '').replace(/^coffre:/, '');
|
||||||
async function copieManuelle(s) {
|
const [slug, nom] = ref.split('/');
|
||||||
if (!isAdmin()) return;
|
const res = await fetch(
|
||||||
const ok = await showConfirm({
|
`/api/coffres/${encodeURIComponent(slug)}/secrets/${encodeURIComponent(nom)}/reveler`,
|
||||||
title: t('coffres.manual_copy'),
|
{ method: 'POST', credentials: 'include' },
|
||||||
message: t('coffres.manual_copy_confirm'),
|
);
|
||||||
danger: true,
|
const data = await res.json().catch(() => ({}));
|
||||||
});
|
if (!res.ok) throw new Error(data.detail || `Erreur ${res.status}`);
|
||||||
if (!ok) return;
|
return data.valeur;
|
||||||
let consommateurId = null;
|
|
||||||
let valeur = null;
|
|
||||||
try {
|
|
||||||
const created = await api('/api/coffres/consommateurs', {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ nom: `copie-manuelle-${me()}-${Date.now()}` }),
|
|
||||||
});
|
|
||||||
consommateurId = created.id;
|
|
||||||
const jeton = created.jeton;
|
|
||||||
const res = await fetch('/api/coffres/distribuer', {
|
|
||||||
method: 'POST',
|
|
||||||
credentials: 'include',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
Authorization: `Bearer ${jeton}`,
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
reference: s.reference,
|
|
||||||
contexte_type: 'copie_manuelle',
|
|
||||||
contexte_id: `copie-manuelle-${Date.now()}`,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
const data = await res.json().catch(() => ({}));
|
|
||||||
if (!res.ok) throw new Error(data.detail || `Erreur ${res.status}`);
|
|
||||||
valeur = data.valeur;
|
|
||||||
await copyText(valeur);
|
|
||||||
} catch (e) {
|
|
||||||
showToast(e.message || t('common.error'), 'error');
|
|
||||||
} finally {
|
|
||||||
valeur = null;
|
|
||||||
if (consommateurId) {
|
|
||||||
try {
|
|
||||||
await api(`/api/coffres/consommateurs/${encodeURIComponent(consommateurId)}`, { method: 'DELETE' });
|
|
||||||
} catch { /* révocation best-effort, l'octroi reste révocable depuis Accès */ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Phase 2 — « Importer l'existant » (admin seulement, deux temps).
|
/** Phase 2 — « Importer l'existant » (admin seulement, deux temps).
|
||||||
|
|||||||
+29
-18
@@ -209,6 +209,17 @@ function _openSecretsMenu(x, y) {
|
|||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vault déclaré en lecture seule (DIR_N_READONLY, champ « readonly » de
|
||||||
|
* /api/vaults) : ses menus et boutons d'action ne doivent proposer aucune
|
||||||
|
* mutation (renommer, déplacer, supprimer…) — le backend les refuse en
|
||||||
|
* 403 de toute façon, l'UI le dit avant le clic.
|
||||||
|
*/
|
||||||
|
function vaultIsReadonly(vaultName) {
|
||||||
|
const v = (state.allVaults || []).find((x) => x.name === vaultName);
|
||||||
|
return !!(v && v.readonly);
|
||||||
|
}
|
||||||
|
|
||||||
/** Fichier partagé (créé ou reçu) → icône share-2 bleue, sinon icône usuelle. */
|
/** Fichier partagé (créé ou reçu) → icône share-2 bleue, sinon icône usuelle. */
|
||||||
function sharedFileIconSync(sharedPaths, itemName, vaultName, itemPath) {
|
function sharedFileIconSync(sharedPaths, itemName, vaultName, itemPath) {
|
||||||
if (sharedPaths && sharedPaths.has(`${vaultName}::${itemPath}`)) return _sharedIcon();
|
if (sharedPaths && sharedPaths.has(`${vaultName}::${itemPath}`)) return _sharedIcon();
|
||||||
@@ -356,11 +367,11 @@ async function refreshSidebarForContext() {
|
|||||||
|
|
||||||
vaultItem.addEventListener("contextmenu", (e) => {
|
vaultItem.addEventListener("contextmenu", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const isReadonly = false;
|
const isReadonly = vaultIsReadonly(v.name);
|
||||||
ContextMenuManager.show(e.clientX, e.clientY, v.name, '', 'vault', isReadonly);
|
ContextMenuManager.show(e.clientX, e.clientY, v.name, '', 'vault', isReadonly);
|
||||||
});
|
});
|
||||||
attachTreeItemActionButton(vaultItem, v.name, "", "vault", false);
|
attachTreeItemActionButton(vaultItem, v.name, "", "vault", vaultIsReadonly(v.name));
|
||||||
attachTreeItemLongPress(vaultItem, () => ({ vault: v.name, path: "", type: "vault", isReadonly: false }));
|
attachTreeItemLongPress(vaultItem, () => ({ vault: v.name, path: "", type: "vault", isReadonly: vaultIsReadonly(v.name) }));
|
||||||
|
|
||||||
container.appendChild(vaultItem);
|
container.appendChild(vaultItem);
|
||||||
|
|
||||||
@@ -460,11 +471,11 @@ async function loadVaults() {
|
|||||||
|
|
||||||
vaultItem.addEventListener("contextmenu", (e) => {
|
vaultItem.addEventListener("contextmenu", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const isReadonly = false;
|
const isReadonly = vaultIsReadonly(v.name);
|
||||||
ContextMenuManager.show(e.clientX, e.clientY, v.name, '', 'vault', isReadonly);
|
ContextMenuManager.show(e.clientX, e.clientY, v.name, '', 'vault', isReadonly);
|
||||||
});
|
});
|
||||||
attachTreeItemActionButton(vaultItem, v.name, "", "vault", false);
|
attachTreeItemActionButton(vaultItem, v.name, "", "vault", vaultIsReadonly(v.name));
|
||||||
attachTreeItemLongPress(vaultItem, () => ({ vault: v.name, path: "", type: "vault", isReadonly: false }));
|
attachTreeItemLongPress(vaultItem, () => ({ vault: v.name, path: "", type: "vault", isReadonly: vaultIsReadonly(v.name) }));
|
||||||
|
|
||||||
container.appendChild(vaultItem);
|
container.appendChild(vaultItem);
|
||||||
|
|
||||||
@@ -596,8 +607,8 @@ async function incrementalLoadDirectory(vaultName, dirPath, container) {
|
|||||||
// New item — create it
|
// New item — create it
|
||||||
if (item.type === "directory") {
|
if (item.type === "directory") {
|
||||||
const dirItem = el("div", { class: "tree-item", "data-vault": vaultName, "data-path": item.path, "data-type": "directory" }, [icon("chevron-right", 14), icon("folder", 16), el("span", { class: "tree-item-text" }, [document.createTextNode(item.name)]), smallBadge(item.children_count)]);
|
const dirItem = el("div", { class: "tree-item", "data-vault": vaultName, "data-path": item.path, "data-type": "directory" }, [icon("chevron-right", 14), icon("folder", 16), el("span", { class: "tree-item-text" }, [document.createTextNode(item.name)]), smallBadge(item.children_count)]);
|
||||||
attachTreeItemActionButton(dirItem, vaultName, item.path, "directory", false);
|
attachTreeItemActionButton(dirItem, vaultName, item.path, "directory", vaultIsReadonly(vaultName));
|
||||||
attachTreeItemLongPress(dirItem, () => ({ vault: vaultName, path: item.path, type: "directory", isReadonly: false }));
|
attachTreeItemLongPress(dirItem, () => ({ vault: vaultName, path: item.path, type: "directory", isReadonly: vaultIsReadonly(vaultName) }));
|
||||||
fragment.appendChild(dirItem);
|
fragment.appendChild(dirItem);
|
||||||
|
|
||||||
const subContainer = el("div", { class: "tree-children collapsed", id: `dir-${vaultName}-${item.path}` });
|
const subContainer = el("div", { class: "tree-children collapsed", id: `dir-${vaultName}-${item.path}` });
|
||||||
@@ -624,14 +635,14 @@ async function incrementalLoadDirectory(vaultName, dirPath, container) {
|
|||||||
|
|
||||||
dirItem.addEventListener("contextmenu", (e) => {
|
dirItem.addEventListener("contextmenu", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
ContextMenuManager.show(e.clientX, e.clientY, vaultName, item.path, "directory", false);
|
ContextMenuManager.show(e.clientX, e.clientY, vaultName, item.path, "directory", vaultIsReadonly(vaultName));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const fileIconName = getFileIcon(item.name);
|
const fileIconName = getFileIcon(item.name);
|
||||||
const displayName = item.name.match(/\.md$/i) ? item.name.replace(/\.md$/i, "") : item.name;
|
const displayName = item.name.match(/\.md$/i) ? item.name.replace(/\.md$/i, "") : item.name;
|
||||||
const fileItem = el("div", { class: "tree-item", "data-vault": vaultName, "data-path": item.path, "data-type": "file" }, [sharedFileIconSync(sharedPaths, item.name, vaultName, item.path), el("span", { class: "tree-item-text" }, [document.createTextNode(displayName)])]);
|
const fileItem = el("div", { class: "tree-item", "data-vault": vaultName, "data-path": item.path, "data-type": "file" }, [sharedFileIconSync(sharedPaths, item.name, vaultName, item.path), el("span", { class: "tree-item-text" }, [document.createTextNode(displayName)])]);
|
||||||
attachTreeItemActionButton(fileItem, vaultName, item.path, "file", false);
|
attachTreeItemActionButton(fileItem, vaultName, item.path, "file", vaultIsReadonly(vaultName));
|
||||||
attachTreeItemLongPress(fileItem, () => ({ vault: vaultName, path: item.path, type: "file", isReadonly: false }));
|
attachTreeItemLongPress(fileItem, () => ({ vault: vaultName, path: item.path, type: "file", isReadonly: vaultIsReadonly(vaultName) }));
|
||||||
fileItem.addEventListener("click", () => {
|
fileItem.addEventListener("click", () => {
|
||||||
scrollTreeItemIntoView(fileItem, false);
|
scrollTreeItemIntoView(fileItem, false);
|
||||||
if (window.innerWidth <= 768) {
|
if (window.innerWidth <= 768) {
|
||||||
@@ -649,7 +660,7 @@ async function incrementalLoadDirectory(vaultName, dirPath, container) {
|
|||||||
|
|
||||||
fileItem.addEventListener("contextmenu", (e) => {
|
fileItem.addEventListener("contextmenu", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
ContextMenuManager.show(e.clientX, e.clientY, vaultName, item.path, "file", false);
|
ContextMenuManager.show(e.clientX, e.clientY, vaultName, item.path, "file", vaultIsReadonly(vaultName));
|
||||||
});
|
});
|
||||||
|
|
||||||
fragment.appendChild(fileItem);
|
fragment.appendChild(fileItem);
|
||||||
@@ -944,8 +955,8 @@ async function loadDirectory(vaultName, dirPath, container) {
|
|||||||
|
|
||||||
if (item.type === "directory") {
|
if (item.type === "directory") {
|
||||||
const dirItem = el("div", { class: "tree-item", "data-vault": vaultName, "data-path": item.path, "data-type": "directory" }, [icon("chevron-right", 14), icon("folder", 16), el("span", { class: "tree-item-text" }, [document.createTextNode(item.name)]), smallBadge(item.children_count)]);
|
const dirItem = el("div", { class: "tree-item", "data-vault": vaultName, "data-path": item.path, "data-type": "directory" }, [icon("chevron-right", 14), icon("folder", 16), el("span", { class: "tree-item-text" }, [document.createTextNode(item.name)]), smallBadge(item.children_count)]);
|
||||||
attachTreeItemActionButton(dirItem, vaultName, item.path, "directory", false);
|
attachTreeItemActionButton(dirItem, vaultName, item.path, "directory", vaultIsReadonly(vaultName));
|
||||||
attachTreeItemLongPress(dirItem, () => ({ vault: vaultName, path: item.path, type: "directory", isReadonly: false }));
|
attachTreeItemLongPress(dirItem, () => ({ vault: vaultName, path: item.path, type: "directory", isReadonly: vaultIsReadonly(vaultName) }));
|
||||||
fragment.appendChild(dirItem);
|
fragment.appendChild(dirItem);
|
||||||
|
|
||||||
const subContainer = el("div", { class: "tree-children collapsed", id: `dir-${vaultName}-${item.path}` });
|
const subContainer = el("div", { class: "tree-children collapsed", id: `dir-${vaultName}-${item.path}` });
|
||||||
@@ -972,7 +983,7 @@ async function loadDirectory(vaultName, dirPath, container) {
|
|||||||
|
|
||||||
dirItem.addEventListener("contextmenu", (e) => {
|
dirItem.addEventListener("contextmenu", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const isReadonly = false;
|
const isReadonly = vaultIsReadonly(vaultName);
|
||||||
ContextMenuManager.show(e.clientX, e.clientY, vaultName, item.path, 'directory', isReadonly);
|
ContextMenuManager.show(e.clientX, e.clientY, vaultName, item.path, 'directory', isReadonly);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -980,8 +991,8 @@ async function loadDirectory(vaultName, dirPath, container) {
|
|||||||
const displayName = item.name.match(/\.md$/i) ? item.name.replace(/\.md$/i, "") : item.name;
|
const displayName = item.name.match(/\.md$/i) ? item.name.replace(/\.md$/i, "") : item.name;
|
||||||
const isShared = sharedPaths.has(`${vaultName}::${item.path}`);
|
const isShared = sharedPaths.has(`${vaultName}::${item.path}`);
|
||||||
const fileItem = el("div", { class: "tree-item", "data-vault": vaultName, "data-path": item.path, "data-type": "file" }, [isShared ? _sharedIcon() : icon(fileIconName, 16), el("span", { class: "tree-item-text" }, [document.createTextNode(displayName)])]);
|
const fileItem = el("div", { class: "tree-item", "data-vault": vaultName, "data-path": item.path, "data-type": "file" }, [isShared ? _sharedIcon() : icon(fileIconName, 16), el("span", { class: "tree-item-text" }, [document.createTextNode(displayName)])]);
|
||||||
attachTreeItemActionButton(fileItem, vaultName, item.path, "file", false);
|
attachTreeItemActionButton(fileItem, vaultName, item.path, "file", vaultIsReadonly(vaultName));
|
||||||
attachTreeItemLongPress(fileItem, () => ({ vault: vaultName, path: item.path, type: "file", isReadonly: false }));
|
attachTreeItemLongPress(fileItem, () => ({ vault: vaultName, path: item.path, type: "file", isReadonly: vaultIsReadonly(vaultName) }));
|
||||||
fileItem.addEventListener("click", () => {
|
fileItem.addEventListener("click", () => {
|
||||||
scrollTreeItemIntoView(fileItem, false);
|
scrollTreeItemIntoView(fileItem, false);
|
||||||
if (window.innerWidth <= 768) {
|
if (window.innerWidth <= 768) {
|
||||||
@@ -999,7 +1010,7 @@ async function loadDirectory(vaultName, dirPath, container) {
|
|||||||
|
|
||||||
fileItem.addEventListener("contextmenu", (e) => {
|
fileItem.addEventListener("contextmenu", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const isReadonly = false;
|
const isReadonly = vaultIsReadonly(vaultName);
|
||||||
ContextMenuManager.show(e.clientX, e.clientY, vaultName, item.path, 'file', isReadonly);
|
ContextMenuManager.show(e.clientX, e.clientY, vaultName, item.path, 'file', isReadonly);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -2680,6 +2680,9 @@
|
|||||||
"coffres.copy_failed": "Copy failed.",
|
"coffres.copy_failed": "Copy failed.",
|
||||||
"coffres.copy_generated": "Copy the generated value",
|
"coffres.copy_generated": "Copy the generated value",
|
||||||
"coffres.copy_reference": "Copy",
|
"coffres.copy_reference": "Copy",
|
||||||
|
"coffres.show_value": "Show",
|
||||||
|
"coffres.hide_value": "Hide",
|
||||||
|
"coffres.copy_value": "Copy value",
|
||||||
"coffres.create_coffre_title": "New vault",
|
"coffres.create_coffre_title": "New vault",
|
||||||
"coffres.create_octroi": "Create a grant",
|
"coffres.create_octroi": "Create a grant",
|
||||||
"coffres.create_secret_title": "New secret",
|
"coffres.create_secret_title": "New secret",
|
||||||
|
|||||||
@@ -2680,6 +2680,9 @@
|
|||||||
"coffres.copy_failed": "Copie impossible.",
|
"coffres.copy_failed": "Copie impossible.",
|
||||||
"coffres.copy_generated": "Copier la valeur générée",
|
"coffres.copy_generated": "Copier la valeur générée",
|
||||||
"coffres.copy_reference": "Copier",
|
"coffres.copy_reference": "Copier",
|
||||||
|
"coffres.show_value": "Afficher",
|
||||||
|
"coffres.hide_value": "Masquer",
|
||||||
|
"coffres.copy_value": "Copier la valeur",
|
||||||
"coffres.create_coffre_title": "Nouveau coffre",
|
"coffres.create_coffre_title": "Nouveau coffre",
|
||||||
"coffres.create_octroi": "Créer un octroi",
|
"coffres.create_octroi": "Créer un octroi",
|
||||||
"coffres.create_secret_title": "Nouveau secret",
|
"coffres.create_secret_title": "Nouveau secret",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
retomberait sur les défauts prod (les jetons sont ignorés par
|
retomberait sur les défauts prod (les jetons sont ignorés par
|
||||||
le JS) — jamais d'URL inventée.
|
le JS) — jamais d'URL inventée.
|
||||||
La barre ci-dessous est une copie statique du snippet figé de
|
La barre ci-dessous est une copie statique du snippet figé de
|
||||||
index.html (commons v0.1.10 + chantier 5 fusion #69/#71, sans
|
index.html (commons v0.1.11 + chantier 5 fusion #69/#71, sans
|
||||||
bump) : les onglets sont des liens réels, le bouton central
|
bump) : les onglets sont des liens réels, le bouton central
|
||||||
replace le curseur dans la boîte (recherche.js,
|
replace le curseur dans la boîte (recherche.js,
|
||||||
clic data-act="palette"). Re-vendoring alignement recherche :
|
clic data-act="palette"). Re-vendoring alignement recherche :
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<div class="draco-bar-zone draco-bar-gauche">
|
<div class="draco-bar-zone draco-bar-gauche">
|
||||||
<button type="button" class="draco-icon-btn" data-act="rail" aria-label="Barre latérale">☰</button>
|
<button type="button" class="draco-icon-btn" data-act="rail" aria-label="Barre latérale">☰</button>
|
||||||
<a class="draco-brand" href="/" data-act="apps" aria-haspopup="true" aria-expanded="false" aria-label="dracodev — changer d'application" title="Changer d'application">
|
<a class="draco-brand" href="/" data-act="apps" aria-haspopup="true" aria-expanded="false" aria-label="dracodev — changer d'application" title="Changer d'application">
|
||||||
<span class="draco-brand-mark"><img src="/static/img/logos/spark.png" alt="" width="26" height="26"></span><span class="draco-brand-name">dracodev</span>
|
<span class="draco-brand-mark"><img src="/static/img/brand-spark.png" alt="" width="26" height="26"></span><span class="draco-brand-name">dracodev</span>
|
||||||
</a>
|
</a>
|
||||||
<nav class="draco-apptabs" aria-label="Applications">
|
<nav class="draco-apptabs" aria-label="Applications">
|
||||||
<a class="draco-apptab" data-app="obsigate" href="{{URL_OBSIGATE}}">
|
<a class="draco-apptab" data-app="obsigate" href="{{URL_OBSIGATE}}">
|
||||||
|
|||||||
+1
-1
@@ -8493,7 +8493,7 @@ body.popup-mode .content-area {
|
|||||||
box-shadow: 0 2px 16px rgba(0,0,0,0.35);
|
box-shadow: 0 2px 16px rgba(0,0,0,0.35);
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
max-width: 95%;
|
max-width: 95%;
|
||||||
z-index: 50;
|
z-index: 66; /* au-dessus de .draco-spark-flottant (65) sinon la barre flottante DRACO intercepte les clics des flèches de recherche */
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(8px);
|
||||||
}
|
}
|
||||||
.results-bar-count {
|
.results-bar-count {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "obsigate",
|
"name": "obsigate",
|
||||||
"version": "2.82.4",
|
"version": "2.83.0",
|
||||||
"description": "**Porte d'entrée web ultra-léger pour vos vaults Obsidian** — Accédez, naviguez et recherchez dans toutes vos notes Obsidian depuis n'importe quel appareil via une interface web moderne et responsive.",
|
"description": "**Porte d'entrée web ultra-léger pour vos vaults Obsidian** — Accédez, naviguez et recherchez dans toutes vos notes Obsidian depuis n'importe quel appareil via une interface web moderne et responsive.",
|
||||||
"main": "patch.js",
|
"main": "patch.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ async function login(page) {
|
|||||||
await page.click('#login-btn');
|
await page.click('#login-btn');
|
||||||
}
|
}
|
||||||
// Wait until app init() resolved (all handlers bound).
|
// Wait until app init() resolved (all handlers bound).
|
||||||
await page.waitForFunction(() => window.__OBSIGATE_BOOTED === true, { timeout: 20000 });
|
await page.waitForFunction(() => document.readyState === 'complete' && !!document.querySelector('.tree-item'), { timeout: 20000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openFile(page, vault, filePath) {
|
async function openFile(page, vault, filePath) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ async function login(page) {
|
|||||||
await page.fill('#login-password', CREDS.password);
|
await page.fill('#login-password', CREDS.password);
|
||||||
await page.click('#login-btn');
|
await page.click('#login-btn');
|
||||||
}
|
}
|
||||||
await page.waitForFunction(() => window.__OBSIGATE_BOOTED === true, { timeout: 20000 });
|
await page.waitForFunction(() => document.readyState === 'complete' && !!document.querySelector('.tree-item'), { timeout: 20000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function authEnabled(page) {
|
async function authEnabled(page) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ async function login(page) {
|
|||||||
await page.fill('#login-password', CREDS.password);
|
await page.fill('#login-password', CREDS.password);
|
||||||
await page.click('#login-btn');
|
await page.click('#login-btn');
|
||||||
}
|
}
|
||||||
await page.waitForFunction(() => window.__OBSIGATE_BOOTED === true, { timeout: 20000 });
|
await page.waitForFunction(() => document.readyState === 'complete' && !!document.querySelector('.tree-item'), { timeout: 20000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openFile(page, vault, filePath) {
|
async function openFile(page, vault, filePath) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ async function login(page) {
|
|||||||
await page.fill('#login-password', CREDS.password);
|
await page.fill('#login-password', CREDS.password);
|
||||||
await page.click('#login-btn');
|
await page.click('#login-btn');
|
||||||
}
|
}
|
||||||
await page.waitForFunction(() => window.__OBSIGATE_BOOTED === true, { timeout: 20000 });
|
await page.waitForFunction(() => document.readyState === 'complete' && !!document.querySelector('.tree-item'), { timeout: 20000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openFile(page, vault, filePath) {
|
async function openFile(page, vault, filePath) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { test, expect } from '@playwright/test';
|
|||||||
|
|
||||||
async function boot(page) {
|
async function boot(page) {
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
await page.waitForFunction(() => window.__OBSIGATE_BOOTED === true, { timeout: 20000 });
|
await page.waitForFunction(() => document.readyState === 'complete' && !!document.querySelector('.tree-item'), { timeout: 20000 });
|
||||||
await page.waitForSelector('#dashboard-home, #search-input', { timeout: 15000 });
|
await page.waitForSelector('#dashboard-home, #search-input', { timeout: 15000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const BASE = process.env.BASE_URL || 'http://localhost:2029';
|
|||||||
async function goHome(page) {
|
async function goHome(page) {
|
||||||
await page.goto(BASE);
|
await page.goto(BASE);
|
||||||
// Wait until app init() resolved (all handlers bound, incl. search).
|
// Wait until app init() resolved (all handlers bound, incl. search).
|
||||||
await page.waitForFunction(() => (window as any).__OBSIGATE_BOOTED === true, { timeout: 20000 });
|
await page.waitForFunction(() => document.readyState === 'complete' && !!document.querySelector('.tree-item'), { timeout: 20000 });
|
||||||
await page.waitForSelector('#dashboard-home, #search-input', { timeout: 15000 });
|
await page.waitForSelector('#dashboard-home, #search-input', { timeout: 15000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ async function login(page) {
|
|||||||
await page.fill('#login-password', CREDS.password);
|
await page.fill('#login-password', CREDS.password);
|
||||||
await page.click('#login-btn');
|
await page.click('#login-btn');
|
||||||
}
|
}
|
||||||
await page.waitForFunction(() => window.__OBSIGATE_BOOTED === true, { timeout: 20000 });
|
await page.waitForFunction(() => document.readyState === 'complete' && !!document.querySelector('.tree-item'), { timeout: 20000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openFile(page, vault, filePath) {
|
async function openFile(page, vault, filePath) {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ async function login(page) {
|
|||||||
await page.fill('#login-password', process.env.OBSIGATE_PASS || 'test123');
|
await page.fill('#login-password', process.env.OBSIGATE_PASS || 'test123');
|
||||||
await page.click('#login-btn');
|
await page.click('#login-btn');
|
||||||
}
|
}
|
||||||
await page.waitForFunction(() => window.__OBSIGATE_BOOTED === true, { timeout: 20000 });
|
await page.waitForFunction(() => document.readyState === 'complete' && !!document.querySelector('.tree-item'), { timeout: 20000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openFixture(page) {
|
async function openFixture(page) {
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ test.describe('XSS — lecteur markdown (BUG-021)', () => {
|
|||||||
await api(request, 'POST', `/api/file/${VAULT}`, { path: XSS_FILE, content: `${XSS_BODY}\n` });
|
await api(request, 'POST', `/api/file/${VAULT}`, { path: XSS_FILE, content: `${XSS_BODY}\n` });
|
||||||
|
|
||||||
await page.goto(BASE);
|
await page.goto(BASE);
|
||||||
await page.waitForFunction(() => window.__OBSIGATE_BOOTED === true, { timeout: 20000 });
|
await page.waitForFunction(() => document.readyState === 'complete' && !!document.querySelector('.tree-item'), { timeout: 20000 });
|
||||||
await openFile(page, VAULT, XSS_FILE);
|
await openFile(page, VAULT, XSS_FILE);
|
||||||
|
|
||||||
const content = page.locator('#content-area');
|
const content = page.locator('#content-area');
|
||||||
|
|||||||
@@ -112,8 +112,10 @@ function testModulesHaveImports() {
|
|||||||
{ file: 'navfacets.js', reason: 'pure helpers — no deps, imported by vaulthome.js' },
|
{ file: 'navfacets.js', reason: 'pure helpers — no deps, imported by vaulthome.js' },
|
||||||
{ file: 'sidebar_raw.js', reason: 'legacy file — excluded' },
|
{ file: 'sidebar_raw.js', reason: 'legacy file — excluded' },
|
||||||
{ file: 'desktop.js', reason: 'standalone — reads window.__TAURI__ global, no imports needed' },
|
{ file: 'desktop.js', reason: 'standalone — reads window.__TAURI__ global, no imports needed' },
|
||||||
|
{ file: 'recherche.js', reason: 'standalone — vanilla sans dépendance, vendangé tel quel par chaque hôte (#68)', noExport: true },
|
||||||
];
|
];
|
||||||
const expectNoImport = new Set(expected.map(e => e.file));
|
const expectNoImport = new Set(expected.map(e => e.file));
|
||||||
|
const expectNoExport = new Set(expected.filter(e => e.noExport).map(e => e.file));
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const content = readFileSync(join(JS_DIR, file), 'utf-8');
|
const content = readFileSync(join(JS_DIR, file), 'utf-8');
|
||||||
@@ -123,7 +125,7 @@ function testModulesHaveImports() {
|
|||||||
if (!expectNoImport.has(file)) {
|
if (!expectNoImport.has(file)) {
|
||||||
assert.ok(hasImport, `${file} should have at least one import`);
|
assert.ok(hasImport, `${file} should have at least one import`);
|
||||||
}
|
}
|
||||||
if (file !== 'state.js' && file !== 'app.js') {
|
if (file !== 'state.js' && file !== 'app.js' && !expectNoExport.has(file)) {
|
||||||
assert.ok(hasExport, `${file} should have at least one export`);
|
assert.ok(hasExport, `${file} should have at least one export`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -778,3 +778,56 @@ class TestDistribuables:
|
|||||||
# Flag désactivé : 503 comme les autres routes.
|
# Flag désactivé : 503 comme les autres routes.
|
||||||
monkeypatch.setenv("OBSIGATE_SECRETS_ENABLED", "0")
|
monkeypatch.setenv("OBSIGATE_SECRETS_ENABLED", "0")
|
||||||
assert self._lister(client, jeton).status_code == 503
|
assert self._lister(client, jeton).status_code == 503
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Révélation manuelle (panneau détail : Afficher / Copier la valeur)
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class TestRevelation:
|
||||||
|
def test_proprietaire_revele_et_audit_sans_valeur(self, client, env_coffre):
|
||||||
|
_creer_coffre_secret(client)
|
||||||
|
resp = client.post("/api/coffres/personnel/secrets/gitea-token/reveler")
|
||||||
|
assert resp.status_code == 200, resp.text
|
||||||
|
corps = resp.json()
|
||||||
|
assert corps["valeur"] == VALEUR_TEST
|
||||||
|
assert corps["reference"] == "coffre:personnel/gitea-token"
|
||||||
|
assert corps["version"] == 1
|
||||||
|
audit = (env_coffre / "audit.log").read_text(encoding="utf-8")
|
||||||
|
assert "revelation_manuelle" in audit
|
||||||
|
assert VALEUR_TEST not in audit
|
||||||
|
|
||||||
|
def test_lecteur_octroi_utilisateur_ne_revele_pas(self, client):
|
||||||
|
_creer_coffre_secret(client)
|
||||||
|
resp = client.post("/api/coffres/personnel/octrois", json={
|
||||||
|
"cible_type": "utilisateur", "cible_id": "alice",
|
||||||
|
"secret_nom": "gitea-token"})
|
||||||
|
assert resp.status_code == 200, resp.text
|
||||||
|
_connecter(client, "alice", role="user")
|
||||||
|
# Voit les métadonnées…
|
||||||
|
assert client.get("/api/coffres/personnel/secrets").status_code == 200
|
||||||
|
# …mais ne révèle jamais la valeur.
|
||||||
|
resp = client.post("/api/coffres/personnel/secrets/gitea-token/reveler")
|
||||||
|
assert resp.status_code == 403
|
||||||
|
|
||||||
|
def test_secret_inexistant_404(self, client):
|
||||||
|
_creer_coffre_secret(client)
|
||||||
|
resp = client.post("/api/coffres/personnel/secrets/absent/reveler")
|
||||||
|
assert resp.status_code == 404
|
||||||
|
|
||||||
|
def test_secret_expire_410(self, client):
|
||||||
|
_creer_coffre_secret(client)
|
||||||
|
hier = (datetime.now(timezone.utc) - timedelta(days=1)).isoformat()
|
||||||
|
resp = client.post("/api/coffres/personnel/secrets", json={
|
||||||
|
"nom": "vieux-jeton", "type": "token", "valeur": VALEUR_TEST,
|
||||||
|
"expiration": hier})
|
||||||
|
assert resp.status_code == 200, resp.text
|
||||||
|
resp = client.post("/api/coffres/personnel/secrets/vieux-jeton/reveler")
|
||||||
|
assert resp.status_code == 410
|
||||||
|
assert resp.json()["detail"] == "secret_expire"
|
||||||
|
|
||||||
|
def test_flag_desactive_503(self, client, monkeypatch):
|
||||||
|
_creer_coffre_secret(client)
|
||||||
|
monkeypatch.setenv("OBSIGATE_SECRETS_ENABLED", "0")
|
||||||
|
resp = client.post("/api/coffres/personnel/secrets/gitea-token/reveler")
|
||||||
|
assert resp.status_code == 503
|
||||||
|
|||||||
@@ -37,13 +37,22 @@ def test_menu_des_applications_par_la_marque():
|
|||||||
# v0.1.3 : la marque ouvre le menu des applications
|
# v0.1.3 : la marque ouvre le menu des applications
|
||||||
# (changement d'app en mobile). v0.1.10 : la marque n'est plus
|
# (changement d'app en mobile). v0.1.10 : la marque n'est plus
|
||||||
# le glyphe ✦ à 24 px mais le logo Spark en img 26 px.
|
# le glyphe ✦ à 24 px mais le logo Spark en img 26 px.
|
||||||
|
# v0.1.11 : la marque n'est plus le logo rouge mais l'étoile
|
||||||
|
# Spark monochrome (brand-spark.png) ; l'onglet agent, lui,
|
||||||
|
# garde le logo rouge.
|
||||||
html = _index()
|
html = _index()
|
||||||
assert 'data-act="apps"' in html
|
assert 'data-act="apps"' in html
|
||||||
js = (FRONTEND / "draco-barre.js").read_text(encoding="utf-8")
|
js = (FRONTEND / "draco-barre.js").read_text(encoding="utf-8")
|
||||||
assert "draco-apps-menu" in js
|
assert "draco-apps-menu" in js
|
||||||
assert '<span class="draco-brand-mark"><img src="/static/img/logos/spark.png"' in html
|
assert '<span class="draco-brand-mark"><img src="/static/img/brand-spark.png"' in html
|
||||||
assert ".draco-brand-mark img" in _css()
|
assert ".draco-brand-mark img" in _css()
|
||||||
assert "width: 26px" in _css()
|
assert "width: 26px" in _css()
|
||||||
|
assert "filter: brightness(0)" in _css()
|
||||||
|
assert '[data-theme="dark"] .draco-bar .draco-brand-mark img { filter: none; }' in _css()
|
||||||
|
assert 'data-icon="agent"><img src="/static/img/logos/spark.png"' in html
|
||||||
|
assert "border: 3px solid var(--agent)" in _css()
|
||||||
|
recherche = (FRONTEND / "recherche.html").read_text(encoding="utf-8")
|
||||||
|
assert '<span class="draco-brand-mark"><img src="/static/img/brand-spark.png"' in recherche
|
||||||
|
|
||||||
|
|
||||||
def test_panneau_spark_integre_218():
|
def test_panneau_spark_integre_218():
|
||||||
@@ -90,7 +99,8 @@ def test_panneau_console_surimpression_222():
|
|||||||
assert "draco-console-sur" in panneau
|
assert "draco-console-sur" in panneau
|
||||||
assert "assurerSurimpression" in panneau
|
assert "assurerSurimpression" in panneau
|
||||||
assert "draco-console-styles" in panneau
|
assert "draco-console-styles" in panneau
|
||||||
assert 'surCadre.src = urlConsole()' in panneau
|
assert 'var url = urlConsole()' in panneau
|
||||||
|
assert 'surCadre.src = url' in panneau
|
||||||
assert 'surEl.style.width = "100%"' in panneau
|
assert 'surEl.style.width = "100%"' in panneau
|
||||||
assert 'data-dc="sidebar"' in panneau
|
assert 'data-dc="sidebar"' in panneau
|
||||||
assert "Mode sidebar" in panneau
|
assert "Mode sidebar" in panneau
|
||||||
@@ -107,7 +117,8 @@ def test_csp_ouvre_le_service_d_agents_218():
|
|||||||
# dérivée de la configuration (backend.draco_config.agent_origine,
|
# dérivée de la configuration (backend.draco_config.agent_origine,
|
||||||
# testée via la config dans tests/test_security_headers.py).
|
# testée via la config dans tests/test_security_headers.py).
|
||||||
main = (Path(__file__).resolve().parent.parent / "backend" / "main.py").read_text(encoding="utf-8")
|
main = (Path(__file__).resolve().parent.parent / "backend" / "main.py").read_text(encoding="utf-8")
|
||||||
ligne = next(l for l in main.splitlines() if "connect-src" in l)
|
ligne = next(l for l in main.splitlines()
|
||||||
|
if "connect-src" in l and not l.strip().startswith("#"))
|
||||||
assert "agent_origine" in main
|
assert "agent_origine" in main
|
||||||
assert "{agent}" in ligne
|
assert "{agent}" in ligne
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class TestListAccessibleVaults:
|
|||||||
|
|
||||||
def test_metadata_fields(self, client):
|
def test_metadata_fields(self, client):
|
||||||
vault = next(v for v in list_accessible_vaults(ADMIN) if v["name"] == "TestVault")
|
vault = next(v for v in list_accessible_vaults(ADMIN) if v["name"] == "TestVault")
|
||||||
assert set(vault) == {"name", "file_count", "tag_count", "type"}
|
assert set(vault) == {"name", "file_count", "tag_count", "type", "readonly"}
|
||||||
assert vault["file_count"] >= 1
|
assert vault["file_count"] >= 1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,251 @@
|
|||||||
|
"""Tests des vaults DIR « Spark » : exclusions par vault et lecture seule.
|
||||||
|
|
||||||
|
Couvre le contrat DIR_N_READONLY / DIR_N_IGNORED_DIRS / DIR_N_IGNORED_PATHS :
|
||||||
|
- parsing des trois variables dans load_vault_config() ;
|
||||||
|
- helper chemin_exclu (noms de dossiers et motifs fnmatch à préfixes) ;
|
||||||
|
- navigation filtrée, lectures exclues en 404 (vue, raw, téléchargement),
|
||||||
|
fichier non exclu lisible, indexation et list_paths filtrés ;
|
||||||
|
- mutation refusée en 403 sur un vault déclaré readonly ;
|
||||||
|
- /api/vaults expose readonly=true pour un DIR readonly.
|
||||||
|
|
||||||
|
Le vault de test est un répertoire temporaire monté en DIR (jamais un
|
||||||
|
vault de notes), avec une arborescence qui imite la vue Spark visée :
|
||||||
|
Console/, Workspaces/ (avec un .home), Executeurs/Hermes/{missions,data,.env}.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import ClassVar
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
|
VAULT_NAME = "SparkTest"
|
||||||
|
|
||||||
|
|
||||||
|
def _build_spark_tree(root: Path) -> None:
|
||||||
|
"""Crée l'arborescence technique de test sous *root*."""
|
||||||
|
(root / "Console").mkdir(parents=True)
|
||||||
|
(root / "Console" / "code.py").write_text('print("visible")\n', encoding="utf-8")
|
||||||
|
(root / "Console" / "notes.md").write_text("# Notes\n", encoding="utf-8")
|
||||||
|
|
||||||
|
atelier = root / "Workspaces" / "atelier"
|
||||||
|
(atelier / ".home").mkdir(parents=True)
|
||||||
|
(atelier / "note.md").write_text("# Atelier\n", encoding="utf-8")
|
||||||
|
(atelier / ".home" / "cache.md").write_text("# Cache du sandbox\n", encoding="utf-8")
|
||||||
|
|
||||||
|
venv = root / ".venv"
|
||||||
|
venv.mkdir()
|
||||||
|
(venv / "lib.py").write_text("# lib du venv\n", encoding="utf-8")
|
||||||
|
|
||||||
|
hermes = root / "Executeurs" / "Hermes"
|
||||||
|
(hermes / "missions").mkdir(parents=True)
|
||||||
|
(hermes / "data").mkdir(parents=True)
|
||||||
|
(hermes / "missions" / "mission.md").write_text("# Mission\n", encoding="utf-8")
|
||||||
|
(hermes / "data" / "config.md").write_text("# Profil de l'exécuteur\n", encoding="utf-8")
|
||||||
|
(hermes / ".env").write_text("CLE_FICTIVE=ne-pas-exposer\n", encoding="utf-8")
|
||||||
|
|
||||||
|
(root / "racine.md").write_text("# Racine\n", encoding="utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def spark_dir(tmp_path: Path) -> Path:
|
||||||
|
root = tmp_path / "SparkDir"
|
||||||
|
root.mkdir()
|
||||||
|
_build_spark_tree(root)
|
||||||
|
return root
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def spark_client(spark_dir: Path):
|
||||||
|
"""TestClient avec le répertoire de test monté en vault DIR readonly.
|
||||||
|
|
||||||
|
Même patron que le fixture ``app_with_vault`` de conftest.py, mais en
|
||||||
|
DIR_N_* avec les trois nouvelles variables posées.
|
||||||
|
"""
|
||||||
|
os.environ["DIR_1_NAME"] = VAULT_NAME
|
||||||
|
os.environ["DIR_1_PATH"] = str(spark_dir)
|
||||||
|
os.environ["DIR_1_READONLY"] = "true"
|
||||||
|
os.environ["DIR_1_IGNORED_DIRS"] = ".home,.venv"
|
||||||
|
os.environ["DIR_1_IGNORED_PATHS"] = "Executeurs/*/data,Executeurs/*/.env"
|
||||||
|
os.environ["OBSIGATE_AUTH_ENABLED"] = "false"
|
||||||
|
|
||||||
|
import backend.main
|
||||||
|
|
||||||
|
backend.main._load_config = lambda: {"watcher_enabled": False}
|
||||||
|
|
||||||
|
from backend.indexer import build_index
|
||||||
|
from backend.main import app
|
||||||
|
|
||||||
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
|
loop.run_until_complete(build_index())
|
||||||
|
|
||||||
|
return TestClient(app)
|
||||||
|
|
||||||
|
|
||||||
|
# ── Parsing de la configuration ─────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
class TestParsingConfig:
|
||||||
|
def test_dir_variables_parsees(self, monkeypatch, tmp_path):
|
||||||
|
monkeypatch.setenv("DIR_1_NAME", "SparkParse")
|
||||||
|
monkeypatch.setenv("DIR_1_PATH", str(tmp_path))
|
||||||
|
monkeypatch.setenv("DIR_1_READONLY", "true")
|
||||||
|
monkeypatch.setenv("DIR_1_IGNORED_DIRS", ".home, .venv ,__pycache__")
|
||||||
|
monkeypatch.setenv("DIR_1_IGNORED_PATHS", "Executeurs/*/data, Executeurs/*/.env")
|
||||||
|
|
||||||
|
from backend.indexer import load_vault_config
|
||||||
|
|
||||||
|
cfg = load_vault_config()["SparkParse"]
|
||||||
|
assert cfg["type"] == "DIR"
|
||||||
|
assert cfg["readonly"] is True
|
||||||
|
assert cfg["ignoredDirs"] == {".home", ".venv", "__pycache__"}
|
||||||
|
assert cfg["ignoredPaths"] == ["Executeurs/*/data", "Executeurs/*/.env"]
|
||||||
|
|
||||||
|
def test_dir_sans_variables_defauts(self, monkeypatch, tmp_path):
|
||||||
|
monkeypatch.setenv("DIR_1_NAME", "DirNu")
|
||||||
|
monkeypatch.setenv("DIR_1_PATH", str(tmp_path))
|
||||||
|
|
||||||
|
from backend.indexer import load_vault_config
|
||||||
|
|
||||||
|
cfg = load_vault_config()["DirNu"]
|
||||||
|
assert cfg["readonly"] is False
|
||||||
|
assert cfg["ignoredDirs"] == set()
|
||||||
|
assert cfg["ignoredPaths"] == []
|
||||||
|
|
||||||
|
|
||||||
|
# ── Helper chemin_exclu ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
class TestCheminExclu:
|
||||||
|
CFG: ClassVar[dict] = {
|
||||||
|
"ignoredDirs": {".home", ".venv"},
|
||||||
|
"ignoredPaths": ["Executeurs/*/data", "Executeurs/*/.env"],
|
||||||
|
}
|
||||||
|
|
||||||
|
def test_nom_de_dossier_a_toute_profondeur(self):
|
||||||
|
from backend.services.vaults import chemin_exclu_dans_config
|
||||||
|
|
||||||
|
assert chemin_exclu_dans_config(self.CFG, "Workspaces/atelier/.home/cache.md")
|
||||||
|
assert chemin_exclu_dans_config(self.CFG, ".venv/lib.py")
|
||||||
|
assert chemin_exclu_dans_config(self.CFG, ".home")
|
||||||
|
|
||||||
|
def test_motif_chemin_et_sous_arbre(self):
|
||||||
|
from backend.services.vaults import chemin_exclu_dans_config
|
||||||
|
|
||||||
|
assert chemin_exclu_dans_config(self.CFG, "Executeurs/Hermes/data")
|
||||||
|
assert chemin_exclu_dans_config(self.CFG, "Executeurs/Hermes/data/config.md")
|
||||||
|
assert chemin_exclu_dans_config(self.CFG, "Executeurs/Pi/data/x/y.py")
|
||||||
|
assert chemin_exclu_dans_config(self.CFG, "Executeurs/Hermes/.env")
|
||||||
|
|
||||||
|
def test_non_exclus_et_tolerance(self):
|
||||||
|
from backend.services.vaults import chemin_exclu_dans_config
|
||||||
|
|
||||||
|
assert not chemin_exclu_dans_config(self.CFG, "Console/code.py")
|
||||||
|
assert not chemin_exclu_dans_config(self.CFG, "Executeurs/Hermes/missions/mission.md")
|
||||||
|
assert not chemin_exclu_dans_config({}, "Console/code.py")
|
||||||
|
assert not chemin_exclu_dans_config(None, "Console/code.py")
|
||||||
|
assert not chemin_exclu_dans_config(self.CFG, "")
|
||||||
|
|
||||||
|
|
||||||
|
# ── Navigation et lectures via l'API ────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
class TestNavigationEtLecture:
|
||||||
|
def test_browse_racine_cache_les_dossiers_ignores(self, spark_client):
|
||||||
|
resp = spark_client.get(f"/api/browse/{VAULT_NAME}")
|
||||||
|
assert resp.status_code == 200
|
||||||
|
names = {item["name"] for item in resp.json()["items"]}
|
||||||
|
assert {"Console", "Workspaces", "Executeurs", "racine.md"} <= names
|
||||||
|
assert ".venv" not in names
|
||||||
|
|
||||||
|
def test_browse_sous_dossier_cache_data(self, spark_client):
|
||||||
|
resp = spark_client.get(f"/api/browse/{VAULT_NAME}", params={"path": "Executeurs/Hermes"})
|
||||||
|
assert resp.status_code == 200
|
||||||
|
names = {item["name"] for item in resp.json()["items"]}
|
||||||
|
assert "missions" in names
|
||||||
|
assert "data" not in names
|
||||||
|
|
||||||
|
def test_browse_chemin_exclu_404(self, spark_client):
|
||||||
|
resp = spark_client.get(f"/api/browse/{VAULT_NAME}", params={"path": "Executeurs/Hermes/data"})
|
||||||
|
assert resp.status_code == 404
|
||||||
|
|
||||||
|
def test_vue_fichier_exclu_404(self, spark_client):
|
||||||
|
resp = spark_client.get(f"/api/file/{VAULT_NAME}", params={"path": "Executeurs/Hermes/data/config.md"})
|
||||||
|
assert resp.status_code == 404
|
||||||
|
|
||||||
|
def test_raw_exclu_404(self, spark_client):
|
||||||
|
resp = spark_client.get(f"/api/file/{VAULT_NAME}/raw", params={"path": "Executeurs/Hermes/data/config.md"})
|
||||||
|
assert resp.status_code == 404
|
||||||
|
|
||||||
|
def test_raw_env_exclu_404(self, spark_client):
|
||||||
|
resp = spark_client.get(f"/api/file/{VAULT_NAME}/raw", params={"path": "Executeurs/Hermes/.env"})
|
||||||
|
assert resp.status_code == 404
|
||||||
|
assert "CLE_FICTIVE" not in resp.text
|
||||||
|
|
||||||
|
def test_telechargement_env_exclu_404(self, spark_client):
|
||||||
|
resp = spark_client.get(f"/api/file/{VAULT_NAME}/download", params={"path": "Executeurs/Hermes/.env"})
|
||||||
|
assert resp.status_code == 404
|
||||||
|
assert "CLE_FICTIVE" not in resp.text
|
||||||
|
|
||||||
|
def test_fichier_non_exclu_lisible(self, spark_client):
|
||||||
|
resp = spark_client.get(f"/api/file/{VAULT_NAME}/raw", params={"path": "Console/code.py"})
|
||||||
|
assert resp.status_code == 200
|
||||||
|
assert "visible" in resp.json()["raw"]
|
||||||
|
|
||||||
|
|
||||||
|
# ── Indexation et liste des chemins ─────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
class TestIndexation:
|
||||||
|
def test_index_ne_contient_aucun_exclu(self, spark_client):
|
||||||
|
from backend.indexer import get_vault_data
|
||||||
|
|
||||||
|
data = get_vault_data(VAULT_NAME)
|
||||||
|
assert data is not None
|
||||||
|
file_paths = {f["path"] for f in data.get("files", [])}
|
||||||
|
assert "Console/code.py" in file_paths
|
||||||
|
for p in file_paths:
|
||||||
|
segments = p.split("/")
|
||||||
|
assert ".home" not in segments and ".venv" not in segments
|
||||||
|
assert "data" not in segments[:-1] or not p.startswith("Executeurs/")
|
||||||
|
path_entries = {e["path"] for e in data.get("paths", [])}
|
||||||
|
assert "Executeurs/Hermes/data" not in path_entries
|
||||||
|
assert "Workspaces/atelier/.home" not in path_entries
|
||||||
|
|
||||||
|
def test_list_paths_filtre_les_exclus(self, spark_client):
|
||||||
|
from backend.services.search import list_paths
|
||||||
|
|
||||||
|
result = list_paths(VAULT_NAME)
|
||||||
|
paths = {r["path"] for r in result["results"]}
|
||||||
|
assert "Console/code.py" in paths
|
||||||
|
assert not any("/data/" in f"/{p}/" and p.startswith("Executeurs/") for p in paths)
|
||||||
|
assert not any(".home" in p.split("/") or ".venv" in p.split("/") for p in paths)
|
||||||
|
|
||||||
|
|
||||||
|
# ── Lecture seule ───────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
class TestLectureSeule:
|
||||||
|
def test_save_refuse_403(self, spark_client):
|
||||||
|
resp = spark_client.put(
|
||||||
|
f"/api/file/{VAULT_NAME}/save",
|
||||||
|
params={"path": "Console/code.py"},
|
||||||
|
json={"content": "print('modifié')\n"},
|
||||||
|
)
|
||||||
|
assert resp.status_code == 403
|
||||||
|
|
||||||
|
def test_creation_dossier_refusee_403(self, spark_client):
|
||||||
|
resp = spark_client.post(f"/api/directory/{VAULT_NAME}", json={"path": "NouveauDossier"})
|
||||||
|
assert resp.status_code == 403
|
||||||
|
|
||||||
|
def test_vaults_expose_readonly(self, spark_client):
|
||||||
|
resp = spark_client.get("/api/vaults")
|
||||||
|
assert resp.status_code == 200
|
||||||
|
entry = next(v for v in resp.json() if v["name"] == VAULT_NAME)
|
||||||
|
assert entry["type"] == "DIR"
|
||||||
|
assert entry["readonly"] is True
|
||||||
Reference in New Issue
Block a user