Skip to content

Add disable_group_name_selectors option to Windows workload attestor#6957

Merged
amartinezfayo merged 7 commits into
spiffe:mainfrom
jananiarunachalam:disable-group-name-selectors
Jul 2, 2026
Merged

Add disable_group_name_selectors option to Windows workload attestor#6957
amartinezfayo merged 7 commits into
spiffe:mainfrom
jananiarunachalam:disable-group-name-selectors

Conversation

@jananiarunachalam

Copy link
Copy Markdown
Contributor

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality
Windows workload attestor group SID resolution.

Description of change
Adds a disable_group_name_selectors boolean configuration option (default: false) to the Windows workload attestor. When enabled, the attestor skips resolving group SIDs to human-readable names via LookupAccountSid, avoiding timeouts for workloads whose principals belong to many groups (~88ms per group, 44+ seconds for 500+ groups). Group SID selectors (group_sid) are always collected regardless of this setting, only group_name selectors are skipped.

Also adds debug-level timing instrumentation to the group name lookup path so operators can observe lookup latency without enabling the flag.

Which issue this PR fixes
fixes #6902

@amartinezfayo amartinezfayo 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.

Thank you @jananiarunachalam for this contribution!

|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| `discover_workload_path` | If true, the workload path will be discovered by the plugin and used to provide additional selectors | false |
| `workload_size_limit` | The limit of workload binary sizes when calculating certain selectors (e.g. sha256). If zero, no limit is enforced. If negative, never calculate the hash. | 0 |
| `disable_group_name_selectors` | If true, skips resolving group SIDs to human-readable names, avoiding expensive Domain Controller lookups. Group SID selectors (`group_sid`) are always collected regardless. Only `group_name` selectors are affected. | false |

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 wonder if it would help to surface in the Notes section that enabling this flag will cause existing workload registration entries using group_name selectors to stop matching, so operators know to audit those entries (or switch them to group_sid selectors) before flipping it on. As a smaller wording detail, I think that LookupAccount is not strictly a Domain Controller call in every environment (local SAM, AD DS, or other providers can answer); something like "potentially expensive account name resolution (e.g. against a Domain Controller)" might be more accurate.

processInfo.groups = append(processInfo.groups, enabledSelector+":"+parseAccount(groupAccount, groupDomain))
}
if !disableGroupNames {
p.log.Debug("lookupAccount (groups) completed", "count", len(groups), "elapsed_ms", time.Since(start).Milliseconds())

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.

A couple of small things on this Debug log. I don't think we have any other elapsed_ms keys already logged. I think telemetry.ElapsedTime and the duration_ms field are the closest that we have, and maybe we could use one of those?
In terms of the wording, maybe "Group account name lookups completed" might feel more familiar.

It could also be worth considering whether this is redundant with the host-level metric from telemetry_workload.StartAttestorCall, which already captures the full per-attestor Attest time and is dominated by this loop for the Windows attestor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed all comments.

This debug log specifically isolates the group name resolution portion with a count, which is still useful for diagnosing whether the lookups are the bottleneck.

Copilot AI review requested due to automatic review settings June 8, 2026 15:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a configuration option to disable group name selector resolution in the Windows workload attestor to avoid potentially expensive SID-to-name lookups.

Changes:

  • Introduces disable_group_name_selectors configuration flag and plumbs it through attestation.
  • Skips LookupAccount for group SIDs when the flag is enabled, still producing group_sid selectors.
  • Updates docs and adds a test case covering the disabled behavior and expected log message.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/agent/plugin/workloadattestor/windows/windows_windows.go Adds config flag, conditionally skips group name lookups, logs when enabled
pkg/agent/plugin/workloadattestor/windows/windows_windows_test.go Adds test case for selectors/logs when group name selectors are disabled
doc/plugin_agent_workloadattestor_windows.md Documents the new configuration flag and operational impact
Comments suppressed due to low confidence (1)

pkg/agent/plugin/workloadattestor/windows/windows_windows.go:1

  • start := time.Now() is executed even when disableGroupNames is true, but the timing is only used when group name lookups are enabled. Move the start initialization inside the if !disableGroupNames path (e.g., set it before running lookups / before the loop only when enabled) to avoid unnecessary work and keep the intent clearer.
//go:build windows

@jananiarunachalam
jananiarunachalam force-pushed the disable-group-name-selectors branch from f0b09c0 to 24df7be Compare June 8, 2026 15:45

@amartinezfayo amartinezfayo 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.

Thank you @jananiarunachalam!

p.config = newConfig

if newConfig.DisableGroupNameSelectors {
p.log.Info("Group name selectors disabled; skipping LookupAccount for groups, only group_sid selectors will be produced")

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'm wondering if this operator-facing message could drop the LookupAccount reference, since that's an internal call name rather than something an operator reading the logs would recognize. Something like "Group name selectors disabled; only group_sid selectors will be produced for groups" might read a little more clearly while still conveying the behavior change.

Janani Arunachalam added 6 commits July 2, 2026 14:36
Signed-off-by: Janani Arunachalam <jarunachala2@bloomberg.net>
Signed-off-by: Janani Arunachalam <jarunachala2@bloomberg.net>
Signed-off-by: Janani Arunachalam <jarunachala2@bloomberg.net>
Signed-off-by: Janani Arunachalam <jarunachala2@bloomberg.net>
Signed-off-by: Janani Arunachalam <jarunachala2@bloomberg.net>
Signed-off-by: Janani Arunachalam <jarunachala2@bloomberg.net>
@jananiarunachalam
jananiarunachalam force-pushed the disable-group-name-selectors branch from 616b3c4 to 31a4ac0 Compare July 2, 2026 13:37
@jananiarunachalam

Copy link
Copy Markdown
Contributor Author

Rebased on latest main to resolve a merge conflict in windows_windows.go. No code changes - only incorporated the new AttestReference method added by #6915. Only thing to review is: 31a4ac0 which has the updated log line changes requested.

Signed-off-by: Janani Arunachalam <jarunachala2@bloomberg.net>
@MarcosDY MarcosDY added this to the 1.15.2 milestone Jul 2, 2026

@amartinezfayo amartinezfayo 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.

🚀

@amartinezfayo
amartinezfayo added this pull request to the merge queue Jul 2, 2026
Merged via the queue into spiffe:main with commit 2be070d Jul 2, 2026
53 checks passed
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.

Add a mechanism to skip group SID to name lookup in Windows workload attestor

4 participants