Say how to install ccl_chromium_reader instead of failing with a traceback - #353
Open
dchaudhari7177 wants to merge 1 commit into
Open
Say how to install ccl_chromium_reader instead of failing with a traceback#353dchaudhari7177 wants to merge 1 commit into
dchaudhari7177 wants to merge 1 commit into
Conversation
…eback
ccl_chromium_reader exists only as a git repo and PyPI rejects metadata with
direct-URL dependencies, so it cannot go in pyproject.toml's dependencies. A
plain pip install pyhindsight therefore produces a package whose first use ends
in a bare ModuleNotFoundError six frames deep, with no hint at the fix.
File "pyhindsight/browsers/chrome.py", line 18, in <module>
import ccl_chromium_reader
ImportError: No module named 'ccl_chromium_reader'
chrome.py's import now raises an ImportError naming the exact command, and both
entry points catch that one error and exit 1 with the message alone:
Hindsight needs ccl_chromium_reader, which is not on PyPI and so cannot be
installed automatically. Install it with:
pip install git+https://github.com/cclgroupltd/ccl_chromium_reader.git
Without it, cache, IndexedDB, Session Storage and Local Storage cannot be
parsed. The frozen release binaries already bundle it; only pip installs
need this step.
Any other ImportError is re-raised untouched, so a genuinely broken install
still shows its own traceback.
This is option 3 of RyanDFIR#331 -- the hardening that is worth having whichever way
the distribution question is settled. It does not close the issue: the
dependency is still undeclared and ccl's 43 bare print() calls are still worked
around by the stdout guard.
Verified by making ccl unimportable through a meta-path finder and importing
each entry point: before, the six-frame traceback above; after, the message and
exit 1. With ccl present, both import unchanged. 248 tests pass.
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.
Refs #331 — option 3 only, and deliberately not a close.
The issue lists three options in preference order. 1 (ask CCL to publish to PyPI) and 2 (vendor it) are calls for the project to make, and neither is mine to decide. 3 is the "minimum hardening regardless of the choice", and it is worth having whichever way the other two go.
Before
After
No traceback, exit 1.
How
chrome.py's import raises anImportErrorcarrying the command, and both entry points (hindsight.py,hindsight_gui.py) catch that one error and exit with the message alone. Any otherImportErroris re-raised untouched, so a genuinely broken install still shows its own traceback rather than being mislabelled as a missing ccl.The message says the release binaries already bundle it, because otherwise the natural next question is "then why does the exe work?".
Verified
Reproducing the pip-install-without-ccl shape on a machine that has ccl, via a
sys.meta_pathfinder that makes the module unimportable, then importing each entry point:import hindsightImportErrorimport hindsight_guimaincallablepytest: 248 passed, 2 skipped, 80 subtests passed — unchanged.What this does not do
Left open on purpose, and why the issue should stay open:
pip install pyhindsightstill needs a second command. That is options 1 and 2.print()calls are still worked around by the stdout guard rather than fixed, andccl_chromium_sessionstorage'sNonelogger is still monkeypatched at runtime. Both need the control that only vendoring or an upstream change gives.Happy to do the vendoring in a follow-up if that is the direction you want — including the sync script in the manner of
regen-protos.sh— but that wants your decision first, not a PR that assumes it.