Skip to content

hardware_bridge / cryptography import rules match a library name anywhere on an import line (same weakness as #4150) #4238

Closed

Description

@squid-protocol

hardware_bridge and cryptography (python.py, javascript.py; typescript does not carry them) are the last import-anchored rules still using \b(?:import|require|from)\b.*?(?:names)\b, the library name ANYWHERE on an import line. This is the weakness #4150 / PR #4231 fixed for the AI/ML rules (and #4149 for llm_api).

Confirmed false positives against current main:

  • python cryptography: from myproj.crypto.utils import hash_it
  • python hardware_bridge: from airflow.providers.usb.hooks import UsbHook, from app.printer import render
  • js hardware_bridge: import { Foo } from './usb/driver';, import { P } from './printer/queue';
  • js cryptography: const c = require('../crypto/helpers');, import x from '@/lib/ssl-utils';

Fix: anchor on the package's top-level name with _py_package_import / _js_package_import, plus a test file with false positives, true positives and ReDoS payloads, and corpus before/after.

Activity

  1. added
    bug
    core-engine
    on Oct 3, 2026
  2. added a commit that references this issue on Oct 3, 2026
  3. added
    scope:infra
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginepriority: mediumscope:infra

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions