Skip to content

match listed unsafe names before safe pattern in classify_class_name - #51

Open
abdul-khaliq-khalid wants to merge 1 commit into
google:mainfrom
abdul-khaliq-khalid:classify-unsafe-precedence
Open

match listed unsafe names before safe pattern in classify_class_name#51
abdul-khaliq-khalid wants to merge 1 commit into
google:mainfrom
abdul-khaliq-khalid:classify-unsafe-precedence

Conversation

@abdul-khaliq-khalid

Copy link
Copy Markdown

classify_class_name runs the safe regex before the unsafe one, so a name whose module is safe-listed but whose full path is in UNSAFE_STRINGS (pydoc.locate, pydoc.pipepager, torch.load, numpy.lib.npyio.loadtxt, pandas.read_pickle) comes back SAFE, and _reclassify_with_resolution then re-labels an already detected hit as safe. A pickle that invokes one of these gadgets scores unsafe=0 when the referenced module is importable, so pydoc.pipepager runs a shell command yet passes the scan. This checks exact membership in the unsafe, suspicious, then safe sets before the pattern fallback, the same order _classify_item already uses.

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