Files
pipdock/.gitattributes
T
poli0981andClaude Opus 5 5023e39485 feat(core): the pip-audit parser, and SP-4's fixture at last
SP-4's exit criterion was "command line + JSON fixture pinned". The command line was
pinned in prose in Phase 0; the fixture never was, so every claim about pip-audit's
output in PRD, SECURITY and CODE-HEALTH-SPEC has been unchecked since. It is captured
now, from the pinned 2.10.1 against the spike's own `urllib3==2.0.0` environment, and
`crates/pipdock-core/src/audit.rs` is written against it rather than against the
documents.

Four things running it settled, none of which reading could:

- **No severity exists, under either service.** The vuln object is exactly `id`,
  `fix_versions`, `aliases`, `description`; pip-audit's service model has no severity
  field at all. PRD P1-1's "severity-sorted" and SECURITY §6's "(CVE/GHSA id,
  severity, fixed-in)" were both written against a field that has never existed. The
  next commit corrects them; `sort_advisories` orders by package, then by whether
  anything *fixes* it, then by id — the one distinction that changes what a user can
  do. Deriving a severity from the id's year or the prose would be a number PipDock
  invented, shown beside real ones.
- **The ids are `PYSEC-*`, so the default service is PyPI**, and the CVE is an alias.
  Leaving that default is what keeps `legal/PRIVACY-POLICY.md` §3's "exactly one
  destination" true — and it costs nothing: the same environment under
  `--vulnerability-service osv` returns the *same eight advisories*, set difference
  empty in both directions.
- **Ids repeat**, so dedup is load-bearing rather than tidy. Ten rows for eight
  advisories under PyPI; sixteen for the same eight under OSV. Keyed on `(pkg, id)`,
  because one advisory can legitimately apply to two installed packages.
- **stderr carries a `pip-compile` advisory on every run**, so stdout is parsed first
  and failure classified only if that fails — SP-1's rule for uv, which writes its
  plan to stderr for the same reason.

`advisory_url` builds the OSV link from a **validated** id rather than taking a URL
out of the tool's JSON. That is the difference between this and `PdHealthReport`'s
`finding.url`, which `capabilities/external-links.json` calls out as the only URL in
the application derived from a third party's output: a whitelist of ASCII alphanumerics
and `-` cannot produce a `/`, `?`, `#`, `:` or `%`, so nothing that passes can be
anything but a path segment under one host. Ten hostile ids are asserted to get no
link at all.

No wire registration yet — the types derive `JsonSchema` but stay out of
`SCHEMA_TYPES` until a command returns one, exactly as P2 held `ToolsManifest` back
until P3 had a use for it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 10:55:11 +07:00

39 lines
1.9 KiB
Plaintext

# NOTE: later rules win, so the general default comes first and the overrides follow.
# Repository default: normalise to LF in the blob, check out per platform.
* text=auto
# Windows-only scripts keep CRLF on checkout.
*.ps1 text eol=crlf
*.bat text eol=crlf
*.cmd text eol=crlf
# Shell scripts must keep LF even on Windows or they will not run.
*.sh text eol=lf
# Engine-output fixtures must be preserved byte-for-byte.
#
# pip and uv emit CRLF on Windows. Normalising those to LF in the blob would test the adapter
# parsers against line endings that never occur in production — a parser mishandling a trailing
# \r would pass CI and fail on every real Windows machine. docs/TESTING.md §1 makes adapter
# parsing the thing that must never regress, so: no normalisation.
#
# `-text` is what buys that. `-diff` does NOT: it only suppresses the textual diff, and it used
# to be set here too, which meant the weekly drift job — whose entire job is to show you which
# engine bytes moved — could report nothing but "Binary files differ". Byte-exactness and a
# readable diff are not in tension, so keep the first and drop the second.
crates/pipdock-core/tests/fixtures/**/*.txt -text
# The JSON sidecars are ours, not the engines'. They are ordinary text and must stay diffable:
# meta.json is the contract the drift job gates on, so its diff has to be legible.
crates/pipdock-core/tests/fixtures/**/*.json text eol=crlf
# ...except under health/, where the JSON *is* the tool's output rather than a sidecar of ours.
# deptry and ruff write it, so it gets the same byte-for-byte treatment the engine .txt captures
# get — the rule above would have rewritten a captured document's line endings and quietly made it
# something no tool ever emitted. Later rules win, which is what lets this sit as an exception.
crates/pipdock-core/tests/fixtures/health/** -text
# pip-audit captures are a tool's own output, like health/ above.
crates/pipdock-core/tests/fixtures/audit/** -text