Commit c816f6c
fix(s3vectors): return Grant covering all index ARNs in _internalGrant (#1358)
* fix(s3vectors): return Grant covering all index ARNs in _internalGrant
When granting on an explicit indexIds array, _internalGrant reassigned
indexResult on each loop iteration (keeping only the last index ARN) and
then returned `bucketResult ?? indexResult`, so callers received a Grant
referencing only the bucket - never the index permissions actually granted.
The IAM policy document was always correct (statements are added as a side
effect); only the returned Grant handle was wrong, which breaks dependency
wiring via grant.applyBefore()/assertSuccess().
- Combine per-index grants with Grant.combine instead of overwriting
- Combine the bucket and index grants for the return value
- Add a regression test asserting the returned Grant references every
specified index ARN, not just the last
* test(s3vectors): assert bucket ARN survives combine + parametrize grantRead/Write/Delete
Address @krokoko's two review suggestions on the returned-Grant regression test:
- Assert the bucket statement survives bucketResult.combine(indexResult), not
just the index ARNs (a standalone VectorBucketArn resource without /index/).
- Parametrize across grantRead/grantWrite/grantDelete via test.each so all three
exercise the multi-index combine path; grantDelete is the exact last-index-only
scenario from the bug title.
Test-only; the fix in vector-bucket.ts is unchanged. All 3 cases fail on the
pre-fix return (bucketResult ?? indexResult) and pass with the combine.
---------
Co-authored-by: Alain Krok <alkrok@amazon.com>1 parent 26ff647 commit c816f6c
2 files changed
Lines changed: 49 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| 304 | + | |
| 305 | + | |
304 | 306 | | |
305 | 307 | | |
306 | 308 | | |
307 | | - | |
| 309 | + | |
308 | 310 | | |
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
| 315 | + | |
313 | 316 | | |
314 | 317 | | |
315 | 318 | | |
| |||
320 | 323 | | |
321 | 324 | | |
322 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
323 | 331 | | |
324 | 332 | | |
325 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 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 | + | |
626 | 666 | | |
627 | 667 | | |
628 | 668 | | |
| |||
0 commit comments