Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/cadf: add attributes for name enrichment to type Resource #54

Merged
merged 1 commit into from
Feb 16, 2022

Conversation

majewsky
Copy link
Contributor

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.

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 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.
@majewsky majewsky requested a review from notque February 15, 2022 15:55
@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling 7388c1a on name-enrichment into 4426e1b on master.

Copy link
Contributor

@notque notque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@notque notque merged commit 12b4f66 into master Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants