Skip to content

Fix vendor path leak in source file resolution#22

Merged
LeahArmstrong merged 1 commit intomainfrom
fix/vendor-path-leak
Feb 28, 2026
Merged

Fix vendor path leak in source file resolution#22
LeahArmstrong merged 1 commit intomainfrom
fix/vendor-path-leak

Conversation

@LeahArmstrong
Copy link
Owner

Summary

  • Add app_source? and resolve_source_location shared helpers to SharedUtilityMethods that filter out vendor bundle and node_modules paths
  • Standardize all 9 extractors (model, controller, graphql, view_component, phlex, serializer, mailer, job, action_cable) to use convention-path-first resolution with vendor filtering
  • Remove duplicate condition_label from ModelExtractor (identical to SharedUtilityMethods version)

Problem

In Docker environments where Rails.root = /app, the start_with?(app_root) check incorrectly accepted vendor bundle paths like /app/vendor/bundle/ruby/3.x/gems/activerecord-7.0.8.7/lib/active_record/base.rb because they start with /app. This caused ~50% of models, ~27% of controllers, and ~40% of GraphQL types to get wrong file_path and source_code.

Test plan

  • Full gem test suite passes (3243 examples, 0 failures)
  • Verified in host app extraction: 0 wrong across all application categories
  • Review app_source? filtering covers expected exclusion patterns
  • Review resolve_source_location tier ordering (const_source_location > instance methods > class methods)

In Docker environments where Rails.root is /app, the start_with?(app_root)
check incorrectly accepted vendor bundle paths like /app/vendor/bundle/...
because they start with /app. This caused wrong file_path and source_code
for models, controllers, GraphQL types, and other extracted units.

Adds app_source? and resolve_source_location shared helpers to
SharedUtilityMethods, then standardizes all 9 extractors to use
convention-path-first with vendor/node_modules filtering.
@LeahArmstrong LeahArmstrong merged commit 10f80d0 into main Feb 28, 2026
5 checks passed
@LeahArmstrong LeahArmstrong deleted the fix/vendor-path-leak branch February 28, 2026 22:16
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.

1 participant