fix: resolve lab12 timeline anomaly variable flow#244
Merged
Conversation
Use the fitted feature matrix and Isolation Forest prediction semantics in the timeline block so Colab execution no longer fails on undefined variables. Made-with: Cursor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
No high-confidence vulnerabilities found in this PR.
Security review of the diff in notebooks/lab12_anomaly_detection.ipynb found only notebook-local dataflow/visualization fixes:
score_samplesinput changed fromX_test_scaledtoX_scaled- anomaly flag logic corrected to
iso_pred == -1 - traffic plot y-axis changed to
bytes_sent + bytes_recv
These changes do not introduce new external input processing, auth logic, command/query construction, deserialization, network request handling, or secret management paths.
Residual risk / validation note:
- This is a notebook change and appears non-production, but if notebook outputs are later operationalized, keep the same controls around input validation and logging hygiene.
Sent by Cursor Automation: Find vulnerabilities
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
Test plan
Note
Low Risk
Low risk: notebook-only fixes to variable references and plotting inputs; behavior change is limited to the timeline visualization and anomaly flagging logic.
Overview
Fixes the Lab 12 attack timeline cell to compute Isolation Forest scores against
X_scaled(avoiding an undefinedX_test_scaled) and to explicitly storeiso_predondfbefore derivingis_anomalyusing the correct-1anomaly convention.Updates the traffic-volume plot to use total bytes (
bytes_sent + bytes_recv) instead of a missingbytescolumn so the timeline chart renders correctly.Written by Cursor Bugbot for commit b1b68da. This will update automatically on new commits. Configure here.