Mark the MLflow test's fake credentials for TruffleHog - #2118
Conversation
The nightly secret scan still fails after the lob exclusion: verified findings dropped 63 -> 0, but two unverified URI results remain, and --results=verified,unknown fails on those too. Both come from tests/unit/torch/utils/test_mlflow.py, whose fixtures embed credentials in a URI so the tests can assert they are masked. Hoisting them into two named constants puts the trufflehog:ignore marker on one short line each -- the marker only applies to the line containing the match, and a trailing comment on every use site would have exceeded the 100 char limit. Narrow on purpose: unlike lob, the URI detector is worth keeping active. A real scheme://user:pass@host leak is plausible in this repo, so the fixtures are annotated rather than the detector disabled. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughMLflow utility tests now use shared credential-bearing URI constants. The constants support URI redaction, command artifact, and tracking URI tests. Test behavior and expected masked outputs remain unchanged. ChangesMLflow test fixture reuse
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2118 +/- ##
=======================================
Coverage 78.73% 78.73%
=======================================
Files 522 522
Lines 60342 60342
=======================================
Hits 47508 47508
Misses 12834 12834
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
What does this PR do?
Type of change: CI/CD bug fix
The nightly secret scan still fails (run). The
lobexclusion worked — verified findings went 63 → 0 — but two unverified URI results remain, and--results=verified,unknownfails the job on those as well:Both come from
tests/unit/torch/utils/test_mlflow.py, which embeds credentials in a URI so the tests can assert they get masked:They arrived with #2023, which is why this is separate from the
lobnoise.The fixtures are hoisted into two named constants so the
trufflehog:ignoremarker sits on one short line each. The marker only applies to the line containing the match, and a trailing comment on all four use sites would have blown the 100-character limit.Deliberately narrow: unlike
lob— irrelevant to this repo and reporting function names as verified — the URI detector is worth keeping. A realscheme://user:pass@hostleak is plausible here, so the fixtures are annotated rather than the detector disabled.Testing
tests/unit/torch/utils/test_mlflow.py: 54 passed, ruff check and format clean. A scan of all tracked files with the detector's own regex now reports 0 unmarked matches.Only tonight's nightly can confirm the job goes green: the scan is diff-scoped on
pull_requestand full-history onschedule, which is why this class of failure never appears on a PR.Before your PR is "Ready for review"
CONTRIBUTING.md: N/ASummary by CodeRabbit