pkg/cadf: add attributes for name enrichment to type Resource #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We want to have project/domain names on Initiator resources in a standard way. Since all other Go-based services rely on
package cadf
when generating structured events,type Resource
needs to support the respective fields.While making this change, I realized that
AuditParameters.NewEvent()
in this package deviates from github.com/sapcc/go-bits/audittools in the meaning of Initiator.Domain: In this package, Initiator.Domain is set to the domain from the token scope (or empty for project-scoped tokens), whereas audittools sets Initiator.Domain to the name of the user's domain.The CADF standard (cf. link, page 101) describes the "domain" attribute for resources as "the optional name of the domain that qualifies the name of the resource". Since "the resource" is the initiating user in this case, this supports audittools' interpretation. I therefore changed NewEvent() in this package to use the same interpretation. Since there are no users of NewEvent() across sapcc projects right now (at least as far as GitHub Code Search can tell), this should be a low-impact change.