Skip to content

fix: run scanner from /app directory to prevent module resolution conflict#19

Merged
williambrady merged 1 commit intomainfrom
fix/entrypoint-working-directory
Feb 24, 2026
Merged

fix: run scanner from /app directory to prevent module resolution conflict#19
williambrady merged 1 commit intomainfrom
fix/entrypoint-working-directory

Conversation

@williambrady
Copy link
Copy Markdown
Owner

Summary

  • Fixes a bug where the scanner's entrypoint executes the scanned repo's src/main.py instead of its own when the target repo contains a src/main.py module
  • Adds cd /app before python -m src.main in entrypoint.sh so Python module resolution starts from the scanner's install directory

Root Cause

The GitHub Action runs with /github/workspace as the working directory. python -m src.main resolves modules relative to the current directory first, so if the scanned repository has its own src/main.py, Python executes that instead of the scanner's code at /app/src/main.py.

Test plan

  • Run the scanner against a repo that has its own src/main.py and verify the scanner executes correctly
  • Run the scanner against a repo without src/main.py to confirm no regression

…flict

When scanning a repo that has its own src/main.py, the entrypoint's
`python -m src.main` resolves the scanned repo's module instead of the
scanner's because /github/workspace is the working directory. Changing
to /app before execution ensures the scanner's own src.main is used.
Copilot AI review requested due to automatic review settings February 24, 2026 18:11
Copy link
Copy Markdown
Collaborator

@ghaworkflow ghaworkflow left a comment

Choose a reason for hiding this comment

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

Looks like it should work.

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Feb 24, 2026

🤖 Augment PR Summary

Summary: Adjusts the action entrypoint to run the scanner from its installed /app directory so Python resolves src.main from the scanner, not the scanned repository.

Change: Updates entrypoint.sh to cd /app before invoking python -m src.main, preventing module-name collisions when a target repo contains src/main.py.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@williambrady williambrady merged commit fe9d905 into main Feb 24, 2026
7 checks passed
@williambrady williambrady deleted the fix/entrypoint-working-directory branch February 24, 2026 18:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug where the scanner could execute a scanned repository's src/main.py instead of its own when Python module resolution prioritizes the current working directory. The fix changes the working directory to /app (the scanner's installation directory) before executing the scanner's main module.

Changes:

  • Modified entrypoint.sh to cd to /app before running the Python scanner module, preventing module resolution conflicts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants