Skip to content

KBS: Add attestation policy selection - #1521

Open
Xynnn007 wants to merge 3 commits into
confidential-containers:mainfrom
Xynnn007:feat-selectable-policy
Open

KBS: Add attestation policy selection#1521
Xynnn007 wants to merge 3 commits into
confidential-containers:mainfrom
Xynnn007:feat-selectable-policy

Conversation

@Xynnn007

Copy link
Copy Markdown
Member

This patch mainly introduces a static config that maps id field to a set of policy ids. By default, if no id is given from client side, the "default" policy will still be used.

For ITA, in previous version it has its own config to specify the policy ids. In this new version, if any id->policy ids is given by the request, it will use the mapped policy ids. If not, use the policy ids in the ITA config.

We do not bump a protocol version here as it's add-only feature and do not break.

Fixes #282

@fitzthum fitzthum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks fine. A couple design comments, but I think this is workable. At least it's disabled by default.

Comment thread kbs/docs/kbs_attestation_protocol.md Outdated
Comment thread kbs/docs/kbs_attestation_protocol.md Outdated
Comment thread kbs/docs/kbs_attestation_protocol.md Outdated
are specific to a deployment and must be known to the KBC in advance. An
unmapped `id` is rejected, and omitting the field selects a default policy.

The KBC picks the `id` itself, so doing so is not an authorization decision. The

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't really understand what is meant by authorization decision. The policy hint must exist in the map configured by the admin, but this is still a highly significant field. It can completely shift the meaning of the attestation result.

Should consumers of the attestation token now be checking the policy id to make sure it was the right one? Ofc they don't know the real policy id or content, just the hint.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh. That means selection of the id does not mean any authorization to access the KBS, just a hint. All authorization work is to filter the AS token based on kbs policy

@Xynnn007 Xynnn007 Jul 30, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The user does not need to know. It does not matter. It matters for KBS to know it. The token provisioner hinted by iss and the policy id can be used to generally index a policy. The hint is enough for the user. But, if the user and the attestation admin/trustee admin, he needs to know it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am just a little worried about cases where we switched between two policies with different meanings. Keep in mind that this field is not measured so it could be modified in transit. In this case does the user need to inspect the attestation token to make sure the right policy was used?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It can be modified during transit. But note that AS will sincerely evaluate the evidences based on the "malwared" policy id(s). Then, it's responsibility of KBS, to check if the token has proper policy id(s).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i still think this is a little sketchy, but I guess we do not enable this feature by default so I can live with it

@Xynnn007
Xynnn007 force-pushed the feat-selectable-policy branch from de04b7f to 252fe13 Compare July 30, 2026 02:21
The RCAR implementation gave the Attestation Service no say over which
policy to apply: both CoCo AS backends hardcoded "default", so a
deployment could not evaluate different guests against different
policies without editing that one policy in place.

Widen the Attest::verify interface to carry the policies to evaluate
with, in preparation for letting a client select them. Passing None
keeps each backend on the behaviour it has today, which for the CoCo AS
backends is the "default" policy and for Intel TA is the configured
policy_ids list, so this commit is a no-op at runtime. The literal that
the CoCo backends share moves to their common module rather than being
repeated.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@fitzthum fitzthum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

like i said, i don't totally love this feature, but i guess it's ok to give people the option.

maybe another review from @confidential-containers/trustee-maintainers would be good

@Xynnn007

Xynnn007 commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

cc @mythi I guess you will be interested in this multiple policy selection part.

@Xynnn007
Xynnn007 force-pushed the feat-selectable-policy branch from 252fe13 to 0385096 Compare August 7, 2026 06:56
Xynnn007 and others added 2 commits August 10, 2026 14:09
A KBC could not indicate which attestation policy should judge its
evidence, so all guests of a deployment shared one policy. Let the KBC
name an "policy selector" in the extra-params of the RCAR Request,
which KBS resolves through the new policy_id_map configuration.

Resolving through an administrator-declared table is preferred over
letting the KBC name Attestation Service policy IDs directly. It keeps a
client-controlled string away from the AS policy storage keys, avoids
turning the AS policy namespace into a public contract that guest images
depend on, and bounds the reachable policies to a whitelist. An unknown
id is rejected at /auth rather than falling back, so a typo cannot
silently change which policy applies. Omitting the field keeps the
existing behaviour, and the map is empty by default, so the feature is
inert until an administrator opts in.

An id mapped to an empty list is rejected at startup: it would leave the
evidence unevaluated, and Intel TA accepts that silently by disabling
policy matching altogether.

Note that a KBC picking its own id is not an authorization decision. The
policy that was applied is reported in the attestation token, so a
resource policy can restrict what a given appraisal releases; the
default resource policy does not do so yet.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Describe the "policy-selector" field of the RCAR Request in the protocol
document, including that its accepted values are deployment specific and
that an unmapped id is rejected, both of which a KBC implementation has
to know. State that selecting an id is not an authorization decision so
that readers do not mistake it for one.

Document policy_id_map for each attestation service type, and note that
for Intel TA a selected id replaces the configured policy_ids.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Xynnn007
Xynnn007 force-pushed the feat-selectable-policy branch from 0385096 to 4d61017 Compare August 10, 2026 06:09
@Xynnn007

Copy link
Copy Markdown
Member Author

Seem like I cannot get copilot to review this PR.

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.

KBS does not support multiple attestation policies

2 participants