[GH-ISSUE #95] Support for JavaScript/TypeScript Wildcard Imports in AWS SDK Extraction #154

Open
opened 2026-03-15 11:48:29 +03:00 by kerem · 0 comments
Owner

Originally created by @adpaco-aws on GitHub (Jan 9, 2026).
Original GitHub issue: https://github.com/awslabs/iam-policy-autopilot/issues/95

Is your feature request related to a problem? Please describe.

I'm unable to generate policies for JavaScript/TypeScript codebases that use wildcard import syntax like import * as S3 from '@aws-sdk/client-s3'. The current extractor only detects AWS SDK operations when using explicit named imports or destructuring imports, but many codebases use namespace imports for better code organization. This results in incomplete IAM policy generation because waiter calls, command instantiations, and paginator usage are not detected when accessed through a namespace (e.g., S3.waitUntilBucketExists(), new S3.CreateBucketCommand()).

Describe the solution you'd like

I'd like the JavaScript/TypeScript extractor to support wildcard import patterns and detect AWS SDK operations accessed through namespaces. Specifically:

  1. Import Detection: Recognize import * as NameSpace from '@aws-sdk/client-service' patterns
  2. Operation Detection: Detect namespace-prefixed calls like:
    • NameSpace.waitUntilBucketExists(config, params) (waiters)
    • new NameSpace.CreateBucketCommand(params) (commands)
    • NameSpace.paginateListObjects(config, params) (paginators)
  3. Service Resolution: Map the namespace back to the correct AWS service for policy generation

Additional context

Current Working Pattern:

// ✅ Currently supported
import { S3Client, waitUntilBucketExists, CreateBucketCommand } from '@aws-sdk/client-s3';

await waitUntilBucketExists({ client }, { Bucket: 'my-bucket' });
const command = new CreateBucketCommand({ Bucket: 'my-bucket' });

Requested Pattern:

// ❌ Not currently supported
import * as S3 from '@aws-sdk/client-s3';

await S3.waitUntilBucketExists({ client }, { Bucket: 'my-bucket' });
const command = new S3.CreateBucketCommand({ Bucket: 'my-bucket' });
Originally created by @adpaco-aws on GitHub (Jan 9, 2026). Original GitHub issue: https://github.com/awslabs/iam-policy-autopilot/issues/95 **Is your feature request related to a problem? Please describe.** I'm unable to generate policies for JavaScript/TypeScript codebases that use wildcard import syntax like `import * as S3 from '@aws-sdk/client-s3'`. The current extractor only detects AWS SDK operations when using explicit named imports or destructuring imports, but many codebases use namespace imports for better code organization. This results in incomplete IAM policy generation because waiter calls, command instantiations, and paginator usage are not detected when accessed through a namespace (e.g., `S3.waitUntilBucketExists()`, `new S3.CreateBucketCommand()`). **Describe the solution you'd like** I'd like the JavaScript/TypeScript extractor to support wildcard import patterns and detect AWS SDK operations accessed through namespaces. Specifically: 1. **Import Detection**: Recognize `import * as NameSpace from '@aws-sdk/client-service'` patterns 2. **Operation Detection**: Detect namespace-prefixed calls like: - `NameSpace.waitUntilBucketExists(config, params)` (waiters) - `new NameSpace.CreateBucketCommand(params)` (commands) - `NameSpace.paginateListObjects(config, params)` (paginators) 3. **Service Resolution**: Map the namespace back to the correct AWS service for policy generation **Additional context** **Current Working Pattern:** ```javascript // ✅ Currently supported import { S3Client, waitUntilBucketExists, CreateBucketCommand } from '@aws-sdk/client-s3'; await waitUntilBucketExists({ client }, { Bucket: 'my-bucket' }); const command = new CreateBucketCommand({ Bucket: 'my-bucket' }); ``` **Requested Pattern:** ```javascript // ❌ Not currently supported import * as S3 from '@aws-sdk/client-s3'; await S3.waitUntilBucketExists({ client }, { Bucket: 'my-bucket' }); const command = new S3.CreateBucketCommand({ Bucket: 'my-bucket' }); ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/iam-policy-autopilot#154
No description provided.