Commit ccdbd57
[Cloud Services] Rename credentials_workload_identity_provider to credentials_audience (elastic#265059)
## Summary
This PR bundles two Fleet fixes affecting the OTel permission verifier
flow:
### 1. Fix verifier agent policies leaking on agentless deploy failure
Two bugs caused verifier policies to accumulate indefinitely whenever
the agentless API returned an error (e.g. the 429 "agentless
provisioning limit" response seen in prod logs):
- **Missing inline rollback** — `createVerifierPolicy`
(`agent_policy.ts:2762`) persisted the agent-policy SO via
`this.create(...)` and then called `deployPolicy(..., {
throwOnAgentlessError: true })` without a try/catch. When deploy threw,
the SO was left orphaned with `is_verifier: true`. Now mirrors the
pattern in `agent_policy_create.ts:285-299`: wraps the deploy in a
try/catch that calls `deleteVerifierPolicy` before re-throwing.
- **Space-blind cleanup query** — `verify_permissions_task.ts` Phase 1
cleanup (line 244) and Phase 2 gate-check (line 130) called
`agentPolicyService.list` with no `spaceId`. Combined with the
`getInternalUserSOClientWithoutSpaceExtension` SO client, the `find`
resolved to the default namespace only, so orphans created in
non-default spaces were invisible — producing the `Found 0 verifier
policies for cleanup check` log even when orphans existed. Now passes
`spaceId: '*'` on both calls.
### 2. Rename `credentials_workload_identity_provider` →
`credentials_audience`
Renames the GCP cloud connector verifier variable in
`buildVerifierCredentialVars` (`agent_policy.ts:2809`). The value is
sourced from `gcpVars.audience` (an OIDC audience claim), so the new
name reflects its source semantic rather than the GCP-specific workload
identity provider abstraction.
## Test plan
- [ ] CI runs the new `verify_permissions_task.test.ts` case (`should
query verifier policies across all spaces during cleanup and gate
check`) asserting both `list` sites pass `spaceId: '*'`.
- [ ] CI runs the new `agent_policy.test.ts` case (`should roll back the
verifier policy and re-throw when deployPolicy fails`) asserting
`deleteVerifierPolicy` is invoked on deploy failure.
- [ ] CI runs the existing renamed GCP credential test (`should include
GCP credential vars for gcp provider`) with `credentials_audience`.
- [ ] Confirm the downstream GCP cloud connector integration package
consumes `credentials_audience` (coordinate with integrations).
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>1 parent 475a14b commit ccdbd57
4 files changed
Lines changed: 241 additions & 22 deletions
File tree
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3052 | 3052 | | |
3053 | 3053 | | |
3054 | 3054 | | |
3055 | | - | |
| 3055 | + | |
3056 | 3056 | | |
3057 | | - | |
| 3057 | + | |
3058 | 3058 | | |
3059 | | - | |
| 3059 | + | |
3060 | 3060 | | |
3061 | 3061 | | |
3062 | 3062 | | |
| |||
3122 | 3122 | | |
3123 | 3123 | | |
3124 | 3124 | | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
| 3140 | + | |
| 3141 | + | |
| 3142 | + | |
| 3143 | + | |
| 3144 | + | |
3125 | 3145 | | |
3126 | 3146 | | |
3127 | 3147 | | |
| |||
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2761 | 2761 | | |
2762 | 2762 | | |
2763 | 2763 | | |
2764 | | - | |
2765 | | - | |
2766 | | - | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
2767 | 2775 | | |
2768 | 2776 | | |
2769 | 2777 | | |
| |||
2806 | 2814 | | |
2807 | 2815 | | |
2808 | 2816 | | |
2809 | | - | |
| 2817 | + | |
2810 | 2818 | | |
2811 | 2819 | | |
2812 | 2820 | | |
| |||
Lines changed: 144 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
500 | 523 | | |
501 | 524 | | |
502 | 525 | | |
| |||
550 | 573 | | |
551 | 574 | | |
552 | 575 | | |
553 | | - | |
| 576 | + | |
554 | 577 | | |
555 | 578 | | |
556 | 579 | | |
| |||
583 | 606 | | |
584 | 607 | | |
585 | 608 | | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
586 | 729 | | |
587 | 730 | | |
588 | 731 | | |
| |||
0 commit comments