Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a14b533
fix(engine): harden plugin isolation, command effects, and credential…
giswqs Nov 25, 2026
6964f07
Address review feedback
giswqs Nov 25, 2026
33e2658
Address CodeRabbit review feedback
giswqs Nov 25, 2026
1f03e62
Address Claude review feedback
giswqs Nov 25, 2026
e942b9d
Address CodeRabbit review feedback
giswqs Nov 25, 2026
593a754
Address Claude review feedback
giswqs Nov 25, 2026
0bf20e0
Address Claude review feedback
giswqs Nov 25, 2026
9fa4239
Merge origin/main into fix/harden-plugin-and-policy
giswqs Nov 28, 2026
acf81bd
Read a GRIB record's rows anonymously when asked; wrap addresses once
giswqs Nov 28, 2026
79e4e11
Merge remote-tracking branch 'origin/main' into pr-2932
giswqs Nov 28, 2026
7b11f4a
Format service_logins::fetch_url
giswqs Nov 28, 2026
e6b3f99
Read a queued COG window anonymously when asked
giswqs Nov 29, 2026
f5263dc
Keep local files unwrapped; read STAC bands and AlphaEarth anonymously
giswqs Nov 29, 2026
40f2419
Scrub log parameters only as far as they are kept; say coinciding keys
giswqs Nov 29, 2026
ae09b39
Merge remote-tracking branch 'origin/main' into pr-2932
giswqs Nov 29, 2026
a020e49
Keep a long login whole when a log parameter is cut before scrubbing
giswqs Nov 29, 2026
d6c1d28
Mirror a layer's anonymous flag onto its raster before a reopen reads it
giswqs Nov 29, 2026
619677b
Merge remote-tracking branch 'origin/main' into pr-2932
giswqs Nov 29, 2026
80e21a0
Resolve an anonymous static catalog's links against its plain address
giswqs Nov 29, 2026
a236360
Resolve anonymous STAC collections, searches and items at plain addre…
giswqs Nov 29, 2026
4640c3b
Merge remote-tracking branch 'origin/main' into pr-2932
giswqs Nov 29, 2026
5e581a4
Repair a time-following layer as it reads; scrub only what an error k…
giswqs Nov 29, 2026
2170f7c
Merge remote-tracking branch 'origin/main' into pr-2932
giswqs Nov 29, 2026
a12b1e4
Run every add command asked to read anonymously as an anonymous scope
giswqs Nov 30, 2026
e81c5d8
Merge remote-tracking branch 'origin/main' into pr-2932
giswqs Nov 30, 2026
850b519
Declare map.addTiles's anonymous parameter
giswqs Nov 30, 2026
2a6600c
Merge remote-tracking branch 'origin/main' into pr-2932
giswqs Nov 30, 2026
e77f7eb
Say log fields left out for alike names; state earthdata.status's limit
giswqs Nov 30, 2026
e60a4a2
Merge remote-tracking branch 'origin/main' into pr-2932
giswqs Nov 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 96 additions & 13 deletions crates/assistant/src/audit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,14 @@ fn normalized_args(tool: &str, arguments: &Value) -> Value {

/// A string argument without its secrets: an address (one word with a scheme, or a database
/// connection string) loses its password, keys and tokens; `password=…` in a keyword connection
/// string is withheld. Other text is kept as it is, not cut at a `?` or `#`.
/// string is withheld; active web logins and `rustgis-s3:` capability wrappers are scrubbed. Other
/// text is kept as it is, not cut at a `?` or `#`.
fn redact_string(s: &str) -> String {
let s = rustgis_engine::render::rustgis_tiles::logins::scrub(&rustgis_engine::sources::scrub_s3_wrappers(s));
redact_string_inner(&s)
}

fn redact_string_inner(s: &str) -> String {
let t = s.trim();
let lower = t.to_ascii_lowercase();
// A password given as `password=…` or `password: …` (a keyword connection string, quoted or
Expand Down Expand Up @@ -259,20 +265,39 @@ fn redact_script(script: &str) -> String {
/// secret, the passwords, keys and tokens in addresses ([`rustgis_engine::sources::redact`]),
/// and the same inside a script's lines.
fn redact(v: Value, depth: usize) -> Value {
let redact_bounded = |s: &str| {
if s.len() > MAX_ARGS {
// Scrub wrappers and active logins before clipping so a secret crossing MAX_ARGS
// cannot leave a recognizable prefix behind.
let scrubbed = rustgis_engine::render::rustgis_tiles::logins::scrub(&rustgis_engine::sources::scrub_s3_wrappers(s));
Comment thread
giswqs marked this conversation as resolved.
Resolved
redact_string_inner(&crate::tools::clip(&scrubbed, MAX_ARGS))
} else {
redact_string(s)
}
};
match v {
// A long value (inline GeoJSON) is cut before it's searched, not after.
Value::String(s) if s.len() > MAX_ARGS => Value::String(redact_string(&crate::tools::clip(&s, MAX_ARGS))),
Value::String(s) => Value::String(redact_string(&s)),
Value::String(s) => Value::String(redact_bounded(&s)),
Value::Array(a) if depth < 16 => Value::Array(a.into_iter().map(|x| redact(x, depth + 1)).collect()),
Value::Object(o) if depth < 16 => Value::Object(
o.into_iter()
.map(|(k, x)| match (rustgis_engine::data::address::log_sensitive(&k), k.as_str(), x) {
(true, _, _) => (k, json!("[redacted]")),
(false, "script", Value::String(s)) => (k, json!(redact_script(&s))),
(false, _, x) => (k, redact(x, depth + 1)),
})
.collect(),
),
Value::Object(o) if depth < 16 => {
// Two field names alike once redacted: the object is replaced by a marker as a whole,
// rather than one value silently overwriting the other.
let mut out = serde_json::Map::new();
for (k, x) in o {
let sensitive = rustgis_engine::data::address::log_sensitive(&k);
let is_script = k.as_str() == "script";
let safe_k = redact_bounded(&k);
let value = match (sensitive, is_script, x) {
(true, _, _) => json!("[redacted]"),
(false, true, Value::String(s)) => json!(redact_script(&s)),
(false, _, x) => redact(x, depth + 1),
};
if out.contains_key(&safe_k) {
return json!("[redacted field names coincide]");
}
out.insert(safe_k, value);
}
Value::Object(out)
}
Value::Array(_) | Value::Object(_) => json!("[too deep]"),
other => other,
}
Expand Down Expand Up @@ -508,4 +533,62 @@ mod tests {
assert!(output.starts_with("# [1 further script line(s) not recorded]\n"));
assert!(!output.contains("RGSYNTH_omitted_line"));
}

/// Active web-service logins and `rustgis-s3:` capability wrappers are scrubbed from both
/// string arguments and tool error replies in the MCP audit log.
#[test]
fn audit_scrubs_active_logins_and_s3_wrappers() {
let mut s = rustgis_engine::Session::new(rustgis_engine::Project::default());
s.database_logins.set_store(None);
let conn = s
.run(
"connection.new",
&json!({"kind": "wms", "address": "https://audit-active.example.org/wms", "auth": "header", "keyName": "X-Key"}),
)
.unwrap();
let active_secret = "RGSYNTH_active_audit_login_9921";
s.run("connection.login", &json!({"id": conn["id"], "apiKey": active_secret})).unwrap();

let wrapped = "rustgis-s3:0123456789abcdef:22:https://s3.example.org:https://s3.example.org/b/k?token=RGSYNTH_s3_tok_9921";
let scrubbed_login = redact_string(&format!("upstream rejected {active_secret}"));
assert!(!scrubbed_login.contains(active_secret), "{scrubbed_login}");
let scrubbed_s3 = redact_string(&format!("could not read {wrapped}"));
assert!(!scrubbed_s3.contains("rustgis-s3:") && !scrubbed_s3.contains("RGSYNTH_s3_tok_9921"), "{scrubbed_s3}");

// Two field names alike once the login is taken out: a marker, not one value dropped.
let placeholder = redact_string(active_secret);
let alike = json!({format!("k-{active_secret}"): 1, format!("k-{placeholder}"): 2});
assert_eq!(redact(alike, 0), json!("[redacted field names coincide]"));

let call = json!({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "list_layers", "arguments": {}}});
let err = json!({
"jsonrpc": "2.0",
"id": 1,
"result": {
"isError": true,
"content": [{"type": "text", "text": format!("failed on {wrapped} with {active_secret}")}]
}
});
let lines = entries("mcp", &call.to_string(), Some(&err.to_string()), Duration::ZERO, 0);
let error_text = lines[0]["error"].as_str().unwrap_or("");
assert!(!error_text.contains(active_secret), "{error_text}");
assert!(!error_text.contains("rustgis-s3:"), "{error_text}");
assert!(!error_text.contains("RGSYNTH_s3_tok_9921"), "{error_text}");

// Object keys and strings spanning MAX_ARGS also scrub active logins and wrappers.
let prefix = "x".repeat(MAX_ARGS - 8);
let spanning = format!("{prefix}{active_secret}tail");
let redacted = redact(
json!({
format!("key-{active_secret}-{wrapped}"): "val",
"long": spanning,
}),
0,
)
.to_string();
assert!(!redacted.contains(active_secret), "redacted leaked active login: {redacted}");
assert!(!redacted.contains(&active_secret[..8]), "redacted leaked active login prefix: {redacted}");
assert!(!redacted.contains("rustgis-s3:"), "redacted leaked s3 wrapper in key: {redacted}");
assert!(!redacted.contains("RGSYNTH_s3_tok_9921"), "redacted leaked wrapped token in key: {redacted}");
}
}
32 changes: 16 additions & 16 deletions crates/engine/command-surface.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cache.cancel
cache.empty
cache.emptyIndexes
cache.fill
catalog.search url query? bbox? start? bboxCrs? text? connection?
catalog.search url query? bbox? start? bboxCrs? text? connection? anonymous?
connection.browse id node? probe? answer? documents?
connection.cancelToken id
connection.duplicate id name?
Expand All @@ -52,8 +52,8 @@ copernicus.logout
copernicus.status
cube.catalog theme? bbox? query?
cube.open id bbox? start? end? maxCloud? range? name?
cube.reduce cube? layers? layer? path? url? collection variable? index? crs? asset? assets? mask? bbox? maxCloud? cellSize? resampling? band? dates? stat order? above? classes? by? start? end? months? minValid? name?
cube.trend cube? layers? layer? collection url? asset? mask? bbox? maxCloud? cellSize? resampling? band? dates? start? end? months? test? seasons? alpha? minValid? per? name? ran?
cube.reduce cube? layers? layer? path? url? collection variable? index? crs? asset? assets? mask? bbox? maxCloud? cellSize? resampling? band? dates? stat order? above? classes? by? start? end? months? minValid? name? anonymous?
cube.trend cube? layers? layer? collection url? asset? mask? bbox? maxCloud? cellSize? resampling? band? dates? start? end? months? test? seasons? alpha? minValid? per? name? ran? anonymous?
data.archive layer? on?
data.archiveHistory layer?
data.archiveRestore layer? time
Expand All @@ -72,8 +72,8 @@ dl.import path? data?
dl.package model? path
dl.remove model
dl.train layer training classField bands? hidden? epochs? model?
earthdata.collections keyword? shortName? cloudHosted? limit? page? answer?
earthdata.granules collection? shortName? bbox? view? start? end? limit? page? footprints? name? answer?
earthdata.collections keyword? shortName? cloudHosted? limit? page? answer? anonymous?
earthdata.granules collection? shortName? bbox? view? start? end? limit? page? footprints? name? answer? anonymous?
earthdata.login token remember?
earthdata.logout
earthdata.status
Expand Down Expand Up @@ -224,7 +224,7 @@ layer.addPhotos paths? folder? name?
layer.addSample name
layer.addSql sql name? database? password? crs? stream? ran?
layer.addUrl url bytes? format? name? layer? zoom? x? y? wkt? crs? delimiter? paperSpace? blocks? stream? as? whole? cog? bbox? cellSize? cube? start? end? unit? interval? dates? connection? service? bounds? from? fromDocument? anonymous? coverage? coverageCrs? request?
layer.addZarr path url variable? index? cells? bbox? crs? name? time? start? end? ran? summary?
layer.addZarr path url variable? index? cells? bbox? crs? name? time? start? end? ran? summary? anonymous?
layer.aggregation layer? shape size?
layer.blend layer? mode
layer.classStyle layer? value? index? other? color? outline? label?
Expand Down Expand Up @@ -309,7 +309,7 @@ layout.seriesRefresh layout?
layout.update layout? element x? y? w? h? name? visible? locked? text? size? color? bold? italic? align? letterSpacing? rotation? wrap? valign? lineSpacing? case? font? fallback? title? subtitle? allClasses? hideOther? showNoData? exclude? layerOrder? labels? classLabels? columns? textSize? showLayerNames? sizes? showCounts? orientation? ticks? tickSide? reverse? style? fill? outline? radius? width? dash? dir? head? angle? length? units? divisions? subdivisions? divisionsBeforeZero? labelPosition? unitLabel? unitLabelPosition? fit? map? scale? center? bearing? pitch? grid? extentIndicator? border? section? layer? field? label? group? statistic? order? bars? other? stack? values? decimals? barColor? classes? labelAlign? mirror? max? band? side? gap? thickness? unit? lineColor? lineWidth? min? guides? barOutline? hideLabels? rows? image? path? background?
locator.find locator? text limit? zoom?
map.activate name
map.addTiles url kind? name? bounds? attribution? minZoom? maxZoom? tileSize? singleImage? tms? subdomains? layers? styleLayers? opacity? blend? resampling? overlay? top? replace? id? view? start? end? unit? interval? dates? legend? connection?
map.addTiles url kind? name? bounds? attribution? minZoom? maxZoom? tileSize? singleImage? tms? subdomains? layers? styleLayers? opacity? blend? resampling? overlay? top? replace? id? view? start? end? unit? interval? dates? legend? connection? anonymous?
map.basemap name keepTiles? color?
map.bodies
map.body name? basemap?
Expand Down Expand Up @@ -489,7 +489,7 @@ raster.setDefaultStyle fromLayer? layer? ramp? invert? stretch? low? high? n? re
raster.spectral layer lon? lat? points? zone?
raster.stretch layer? type low? high? n? min? max? like?
raster.symbology layer? type band? ramp? invert? classes? method? azimuth? altitude? zFactor? shadow? sky? fill? ambient? balanced? shadowSoftness? aerial? terrain? flats? rock? grey?
raster.zarrInfo path url bbox? variable?
raster.zarrInfo path url bbox? variable? anonymous?
report.activate report
report.attachments report? field
report.autofill report?
Expand Down Expand Up @@ -527,12 +527,12 @@ select.layerFromSelection layer?
select.rows layer? rows mode?
select.switch layer?
select.zoomTo
service.add url type? layer name? time? text? documents? source_url? describe? tiles? bbox? full where? connection?
service.add url type? layer name? time? text? documents? source_url? describe? tiles? bbox? full where? connection? anonymous?
service.coverage url type? layer text? documents? source_url? describe? bbox? connection? anonymous?
service.group group? layer? name? expanded? visible? remove?
service.groupPlan url? type? name? group? layer? sourceOnly? text? documents? connection? anonymous?
service.import url type? name? text? documents? responses? connection? anonymous?
service.layers url type? text? documents? connection? filter?
service.layers url type? text? documents? connection? filter? anonymous?
service.refresh group? layer? text? documents? responses? connection? anonymous?
share.dataStore name? path? remove?
share.export3d layer? path heightField? height? zScale?
Expand Down Expand Up @@ -564,14 +564,14 @@ sources.remove list kind address
sources.save kind address name? extra?
sql.query sql database? password? limit?
sql.schema database password?
stac.addAsset item url asset? name? connection?
stac.addAsset item url asset? name? connection? anonymous?
stac.addBands item combination? red? green? blue? bbox? cellSize? name? ran?
stac.addCube url? collection asset bbox? start end maxCloud? range? name? attribution? connection?
stac.addCube url? collection asset bbox? start end maxCloud? range? name? attribution? connection? anonymous?
stac.addFootprints footprints name?
stac.addIndex item index bbox? cellSize? name? ran?
stac.area path? layer? buffer? unit?
stac.collections url? connection?
stac.search url? collections? bbox? intersects? layer? buffer? unit? datetime? limit? maxCloud? sortby? phase? properties? footprints? connection?
stac.collections url? connection? anonymous?
stac.search url? collections? bbox? intersects? layer? buffer? unit? datetime? limit? maxCloud? sortby? phase? properties? footprints? connection? anonymous?
style.add path? text? data?
style.apply layer? name
style.import path? text? data?
Expand Down Expand Up @@ -604,5 +604,5 @@ tool.set tool
topology.rules add? remove? clear?
topology.validate toleranceM?
view.linkViews on?
zarr.reduce layer? path url variable? index? stat above? start? end? months? minValid? name? crs?
zarr.series lon lat layer? path url variable? index? start? end? crs?
zarr.reduce layer? path url variable? index? stat above? start? end? months? minValid? name? crs? anonymous?
zarr.series lon lat layer? path url variable? index? start? end? crs? anonymous?
Loading
Loading