"initiator" in authenticate CADF notifications has an inconsistent meaning
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Identity (keystone) |
New
|
Undecided
|
Unassigned |
Bug Description
Prior to https:/
- the ID of the authenticating user (if x-auth-token is provided in an /auth/tokens request)
- a random UUID, if no user authenticated
fd8b5f3 introduces a regression. Post-fd8b5f3, for authenticate events only, initiator.id is the user ID in the request body, and not the authenticating user.
I believe this inconsistency is undesirable. The correct behavior should be:
- initiator is always the authenticating user (tied to the value of x-auth-token)
- target is always the "target" resource (tied to the value of the request body or request path)
This also matches the definition of INITIATOR in https:/
> The RESOURCE that initiated, originated, or instigated the event's ACTION, according to the OBSERVER.
For an authenticate request where x-auth-token is not provided, the initiator value is unknown: keystone-api is not able to determine what user caused the authenticate request, because that data is not available in the request.
Similarly, TARGET:
> The RESOURCE against which the ACTION of a CADF Event Record was performed, was attempted, or is pending, according to the OBSERVER.
This would be the user specified in the request body.
I think the confusion may ultimately come from the original unit tests introduced in https:/ /opendev. org/openstack/ keystone/ commit/ b2b341f4700554e be7c35307916df0 67cfeb61ff
Unlike "normal" unauthenticated /auth/tokens requests, these unit tests are authenticated. This causes initiator.id to have a unit-testable value, which causes "self.assertEqu al(initiator. name, user_id)" to succeed in those tests.
This succeeds because, coincidentally, the user ID in the authentication request matches the authenticating user ID.
This was not mentioned https:/ /bugs.launchpad .net/keystone/ +bug/1780503 , so I suspect the author may not have been aware of this detail.