Skip to content

Change impact cards show the session cookie and local folder paths in their evidence #462

Closed

Description

@ARSH871-bot

What's wrong

Several change_impact findings set evidence.source to f"{before_dir} -> {after_dir}" (analysis/change_impact.py:511, 566, 581, 600, 627, 646 on main d424e05), or to str(folder) (:528, 544, 554). Through propose-a-change, before_dir is the session's upload folder, and that folder is named after the session cookie.

Measured (main d424e05, live Batfish)

allow 10.10.10.0/24 to 8.8.8.8 on tcp/80 on rtr-us5, with no policy staged, through /api/propose:

CH-000  none  "4 policy rule(s) unchanged by this edit"
source: C:\Users\vhora\Netwise\...\web\uploaded_configs\sessions\hCf7lpCUZ2e753zhNbblAA\current
        -> C:\Users\vhora\AppData\Local\Temp\netwise-proposal-fo41787r\after

hCf7lpCUZ2e753zhNbblAA is the session id. web/main.py's session middleware uses that same value as the folder name and as the netwise_session cookie (new_session_id(), web/session.py:74-82). The cookie is set httponly so that page scripts never see it. app.js:142 then renders evidence.source as text on the card, so the cookie is in the page after all, along with the Windows user name and a temp folder that has already been deleted.

The same source appears on the "could not run" cards, for example when Batfish is unreachable (:511).

Why it matters

Netwise is bound to 127.0.0.1 and a session holds no credentials, so the risk is small today. But it undoes httponly, it puts a session token into anything a user copies or screenshots from the propose pane, and it tells the reader nothing useful: neither path is something they can open. It also stops being small the day Netwise runs on a shared server (#327).

Suggested fix

  • Give the source a label for each side, for example uploaded config -> proposed copy, passed in by ai/propose.py, and keep real paths only for the command-line entry point, where the user typed them.
  • A test that runs a proposal and asserts the session id appears nowhere in the response.

Found while reviewing #405. Not caused by it: the same output comes from main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workinglayer: analysisLayer 1 — Batfish orchestration, checks, the pipeline

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions