Skip to content

Comments

Fix - containers oci dir scans bugs (AST-130779)#1435

Open
cx-dmitri-rivin wants to merge 5 commits intomainfrom
bug/oci-dir-scans-bugs-1
Open

Fix - containers oci dir scans bugs (AST-130779)#1435
cx-dmitri-rivin wants to merge 5 commits intomainfrom
bug/oci-dir-scans-bugs-1

Conversation

@cx-dmitri-rivin
Copy link
Collaborator

By submitting this pull request, you agree to the terms within the Checkmarx Code of Conduct. Please review the contributing guidelines for guidance on creating high-quality pull requests.

Description

Please provide a summary of the changes and the related issue. Include relevant motivation and context.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Bug Fixes (AST-130779 & AST-130781) in ast-cli:
Fixed validateContainerImageFormat in scan.go so that prefixed inputs like oci-dir:C:\path are routed directly to their specific validators instead of being misidentified as tar file paths on Windows.
Removed dead code blocks that became unreachable after the fix.
Added 3 new test cases for Windows paths in scan_test.go.
Committed and merged main into the working branch.
Image Name Extraction Fix in containers-syft-packages-extractor:
Fixed extractImageNameAndTagFromOCIDir in utils.go — the function only split paths on /, so Windows paths like .\docker.io\library\alpine were kept as the full image name instead of extracting just alpine.
Fix: normalize \ to /, use filepath.Base() to extract the last path component, apply normalizeImageName(), and use filepath.Join() for building the index.json path.

https://checkmarx.atlassian.net/jira/software/c/projects/AST/boards/488?assignee=613f1e6be6c39d007212005d&selectedIssue=AST-130779

https://checkmarx.atlassian.net/jira/software/c/projects/AST/boards/488?assignee=613f1e6be6c39d007212005d&selectedIssue=AST-130781

Checklist

  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules
  • I have updated the CLI help for new/changed functionality in this PR (if applicable)
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

Screenshots (if applicable)

Add screenshots to help explain your changes.

Additional Notes

Add any other relevant information.

cx-dmitri-rivin and others added 5 commits February 9, 2026 10:53
Route all prefixed inputs (oci-dir:, docker:, etc.) directly to their
prefix-specific validators to fix Windows absolute path handling.
Previously, oci-dir:C:\path\to\dir was misrouted through tar file
validation causing "not a valid tar file" errors.

- Move prefix validation check before file path detection
- Remove unreachable dead code (23 lines)
- Add Windows full path test coverage (C:\, D:\ variations)
- Both AST-130779 and AST-130781 are now fixed

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
Copy link

Logo
Checkmarx One – Scan Summary & Details928bbccb-0f78-4894-9df6-5426785345d6

Great job! No new security vulnerabilities introduced in this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant