feat: standardized audit logging schema and service
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
Research direction
Start by comparing Frontier's core/audit/ implementation with the previous auth/audit package referenced in the issue, then review evolution PR #85. Resolve the OrgID, multiple targets, and Level design questions before defining the shared schema, Repository interface, and context helpers; done means the common package design is agreed and its scope is separated from project-specific storage and publishing.
Written by the indexing model from the issue text.
Description
Context
The previous auth/audit package was too simple — flat actor string, no target, no org scoping, no event publishing. Meanwhile frontier has a rich audit system with typed actors/targets, org scoping, webhook publishing, and event filtering.
Every raystack service that needs audit logging builds its own. A shared schema would enable consistent audit trails across services.
Proposed solution
Salt provides the common schema and context helpers. Projects provide storage and publishing.
Schema
type Actor struct {
ID string
Type string
Name string
}
type Target struct {
ID string
Type string
Name string
}
type Log struct {
ID string
OrgID string
Source string
Action string
Actor Actor
Target Target
Metadata map[string]string
CreatedAt time.Time
}
Interfaces
type Repository interface {
Create(ctx context.Context, log *Log) error
List(ctx context.Context, filter Filter) ([]Log, error)
GetByID(ctx context.Context, id string) (Log, error)
}
Context helpers
audit.SetActor(ctx, Actor{ID: "user-123", Type: "user", Name: "alice"})
audit.SetMetadata(ctx, map[string]string{"ip": "1.2.3.4"})
What projects provide themselves
- Storage implementation (postgres, kafka, external service)
- Event name constants (
app.user.created, etc.) - Publishing/webhook integration
- Target helpers specific to their domain
Design questions
- Is
OrgIDuniversal enough for the schema? (Compass doesn't have orgs) - Should
Targetsupport multiple targets per event? - Should the schema include a
Level(info/warn/critical)?
References
- Frontier's audit:
core/audit/— rich implementation with Actor/Target structs, webhook publishing - Guardian's audit: used old
salt/auditwith simple string actor - Previous
auth/auditpackage dropped in salt evolution PR #85
- Dominant language
- Go
- Stars
- 14
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raystack/salt
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100