Skip to content

Say how to install ccl_chromium_reader instead of failing with a traceback - #353

Open
dchaudhari7177 wants to merge 1 commit into
RyanDFIR:mainfrom
dchaudhari7177:fix/331-actionable-missing-ccl-error
Open

Say how to install ccl_chromium_reader instead of failing with a traceback#353
dchaudhari7177 wants to merge 1 commit into
RyanDFIR:mainfrom
dchaudhari7177:fix/331-actionable-missing-ccl-error

Conversation

@dchaudhari7177

Copy link
Copy Markdown
Contributor

Refs #331option 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

  File "…/hindsight.py", line 22, in <module>
    from pyhindsight.analysis import AnalysisSession
  File "…/pyhindsight/analysis.py", line 18, in <module>
    from pyhindsight.browsers.chrome import Chrome
  File "…/pyhindsight/browsers/chrome.py", line 18, in <module>
    import ccl_chromium_reader
ImportError: No module named 'ccl_chromium_reader'

After

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.

[exited with code 1]

No traceback, exit 1.

How

chrome.py's import raises an ImportError carrying the command, and both entry points (hindsight.py, hindsight_gui.py) catch that one error and exit with the message alone. Any other ImportError is 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_path finder that makes the module unimportable, then importing each entry point:

before after
import hindsight 6-frame traceback ending in ImportError the message above, exit 1
import hindsight_gui same same
with ccl present imports fine imports fine, main callable

pytest: 248 passed, 2 skipped, 80 subtests passed — unchanged.

What this does not do

Left open on purpose, and why the issue should stay open:

  • The dependency is still undeclared, so pip install pyhindsight still needs a second command. That is options 1 and 2.
  • ccl's 43 bare print() calls are still worked around by the stdout guard rather than fixed, and ccl_chromium_sessionstorage's None logger 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.

…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.
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