Repository navigation
feat(audit): support scanning and auditing Jupyter Notebooks (.ipynb) - #42
Open
virgiawanprima wants to merge 1 commit into
Open
virgiawanprima wants to merge 1 commit into
virgiawanprima wants to merge 1 commit into
Conversation
- Support .ipynb in readProjectFiles by extracting Python code cells - Prepend standard '# %% [code cell N]' markers to identify cell context - Comment out IPython magics (%...) and shell escapes (!...) to prevent false positives - Ignore .ipynb_checkpoints directories and *-checkpoint.ipynb files - Allow up to 2MB file size for notebooks to accommodate embedded plot outputs - Add comprehensive unit and integration tests in audit-ipynb.test.ts - Resolves rm-rf-prod#41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for scanning and auditing Jupyter Notebook files (
.ipynb) ingt_audit.Changes:
.ipynbtoSOURCE_EXTinsrc/tools/audit-scan.ts.extractNotebookCodeto parse.ipynbJSON and extract Python code cells, marking each cell with# %% [code cell N].%...) and shell commands (!...) within notebook cells to avoid false-positive syntax matches against Python patterns..ipynb_checkpointsdirectories and*-checkpoint.ipynbfiles in directory walking andSKIP_FILE_RE..ipynbto 2MB (from 200KB) to account for notebooks containing embedded base64 image outputs.src/tools/audit-ipynb.test.ts.Closes #41
Type
Test plan
npm run typecheckpassesnpm testpasses (all 268 test files, 2,069 tests pass)src/tools/audit-ipynb.test.ts