1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! Platform probe abstraction.
//!
//! `agentsec-core` is designed to support multiple Agent platforms
//! (Claude Code, Cursor, Codex, Gemini CLI, Copilot, ...). Each platform
//! has its own config layout (target paths, dotfile decomposition rules,
//! MCP server config schema), and the scan / registry pipeline must be
//! able to enumerate them without baking platform-specific paths into
//! the pipeline code.
//!
//! [`PlatformProbe`] is the single trait every platform implements. The
//! scan / registry / unknown modules consume `&dyn PlatformProbe` so
//! that adding a new platform is a matter of writing a new probe impl
//! (typically in a sibling crate, e.g. `agentsec-platform-claude`).
//!
//! ## Phase 2 status
//!
//! `agentsec-core` now ships **no platform implementations**. The
//! Claude Code probe lives in the sibling crate
//! `agentsec-platform-claude`; binaries are responsible for
//! instantiating and registering probes before invoking
//! [`crate::scan::run`] / [`crate::scan::unknown::classify`], which
//! take `&[&dyn PlatformProbe]` slices.
use cratePaths;
use crateResult;
use ;
/// One MCP server entry extracted from a platform-specific config file.
///
/// Returned by [`PlatformProbe::extract_mcp_servers`]. Carries the
/// server name (the key under `mcpServers.<name>` in Claude Code's
/// case) plus a display-path describing where it was found, so that
/// downstream reporting can cite the exact source.
/// One virtual sub-entry produced by [`PlatformProbe::decompose_file`].
///
/// Used to split a single config file (e.g. `~/.claude.json`) into
/// security-relevant JSON blocks so that unrelated background writes
/// (session counters, timestamps, cache) do not show as Modified noise
/// in scan diffs. Each entry contributes one [`crate::scan::inventory::PathEntry`]
/// keyed by `<file>#<fragment>` and hashed over `payload`.
/// One platform's probe. Implementations are typically owned by a
/// sibling crate (e.g. `agentsec-platform-claude::ClaudeCodePlatform`)
/// and registered with the `agentsec` binary at startup.
///
/// All methods are read-only. Implementations must not mutate any
/// path under the user's home or project tree — the scan pipeline
/// relies on this invariant to remain safe to run repeatedly.