Extract safecsv writer for spreadsheet-safe exports

Wrap encoding/csv with formula-safe cell sanitization and
use it from log export streaming.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
Cursor Agent
2026-07-30 06:36:35 +00:00
parent c5b1f210d5
commit fc54faa263
6 changed files with 160 additions and 41 deletions

View File

@@ -22,7 +22,6 @@ package iam
import (
"context"
"encoding/csv"
"fmt"
"io"
"strings"
@@ -35,6 +34,7 @@ import (
"go.probo.inc/probo/pkg/filemanager"
"go.probo.inc/probo/pkg/gid"
"go.probo.inc/probo/pkg/mail"
"go.probo.inc/probo/pkg/safecsv"
)
type LogExportService struct {
@@ -228,7 +228,7 @@ func (s *LogExportService) streamCSV(
return fmt.Errorf("cannot load organization for log export: %w", err)
}
w := csv.NewWriter(pw)
w := safecsv.NewWriter(pw)
switch exportJob.Type {
case coredata.ExportJobTypeAuditLog: