bastion 0.60.0
ci / personal-data (push) Successful in 4s
ci / test (push) Successful in 3m36s
ci / fuzz (push) Successful in 3m35s

This commit is contained in:
Privatae
2026-11-02 00:10:58 +00:00
parent 4a5c310482
commit 4f8285ef18
100 changed files with 11537 additions and 840 deletions
+13 -4
View File
@@ -190,10 +190,19 @@ func dcnSaveFile(dir string, f *dcnGrantFile) error {
// accounting ("every read is logged for you"). Best-effort: auditing never blocks
// a result, but a refusal is still a refusal whether or not the line lands.
func dcnAudit(dir, op string, storeID int64, path, decision string) {
rec, _ := json.Marshal(map[string]any{
"ts": time.Now().UTC().Format(time.RFC3339), "op": op,
"store_id": storeID, "path": path, "decision": decision,
})
dcnAuditWith(dir, op, storeID, path, decision, nil)
}
// dcnAuditWith is dcnAudit with more fields on the row (an ask's asker and
// target, askparties.go). They never replace the five every reader expects.
func dcnAuditWith(dir, op string, storeID int64, path, decision string, extra map[string]any) {
row := map[string]any{}
for k, v := range extra {
row[k] = v
}
row["ts"], row["op"] = time.Now().UTC().Format(time.RFC3339), op
row["store_id"], row["path"], row["decision"] = storeID, path, decision
rec, _ := json.Marshal(row)
auditToSystemLog(auditFilePairingD, auditPairingOfDir(dir), rec)
fh, err := os.OpenFile(filepath.Join(dir, "audit.jsonl"),
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o600)