Skip to content

Feature branch for Asset scanning v2 - #294

Open
naman-contentstack wants to merge 38 commits into
v2-devfrom
feat/Asset-Scanning
Open

Feature branch for Asset scanning v2#294
naman-contentstack wants to merge 38 commits into
v2-devfrom
feat/Asset-Scanning

Conversation

@naman-contentstack

Copy link
Copy Markdown
Contributor

No description provided.

naman-contentstack and others added 30 commits May 21, 2026 12:30
feat: add support for asset scaning in import command
feat: enhance bulk asset operations with data-dir support and user prompts
fix: minor fixes in asset scanning flow
@naman-contentstack
naman-contentstack requested a review from a team as a code owner July 14, 2026 12:14
@naman-contentstack naman-contentstack self-assigned this Jul 16, 2026
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 1 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 0
  • Medium without fixes: 1
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@snyk-io

snyk-io Bot commented Aug 3, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@dhavaljain999

Copy link
Copy Markdown

Approved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

It includes a broken .talismanrc structure plus an unused method and lacks unit tests for the newly introduced data-dir scanning logic.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR extends the Contentstack CLI plugins to support “Asset scanning v2” behaviors by wiring plan/feature checks into import/export flows and adding scan-status-aware bulk asset publishing, including a new --data-dir publish mode for post-import publishing once scanning completes.

Changes:

  • Add plan-protected feature handling for assetsScan and propagate plan status into import/export configs.
  • Update import assets flow to skip publishing when asset scanning is enabled and print follow-up bulk publish guidance.
  • Enhance bulk asset operations to fetch/include asset scan status, skip pending/quarantined assets, and add a streaming --data-dir publish flow (plus --dry-run).
File summaries
File Description
pnpm-lock.yaml Dependency lock updates to support the new/updated functionality.
packages/contentstack-import/src/utils/import-config-handler.ts Adds deferred plan checks and sets import flags for asset scanning.
packages/contentstack-import/src/types/import-config.ts Extends import config with plan status and asset scanning flags.
packages/contentstack-import/src/import/modules/assets.ts Adjusts assets import messaging/behavior based on plan scanning status.
packages/contentstack-import/src/import/module-importer.ts Adds (currently unused) org plan feature detection helper.
packages/contentstack-import/src/commands/cm/stacks/import.ts Passes command context into import config and prints scan follow-up guidance.
packages/contentstack-import/package.json Declares assetsScan as a plan-protected feature for the import plugin.
packages/contentstack-export/src/utils/export-config-handler.ts Minor formatting adjustment while preserving deferred plan check behavior.
packages/contentstack-export/package.json Adds assetsScan alongside amAssets to plan-protected features.
packages/contentstack-bulk-operations/test/unit/services/bulk-operation-service.test.ts Updates expectations for new bulk payload validation behavior.
packages/contentstack-bulk-operations/src/utils/item-fetcher.ts Includes _asset_scan_status when building asset items.
packages/contentstack-bulk-operations/src/utils/interactive.ts Skips env/locale prompts when --data-dir selects the backup-driven flow.
packages/contentstack-bulk-operations/src/utils/index.ts Exports new helpers for scan/status + data-dir scanning.
packages/contentstack-bulk-operations/src/utils/helpers.ts Adds categorizeByScanStatus helper for scan-status filtering.
packages/contentstack-bulk-operations/src/utils/data-dir-asset-fetcher.ts New pass-1 scanner to summarize backup directory publishability before enqueueing.
packages/contentstack-bulk-operations/src/utils/config-builder.ts Adds dataDir/dryRun to config and relaxes env/locale validation for data-dir mode.
packages/contentstack-bulk-operations/src/utils/batch-queue-handler.ts Passes batch env/locales into bulk publish submission and adjusts batch logging.
packages/contentstack-bulk-operations/src/services/bulk-operation-service.ts Threads env/locale overrides into payload creation and adds validation errors.
packages/contentstack-bulk-operations/src/services/asset-service.ts Adds scan-status inclusion in queries and a helper to fetch scan status by UID batches.
packages/contentstack-bulk-operations/src/messages/index.ts Adds new message strings for scan-status dashboards and data-dir flow messaging.
packages/contentstack-bulk-operations/src/interfaces/index.ts Extends interfaces with scan status and new data-dir/dry-run flags.
packages/contentstack-bulk-operations/src/commands/cm/stacks/bulk-assets.ts Adds streaming --data-dir publish flow and scan-status-aware filtering/dashboarding.
packages/contentstack-bulk-operations/src/base-bulk-command.ts Exposes batchResults to subclasses and allows overriding interactive flag resolution.
packages/contentstack-apps-cli/package.json Formatting-only JSON change.
.talismanrc Updates ignore list (but currently has invalid structure that needs correction).
Review details

Files not reviewed (1)

  • pnpm-lock.yaml: Generated file
  • Files reviewed: 23/25 changed files
  • Comments generated: 3
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread .talismanrc
Comment on lines 1 to +8
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: a90a8f0dbfa98da53ecb9e63f021ae8a1ac44c03cfe5dccd52a539c948d1625a
- filename: packages/contentstack-export/src/utils/export-config-handler.ts
checksum: 3ff8e8ea60f92311f8224bce457f7aaab026194de61e13eebdc6ca5a39f66bc9
- filename: packages/contentstack-asset-management/src/utils/export-helpers.ts
checksum: 726d1632110ebc203ce70dc1cbe7d4b3011f56349ed371b6645d0375e7818cad
- filename: packages/contentstack-asset-management/src/utils/cs-assets-api-adapter.ts
checksum: bc4a53f96be6a10786e00133245c7bdc43c965c8a98b753e3879e1110cf9c601
- filename: packages/contentstack-asset-management/test/unit/utils/cs-assets-api-adapter.test.ts
checksum: 63c6bff4d51842d8fa3cce88545259d0a2c3cfe71df95d303d993f692cee883b
version: '1.0'
checksum: e37e3f40d68a726bd19d13f93cfc1279d726f1509b9bfbffcdf657df4efad70b
- filename: packages/contentstack-import/src/import/modules/assets.ts
checksum: f00f743e50ddc040e79e40677bfd2f220b55bab02d8924265cb2c0ef508e9008
- filename: packages/contentstack-import/src/utils/import-config-handler.ts
checksum: 5b2050b283ea3d990e8ad3207b054c6932b76d2bd82a9f659b287ef11dec9f83
version: ""
Comment on lines +198 to +206
private async detectAssetScanning(orgUid: string): Promise<boolean> {
try {
const orgDetails = await this.managementAPIClient.organization(orgUid).fetch({ include_plan: true });
const features: Array<{ uid: string; enabled?: boolean }> = orgDetails?.plan?.features || [];
return features.some((f) => (f.uid === 'assetsScan' || f.uid === 'amAssetsScan') && f.enabled === true);
} catch {
return false;
}
}
Comment on lines +28 to +36
export async function scanDataDirStats(
dataDir: string,
overrideEnvs?: string[],
overrideLocales?: string[],
logger?: any
): Promise<DataDirScanStats> {
const assetsIndexPath = path.join(dataDir, 'assets', 'assets.json');
const environmentsPath = path.join(dataDir, 'environments', 'environments.json');
const assetUidMapperPath = path.join(dataDir, 'mapper', 'assets', 'uid-mapping.json');
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.

6 participants