Skip to content

Commit 1887fb6

Browse files
committed
search: mask ACH results
1 parent 38a66ac commit 1887fb6

5 files changed

Lines changed: 20 additions & 2 deletions

File tree

examples/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ RailMsgSQL:
77

88
Search:
99
SqliteFilepath: "ach.db"
10+
AchMasking:
11+
MaskNames: true
12+
MaskAccountNumbers: true
1013

1114
Storage:
1215
ACH:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.24.4
44

55
require (
66
github.com/gorilla/mux v1.8.1
7-
github.com/moov-io/ach v1.51.0
7+
github.com/moov-io/ach v1.51.1-0.20250627200125-def87fc661c8
88
github.com/moov-io/ach-web-viewer v0.12.7-0.20250626211433-b71716051d91
99
github.com/moov-io/base v0.56.0
1010
github.com/ncruces/go-sqlite3 v0.26.2

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
225225
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
226226
github.com/moov-io/ach v1.51.0 h1:YeQcdGThImVhw9UTvmP3cc6zpLMKcOt23lMc2C/4wCs=
227227
github.com/moov-io/ach v1.51.0/go.mod h1:CkyghZB14RLCagR3HERvLGhQ6hrJZPYmUfpHGBBGHws=
228+
github.com/moov-io/ach v1.51.1-0.20250627200125-def87fc661c8 h1:CeZfWGoKggI7lqJkCMCluuopINciukLo29buP4OcKoQ=
229+
github.com/moov-io/ach v1.51.1-0.20250627200125-def87fc661c8/go.mod h1:CkyghZB14RLCagR3HERvLGhQ6hrJZPYmUfpHGBBGHws=
228230
github.com/moov-io/ach-web-viewer v0.12.7-0.20250626211433-b71716051d91 h1:TOZ1ePqy/zkRS70p6hGIq3lT4gHfdZ60gYz/8atxaK4=
229231
github.com/moov-io/ach-web-viewer v0.12.7-0.20250626211433-b71716051d91/go.mod h1:CqVrIWTMEaYwdjqHMy3QlTWq+QxkTfpzp/I2LqRIKRY=
230232
github.com/moov-io/base v0.56.0 h1:zNeviN7lW3hP0lsVeKwLYb8dTxcFvVTPX5xwrelCl8s=

internal/search/model_config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package search
22

3+
import (
4+
"github.com/moov-io/ach/cmd/achcli/describe/mask"
5+
)
6+
37
type Config struct {
48
SqliteFilepath string
9+
10+
AchMasking mask.Options
511
}

internal/search/service.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88

99
"github.com/moov-io/ach"
10+
"github.com/moov-io/ach/cmd/achcli/describe/mask"
1011
"github.com/moov-io/base/log"
1112
railmsgsql "github.com/moov-io/rail-msg-sql"
1213
"github.com/moov-io/rail-msg-sql/internal/achhelp"
@@ -43,6 +44,7 @@ func NewService(logger log.Logger, config Config, fileStorage *storage.Repositor
4344

4445
return &service{
4546
logger: logger,
47+
config: config,
4648
fileStorage: fileStorage,
4749
db: db,
4850
}, nil
@@ -53,7 +55,9 @@ func openSqliteDB(config Config) (*sql.DB, error) {
5355
}
5456

5557
type service struct {
56-
logger log.Logger
58+
logger log.Logger
59+
config Config
60+
5761
fileStorage *storage.Repository
5862

5963
db *sql.DB
@@ -411,6 +415,9 @@ func (s *service) IngestACHFile(ctx context.Context, filename string, file *ach.
411415
// Make sure to normalize the IDs
412416
file = achhelp.PopulateIDs(file)
413417

418+
// Mask the file before storage
419+
file = mask.File(file, s.config.AchMasking)
420+
414421
// Begin transaction
415422
tx, err := s.db.BeginTx(ctx, nil)
416423
if err != nil {

0 commit comments

Comments
 (0)