From a3396bfc689e7af2605690c92e95dfb704978fa7 Mon Sep 17 00:00:00 2001
From: retoor
Date: Sat, 24 Oct 2026 05:43:13 +0200
Subject: [PATCH] feat(clients): sessions+registry+optimize+armor: close gaps,
loud list truncation, shared Gemini adapter
sessions: operations get/list/cancel/delete/wait for engine, session, memory and
serving profile; servingProfiles CRUD. registry: ListResult with truncated flag,
v1alpha twins, gateway/policy operations, authz IAM, deny policy update, boundary
patch/bindings. optimize: make_gemini_model over models::VertexModel (DirectModel
removed), generateSyntheticData, online evaluator operations, trace/log writers.
armor: SecurityAdmin for all SCC v2 methods (attack exposure excluded), documented
agent threat categories, floor settings fixed to location global after live run.
check_discovery.py of all four enforce coverage.
Co-Authored-By: Claude Sonnet 5.5
---
example/app/agent/ArmorDemo.cpp | 138 ++++++
example/app/agent/OptimizeDemo.cpp | 117 ++++-
example/app/agent/RegistryDemo.cpp | 133 +++++-
example/app/agent/SessionsDemo.cpp | 142 ++++++
example/assets/agent_armor.js | 10 +-
example/assets/agent_optimize.js | 9 +
example/assets/agent_registry.js | 18 +-
src/google/armor/SPEC.md | 103 +++-
src/google/armor/agent_categories.cpp | 105 +++++
src/google/armor/agent_categories.h | 39 ++
src/google/armor/calls.h | 186 ++++++--
src/google/armor/caps.h | 2 +-
src/google/armor/findings.cpp | 13 +-
src/google/armor/model_armor.cpp | 12 +-
src/google/armor/scc_name.cpp | 57 +++
src/google/armor/scc_name.h | 47 ++
src/google/armor/security_admin.cpp | 439 ++++++++++++++++++
src/google/armor/security_admin.h | 131 ++++++
src/google/armor/tools/check_discovery.py | 30 +-
src/google/optimize/SPEC.md | 66 ++-
src/google/optimize/calls.h | 11 +
src/google/optimize/calls_table.inc | 24 +
src/google/optimize/caps.h | 5 +
src/google/optimize/direct_model.cpp | 47 --
src/google/optimize/direct_model.h | 38 --
src/google/optimize/evaluation_api.cpp | 9 +
src/google/optimize/evaluation_api.h | 3 +
src/google/optimize/model_factory.cpp | 25 +
src/google/optimize/model_factory.h | 26 ++
src/google/optimize/operations_api.cpp | 95 ++++
src/google/optimize/operations_api.h | 42 ++
src/google/optimize/optimize_service.cpp | 12 +-
src/google/optimize/optimize_service.h | 9 +-
src/google/optimize/telemetry_writer.cpp | 100 ++++
src/google/optimize/telemetry_writer.h | 53 +++
src/google/optimize/tools/check_discovery.py | 21 +
src/google/registry/SPEC.md | 49 +-
src/google/registry/agent_gateway.cpp | 20 +-
src/google/registry/agent_gateway.h | 9 +-
src/google/registry/agent_identity.cpp | 56 ++-
src/google/registry/agent_identity.h | 22 +-
src/google/registry/agent_registry.cpp | 83 ++--
src/google/registry/agent_registry.h | 37 +-
src/google/registry/call_runner.cpp | 64 ++-
src/google/registry/call_runner.h | 45 +-
src/google/registry/calls.cpp | 42 ++
src/google/registry/gateway_policy.cpp | 44 +-
src/google/registry/gateway_policy.h | 14 +-
src/google/registry/tools/check_discovery.py | 32 +-
src/google/sessions/SPEC.md | 77 ++-
src/google/sessions/calls.h | 37 +-
src/google/sessions/caps.h | 3 +
src/google/sessions/engine_service.cpp | 66 +--
src/google/sessions/engine_service.h | 32 +-
src/google/sessions/memory_bank.cpp | 5 +
src/google/sessions/memory_bank.h | 4 +
src/google/sessions/names.cpp | 37 ++
src/google/sessions/names.h | 19 +
src/google/sessions/operation_names.cpp | 92 ++++
src/google/sessions/operation_names.h | 44 ++
src/google/sessions/operation_service.cpp | 123 +++++
src/google/sessions/operation_service.h | 72 +++
src/google/sessions/serving_profile.cpp | 165 +++++++
src/google/sessions/serving_profile.h | 82 ++++
src/google/sessions/sessions.cpp | 5 +
src/google/sessions/sessions.h | 4 +
src/google/sessions/tools/check_discovery.py | 48 +-
tests/example/agent/armor/scc_test.cpp | 96 ++++
tests/example/agent/optimize/gaps_test.cpp | 71 +++
tests/example/agent/registry/iam_test.cpp | 27 ++
tests/example/agent/registry/list_test.cpp | 12 +
.../agent/registry/operations_test.cpp | 39 ++
tests/example/agent/registry/page_test.cpp | 3 +
tests/example/agent/registry/status_test.cpp | 1 +
tests/example/agent/sessions/calls_test.cpp | 44 ++
tests/example/agent/sessions/page_test.cpp | 3 +
tests/src/google/armor/test_armor.cpp | 49 +-
tests/src/google/armor/test_armor_gaps.cpp | 330 +++++++++++++
tests/src/google/optimize/test_gaps.cpp | 284 +++++++++++
tests/src/google/optimize/test_live.cpp | 4 +-
.../google/registry/test_registry_gaps.cpp | 299 ++++++++++++
.../google/registry/test_registry_live.cpp | 34 +-
.../google/sessions/test_sessions_gaps.cpp | 353 ++++++++++++++
83 files changed, 5020 insertions(+), 378 deletions(-)
create mode 100644 src/google/armor/agent_categories.cpp
create mode 100644 src/google/armor/agent_categories.h
create mode 100644 src/google/armor/scc_name.cpp
create mode 100644 src/google/armor/scc_name.h
create mode 100644 src/google/armor/security_admin.cpp
create mode 100644 src/google/armor/security_admin.h
delete mode 100644 src/google/optimize/direct_model.cpp
delete mode 100644 src/google/optimize/direct_model.h
create mode 100644 src/google/optimize/model_factory.cpp
create mode 100644 src/google/optimize/model_factory.h
create mode 100644 src/google/optimize/operations_api.cpp
create mode 100644 src/google/optimize/operations_api.h
create mode 100644 src/google/optimize/telemetry_writer.cpp
create mode 100644 src/google/optimize/telemetry_writer.h
create mode 100644 src/google/sessions/operation_names.cpp
create mode 100644 src/google/sessions/operation_names.h
create mode 100644 src/google/sessions/operation_service.cpp
create mode 100644 src/google/sessions/operation_service.h
create mode 100644 src/google/sessions/serving_profile.cpp
create mode 100644 src/google/sessions/serving_profile.h
create mode 100644 tests/example/agent/armor/scc_test.cpp
create mode 100644 tests/example/agent/optimize/gaps_test.cpp
create mode 100644 tests/example/agent/registry/iam_test.cpp
create mode 100644 tests/example/agent/registry/operations_test.cpp
create mode 100644 tests/src/google/armor/test_armor_gaps.cpp
create mode 100644 tests/src/google/optimize/test_gaps.cpp
create mode 100644 tests/src/google/registry/test_registry_gaps.cpp
create mode 100644 tests/src/google/sessions/test_sessions_gaps.cpp
diff --git a/example/app/agent/ArmorDemo.cpp b/example/app/agent/ArmorDemo.cpp
index 8069447..da39820 100644
--- a/example/app/agent/ArmorDemo.cpp
+++ b/example/app/agent/ArmorDemo.cpp
@@ -9,12 +9,14 @@
#include "../../fw/Templates.hpp"
#include "../../fw/Validate.hpp"
#include "clients/body/json.h"
+#include "google/armor/agent_categories.h"
#include "google/armor/armor_util.h"
#include "google/armor/caps.h"
#include "google/armor/dashboard.h"
#include "google/armor/findings.h"
#include "google/armor/guarded_model.h"
#include "google/armor/model_armor.h"
+#include "google/armor/security_admin.h"
#include "google/credentials.h"
#include "google/endpoints.h"
@@ -157,6 +159,8 @@ OAuth access token, not an API key.
+
+
@@ -164,6 +168,12 @@ OAuth access token, not an API key.
+
+
@@ -354,6 +364,12 @@ void register_agent_armor_demo(fw::Router& router, Services& services) {
q.severity = field(in, "severity");
q.state = field(in, "state");
if (!field(in, "category").empty()) q.categories = {field(in, "category")};
+ // family selects the documented Agent Platform Threat Detection categories.
+ std::string family = field(in, "family");
+ if (family == "runtime") q.categories = armor::AgentCategories::strings(armor::AgentFamily::kRuntime);
+ else if (family == "control_plane") q.categories = armor::AgentCategories::strings(armor::AgentFamily::kControlPlane);
+ else if (family == "agent") q.categories = armor::AgentCategories::strings();
+ else if (!family.empty()) bad("family must be runtime, control_plane or agent");
q.order_by = field(in, "order_by");
q.page_size = int_field(in, "page_size", 0, armor::ArmorCaps::kMaxFindingsPageSize);
q.max_pages = static_cast(int_field(in, "max_pages", 1, armor::ArmorCaps::kMaxFindingPages));
@@ -378,6 +394,8 @@ void register_agent_armor_demo(fw::Router& router, Services& services) {
Json o = Json::object();
o.set("findings", items);
o.set("truncated", page.truncated);
+ o.set("count", static_cast(page.findings.size()));
+ o.set("cap_findings", static_cast(armor::ArmorCaps::kMaxFindings));
o.set("total_size", static_cast(page.total_size));
return json_out(o);
});
@@ -393,6 +411,126 @@ void register_agent_armor_demo(fw::Router& router, Services& services) {
return json_out(dash.summarize(q).to_json());
});
});
+
+ // ---- Documented Agent Threat Detection categories (no credential needed).
+ router.get("/agent/armor/categories", "agent-armor-categories", [](fw::Request req) {
+ (void)req;
+ Json arr = Json::array();
+ for (const armor::AgentCategory& c : armor::AgentCategories::all()) {
+ Json o = Json::object();
+ o.set("category", c.category);
+ o.set("alt", c.alt);
+ o.set("module", c.module);
+ o.set("family", c.family == armor::AgentFamily::kRuntime ? "runtime" : "control_plane");
+ arr.push(o);
+ }
+ Json o = Json::object();
+ o.set("count", static_cast(arr.as_array().size()));
+ o.set("anomaly_detection", "no documented category string; recognised by the agentAnomaly member");
+ o.set("categories", arr);
+ return json_out(o);
+ });
+
+ // ---- Security Command Center administration (SecurityAdmin).
+ auto kind_of = [](const Form& in) {
+ std::string k = field(in, "kind");
+ if (k == "muteConfigs") return armor::SccCollection::kMuteConfigs;
+ if (k == "notificationConfigs") return armor::SccCollection::kNotificationConfigs;
+ if (k == "bigQueryExports") return armor::SccCollection::kBigQueryExports;
+ bad("kind must be muteConfigs, notificationConfigs or bigQueryExports");
+ };
+
+ router.post("/agent/armor/scc/availability", "agent-armor-scc-availability", [client](fw::Request req) {
+ Form in = fw::parse_json_object_flat(req.body);
+ std::string scope = field(in, "scope");
+ if (scope.empty()) {
+ google::CloudContext ctx = google::CloudContext::from_env();
+ if (!ctx.project.empty()) scope = "projects/" + ctx.project;
+ }
+ return guarded([&] {
+ Json o = Json::object();
+ o.set("scope", scope);
+ o.set("state", armor::availability_name(armor::SecurityAdmin(client).availability(scope)));
+ return json_out(o);
+ });
+ });
+
+ router.post("/agent/armor/scc/configs/list", "agent-armor-scc-configs-list", [client, kind_of](fw::Request req) {
+ Form in = fw::parse_json_object_flat(req.body);
+ armor::SccCollection kind = kind_of(in);
+ std::string parent = field(in, "parent");
+ return guarded([&] { return json_out(armor::SecurityAdmin(client).list_configs(kind, parent).to_json()); });
+ });
+
+ router.post("/agent/armor/scc/configs/get", "agent-armor-scc-configs-get", [client, kind_of](fw::Request req) {
+ Form in = fw::parse_json_object_flat(req.body);
+ armor::SccCollection kind = kind_of(in);
+ std::string name = field(in, "name");
+ return guarded([&] { return json_out(armor::SecurityAdmin(client).get_config(kind, name)); });
+ });
+
+ // Destructive and explicit: one config, DELETE only.
+ router.del("/agent/armor/scc/configs", "agent-armor-scc-configs-delete", [client](fw::Request req) {
+ Form in = {{"kind", req.query_or("kind", "")}};
+ armor::SccCollection kind;
+ if (in["kind"] == "muteConfigs") kind = armor::SccCollection::kMuteConfigs;
+ else if (in["kind"] == "notificationConfigs") kind = armor::SccCollection::kNotificationConfigs;
+ else if (in["kind"] == "bigQueryExports") kind = armor::SccCollection::kBigQueryExports;
+ else bad("kind must be muteConfigs, notificationConfigs or bigQueryExports");
+ std::string name = req.query_or("name", "");
+ return guarded([&] {
+ armor::SecurityAdmin(client).delete_config(kind, name);
+ Json o = Json::object();
+ o.set("deleted", true);
+ return json_out(o);
+ });
+ });
+
+ router.post("/agent/armor/scc/finding/state", "agent-armor-scc-finding-state", [client](fw::Request req) {
+ Form in = fw::parse_json_object_flat(req.body);
+ std::string state = field(in, "state");
+ if (state != "ACTIVE" && state != "INACTIVE") bad("state must be ACTIVE or INACTIVE");
+ std::string finding = field(in, "finding");
+ return guarded([&] {
+ return json_out(armor::SecurityAdmin(client).set_finding_state(
+ finding, state == "ACTIVE" ? armor::FindingState::kActive : armor::FindingState::kInactive));
+ });
+ });
+
+ router.post("/agent/armor/scc/finding/mute", "agent-armor-scc-finding-mute", [client](fw::Request req) {
+ Form in = fw::parse_json_object_flat(req.body);
+ std::string mute = field(in, "mute");
+ if (mute != "MUTED" && mute != "UNMUTED" && mute != "UNDEFINED") bad("mute must be MUTED, UNMUTED or UNDEFINED");
+ std::string finding = field(in, "finding");
+ return guarded([&] {
+ return json_out(armor::SecurityAdmin(client).set_finding_mute(
+ finding, mute == "MUTED" ? armor::MuteValue::kMuted
+ : mute == "UNMUTED" ? armor::MuteValue::kUnmuted : armor::MuteValue::kUndefined));
+ });
+ });
+
+ // Mass change: needs a filter and confirm=bulk-mute.
+ router.post("/agent/armor/scc/bulk-mute", "agent-armor-scc-bulk-mute", [client](fw::Request req) {
+ Form in = fw::parse_json_object_flat(req.body);
+ if (field(in, "confirm") != "bulk-mute") bad("confirm must be bulk-mute");
+ std::string value = field(in, "value");
+ if (value != "MUTED" && value != "UNDEFINED") bad("value must be MUTED or UNDEFINED");
+ std::string parent = field(in, "parent"), filter = field(in, "filter");
+ return guarded([&] {
+ google::Operation op = armor::SecurityAdmin(client).bulk_mute(
+ parent, filter, value == "MUTED" ? armor::BulkMuteValue::kMuted : armor::BulkMuteValue::kUndefined);
+ Json o = Json::object();
+ o.set("operation", op.name);
+ o.set("done", op.done);
+ return json_out(o);
+ });
+ });
+
+ router.post("/agent/armor/scc/operations/list", "agent-armor-scc-operations", [client](fw::Request req) {
+ Form in = fw::parse_json_object_flat(req.body);
+ std::string org = field(in, "organization");
+ return guarded([&] { return json_out(armor::SecurityAdmin(client).list_operations(org).to_json()); });
+ });
}
} // namespace molo::example::app
diff --git a/example/app/agent/OptimizeDemo.cpp b/example/app/agent/OptimizeDemo.cpp
index 8d56412..5e9ffec 100644
--- a/example/app/agent/OptimizeDemo.cpp
+++ b/example/app/agent/OptimizeDemo.cpp
@@ -8,11 +8,13 @@
#include "google/optimize/autorater.h"
#include "google/optimize/calls.h"
#include "google/optimize/clusterer.h"
-#include "google/optimize/direct_model.h"
+#include "google/optimize/model_factory.h"
#include "google/optimize/eval_requests.h"
#include "google/optimize/eval_resources.h"
#include "google/optimize/evaluation_api.h"
#include "google/optimize/observability.h"
+#include "google/optimize/operations_api.h"
+#include "google/optimize/telemetry_writer.h"
#include "google/optimize/optimizer.h"
#include "google/optimize/simulator.h"
@@ -131,7 +133,7 @@ void register_agent_optimize_demo(fw::Router& router, Services& services) {
services.add_feature("agent optimize", "/agent/optimize");
auto model_for = [gclient]() {
- return google::optimize::DirectModel::from_env(gclient);
+ return google::optimize::make_gemini_model(gclient);
};
router.get("/agent/optimize", "agent-optimize-page", [env](fw::Request req) {
@@ -287,6 +289,117 @@ void register_agent_optimize_demo(fw::Router& router, Services& services) {
});
});
+ // generateSyntheticData: `request` is the Discovery request object (or its
+ // JSON text); top-level fields are checked against the call table.
+ router.post("/agent/optimize/synthetic", "agent-optimize-synthetic", [gclient](fw::Request req) {
+ Json body = parse_body(req);
+ const Json* r = body.find("request");
+ Json request;
+ if (r && r->is_object()) request = *r;
+ else if (r && r->is_string()) {
+ try { request = Json::parse(r->as_string()); } catch (const clients::body::JsonError&) {}
+ }
+ if (!request.is_object() || request.as_object().empty())
+ throw fw::HttpError(422, "validation_error", "request must be a non-empty JSON object");
+ google::CloudContext ctx = require_context();
+ return guarded([&] { return json_out(opt::EvaluationApi(gclient, ctx).generate_synthetic_data(request)); });
+ });
+
+ // Operations of online evaluators (get, list, server-side wait, cancel;
+ // delete is a DELETE route and removes the operation record only).
+ auto op_json = [](const google::Operation& op) {
+ Json o = Json::object();
+ o.set("name", Json(op.name));
+ o.set("done", Json(op.done));
+ if (op.failed()) o.set("error_message", Json(op.error_message));
+ return o;
+ };
+ router.post("/agent/optimize/operations/list", "agent-optimize-ops-list", [gclient, op_json](fw::Request req) {
+ Json body = parse_body(req);
+ std::string evaluator = text_field(body, "evaluator", true, 512);
+ int limit = int_field(body, "limit", 20, 1, 100);
+ google::CloudContext ctx = require_context();
+ return guarded([&] {
+ opt::OperationPage page = opt::OnlineEvaluatorOperations(gclient, ctx).list(evaluator, "", limit);
+ Json arr = Json::array();
+ for (const google::Operation& op : page.operations) arr.push(op_json(op));
+ Json out = Json::object();
+ out.set("operations", arr);
+ out.set("count", Json(static_cast(page.operations.size())));
+ out.set("truncated", Json(page.truncated));
+ out.set("next_page_token", Json(page.next_page_token));
+ return json_out(out);
+ });
+ });
+ router.post("/agent/optimize/operations/get", "agent-optimize-ops-get", [gclient](fw::Request req) {
+ Json body = parse_body(req);
+ std::string name = text_field(body, "name", true, 512);
+ google::CloudContext ctx = require_context();
+ return guarded([&] { return json_out(opt::OnlineEvaluatorOperations(gclient, ctx).get(name)); });
+ });
+ router.post("/agent/optimize/operations/wait", "agent-optimize-ops-wait", [gclient, op_json](fw::Request req) {
+ Json body = parse_body(req);
+ std::string name = text_field(body, "name", true, 512);
+ int seconds = int_field(body, "timeout_seconds", 30, 1, opt::OptimizeCaps::kMaxServerWaitSeconds);
+ google::CloudContext ctx = require_context();
+ return guarded([&] {
+ return json_out(op_json(opt::OnlineEvaluatorOperations(gclient, ctx).wait_server(name, seconds)));
+ });
+ });
+ router.post("/agent/optimize/operations/cancel", "agent-optimize-ops-cancel", [gclient](fw::Request req) {
+ Json body = parse_body(req);
+ std::string name = text_field(body, "name", true, 512);
+ google::CloudContext ctx = require_context();
+ return guarded([&] {
+ opt::OnlineEvaluatorOperations(gclient, ctx).cancel(name);
+ Json out = Json::object();
+ out.set("cancel_requested", Json(true));
+ return json_out(out);
+ });
+ });
+ router.del("/agent/optimize/operations", "agent-optimize-ops-delete", [gclient](fw::Request req) {
+ std::string name = req.query_or("name", "");
+ if (name.empty() || !opt::OnlineEvaluatorOperations::is_operation_name(name))
+ throw fw::HttpError(422, "validation_error", "name must be an online evaluator operation name");
+ google::CloudContext ctx = require_context();
+ return guarded([&] {
+ opt::OnlineEvaluatorOperations(gclient, ctx).remove(name);
+ Json out = Json::object();
+ out.set("deleted", Json(true));
+ return json_out(out);
+ });
+ });
+
+ // entries:write. A dry run (nothing stored) unless confirm is "write".
+ router.post("/agent/optimize/logs/write", "agent-optimize-logs-write", [gclient](fw::Request req) {
+ Json body = parse_body(req);
+ std::string log_id = text_field(body, "log_id", true, 100);
+ std::string text = text_field(body, "text", true, 4000);
+ std::string confirm = text_field(body, "confirm", false, 16);
+ if (!google::valid_segment(log_id))
+ throw fw::HttpError(422, "validation_error", "log_id has invalid characters");
+ google::CloudContext ctx = require_context();
+ bool real = confirm == "write";
+ Json entry = Json::object();
+ entry.set("textPayload", Json(text));
+ Json entries = Json::array();
+ entries.push(entry);
+ Json resource = Json::object();
+ resource.set("type", Json("global"));
+ Json request = Json::object();
+ request.set("logName", Json("projects/" + ctx.project + "/logs/" + log_id));
+ request.set("resource", resource);
+ request.set("entries", entries);
+ request.set("dryRun", Json(!real));
+ return guarded([&] {
+ opt::LogWriter(gclient).write(request);
+ Json out = Json::object();
+ out.set("dry_run", Json(!real));
+ out.set("written", Json(real));
+ return json_out(out);
+ });
+ });
+
// Local autorater over a pasted transcript ("user: ..." / "agent: ...").
router.post("/agent/optimize/score", "agent-optimize-score", [model_for](fw::Request req) {
Json body = parse_body(req);
diff --git a/example/app/agent/RegistryDemo.cpp b/example/app/agent/RegistryDemo.cpp
index 0d35d25..669a120 100644
--- a/example/app/agent/RegistryDemo.cpp
+++ b/example/app/agent/RegistryDemo.cpp
@@ -53,6 +53,19 @@ fw::Response json_reply(const Json& j, int status = 200) {
return res;
}
+// A list answer. Truncation is part of the answer, never hidden: `truncated`
+// is true when more existed past the stated cap, `cap_items` names the cap.
+Json list_answer(const reg::ListResult& list, const char* items_key) {
+ Json j = Json::object();
+ j.set("count", Json(static_cast(list.size())));
+ j.set("pages", Json(static_cast(list.pages)));
+ j.set("truncated", Json(list.truncated));
+ j.set("next_page_token", Json(list.next_page_token));
+ j.set("cap_items", Json(static_cast(reg::RegistryCaps::kMaxItems)));
+ j.set(items_key, list.items);
+ return j;
+}
+
std::string field(std::map& in, const char* key) {
auto it = in.find(key);
return it == in.end() ? "" : it->second;
@@ -87,7 +100,9 @@ class RegistryDemo {
void require_credential() const {
if (!configured()) throw google::NotConfiguredError("registry");
}
- reg::AgentRegistry registry() const { return reg::AgentRegistry(client_, ready()); }
+ reg::AgentRegistry registry(reg::RegistryVersion v = reg::RegistryVersion::kV1) const {
+ return reg::AgentRegistry(client_, ready(), v);
+ }
reg::AgentGateway gateway() const { return reg::AgentGateway(client_, ready()); }
reg::GatewayPolicies policies() const { return reg::GatewayPolicies(client_, ready()); }
reg::AgentIdentity identity() const { return reg::AgentIdentity(client_, ready()); }
@@ -122,6 +137,11 @@ here is a local list: the registry API has no approve method.
+
@@ -133,10 +153,14 @@ here is a local list: the registry API has no approve method.
+
+
+
+
@@ -169,6 +193,7 @@ void register_agent_registry_demo(fw::Router& router, Services& services) {
Json caps = Json::object();
caps.set("page_size", Json(reg::RegistryCaps::kPageSize));
caps.set("max_pages", Json(static_cast
(reg::RegistryCaps::kMaxPages)));
+ caps.set("max_items", Json(static_cast(reg::RegistryCaps::kMaxItems)));
caps.set("max_ledger_entries", Json(static_cast(reg::RegistryCaps::kMaxLedgerEntries)));
caps.set("max_audit_entries", Json(static_cast(reg::RegistryCaps::kMaxAuditEntries)));
j.set("caps", caps);
@@ -259,15 +284,17 @@ void register_agent_registry_demo(fw::Router& router, Services& services) {
reg::AssetKind::kSkills, reg::AssetKind::kBindings,
reg::AssetKind::kPublishers});
bool approved_only = field(in, "approved_only") == "true";
+ std::string version = field(in, "version");
+ if (!version.empty() && version != "v1" && version != "v1alpha") bad("version must be v1 or v1alpha");
return guarded([&] {
- reg::AgentRegistry registry = demo->registry();
- Json items = approved_only ? registry.list_approved(kind, demo->ledger())
- : registry.list(kind);
- Json j = Json::object();
+ reg::AgentRegistry registry = demo->registry(version == "v1alpha" ? reg::RegistryVersion::kV1Alpha
+ : reg::RegistryVersion::kV1);
+ reg::ListResult list = approved_only ? registry.list_approved(kind, demo->ledger())
+ : registry.list(kind);
+ Json j = list_answer(list, "items");
j.set("kind", Json(reg::asset_collection(kind)));
+ j.set("version", Json(registry.version()));
j.set("approved_only", Json(approved_only));
- j.set("count", Json(static_cast(items.as_array().size())));
- j.set("items", items);
return json_reply(j);
});
});
@@ -377,11 +404,7 @@ void register_agent_registry_demo(fw::Router& router, Services& services) {
// ---- Gateways and policies (reads, plus an explicit delete).
router.post("/agent/registry/gateways/list", "agent-registry-gateways", [demo](fw::Request) {
return guarded([&] {
- Json items = demo->gateway().list();
- Json j = Json::object();
- j.set("count", Json(static_cast(items.as_array().size())));
- j.set("gateways", items);
- return json_reply(j);
+ return json_reply(list_answer(demo->gateway().list(), "gateways"));
});
});
@@ -400,14 +423,92 @@ void register_agent_registry_demo(fw::Router& router, Services& services) {
router.post("/agent/registry/policies/list", "agent-registry-policies", [demo](fw::Request) {
return guarded([&] {
- Json items = demo->policies().list();
- Json j = Json::object();
- j.set("count", Json(static_cast(items.as_array().size())));
- j.set("policies", items);
+ return json_reply(list_answer(demo->policies().list(), "policies"));
+ });
+ });
+
+ // ---- Operations of the three registry-side hosts. Reads are POST (they
+ // call out); delete is DELETE and explicit (the operation record only).
+ auto scope_of = [](std::map& in) {
+ std::string s = field(in, "scope");
+ if (s != "registry" && s != "gateways" && s != "policies")
+ bad("scope must be registry, gateways or policies");
+ return s;
+ };
+ router.post("/agent/registry/operations/list", "agent-registry-operations", [demo, scope_of](fw::Request req) {
+ auto in = fw::parse_json_object_flat(req.body);
+ std::string scope = scope_of(in);
+ return guarded([&] {
+ reg::ListResult ops = scope == "registry" ? demo->registry().operations()
+ : scope == "gateways" ? demo->gateway().operations()
+ : demo->policies().operations();
+ Json j = list_answer(ops, "operations");
+ j.set("scope", Json(scope));
return json_reply(j);
});
});
+ router.post("/agent/registry/operations/cancel", "agent-registry-operation-cancel",
+ [demo, scope_of](fw::Request req) {
+ auto in = fw::parse_json_object_flat(req.body);
+ std::string scope = scope_of(in);
+ std::string id = field(in, "id");
+ if (!google::valid_segment(id)) bad("id is empty or has invalid characters");
+ return guarded([&] {
+ Json r = scope == "registry" ? demo->registry().cancel_operation(id)
+ : scope == "gateways" ? demo->gateway().cancel_operation(id)
+ : demo->policies().cancel_operation(id);
+ Json j = Json::object();
+ j.set("scope", Json(scope));
+ j.set("cancel_requested", Json(true));
+ j.set("reply", r);
+ return json_reply(j);
+ });
+ });
+
+ router.del("/agent/registry/operations", "agent-registry-operation-delete", [demo](fw::Request req) {
+ std::string scope = req.query_or("scope", "");
+ std::string id = req.query_or("id", "");
+ if (scope != "registry" && scope != "gateways" && scope != "policies")
+ bad("scope must be registry, gateways or policies");
+ if (!google::valid_segment(id)) bad("id is empty or has invalid characters");
+ return guarded([&] {
+ Json r = scope == "registry" ? demo->registry().delete_operation(id)
+ : scope == "gateways" ? demo->gateway().delete_operation(id)
+ : demo->policies().delete_operation(id);
+ Json j = Json::object();
+ j.set("deleted", Json(true));
+ j.set("reply", r);
+ return json_reply(j);
+ });
+ });
+
+ // ---- IAM deny policies (iam v2) and boundary bindings (iam v3).
+ router.post("/agent/registry/deny-policies/list", "agent-registry-deny-policies", [demo](fw::Request req) {
+ auto in = fw::parse_json_object_flat(req.body);
+ std::string number = field(in, "project_number");
+ if (number.empty() || number.size() > 20 || number.find_first_not_of("0123456789") != std::string::npos)
+ bad("project_number must be numeric");
+ return guarded([&] {
+ return json_reply(list_answer(
+ demo->identity().deny_policies(reg::AgentIdentity::attachment_for_project(number)),
+ "policies"));
+ });
+ });
+
+ router.post("/agent/registry/boundaries/bindings", "agent-registry-boundary-bindings",
+ [demo](fw::Request req) {
+ auto in = fw::parse_json_object_flat(req.body);
+ std::string org = field(in, "org_id");
+ std::string id = field(in, "id");
+ if (org.empty() || org.size() > 20 || org.find_first_not_of("0123456789") != std::string::npos)
+ bad("org_id must be numeric");
+ if (!google::valid_segment(id)) bad("id is empty or has invalid characters");
+ return guarded([&] {
+ return json_reply(list_answer(demo->identity().boundary_bindings(org, id), "bindings"));
+ });
+ });
+
// ---- Identity of one deployed agent (engine id).
router.post("/agent/registry/identity", "agent-registry-identity", [demo](fw::Request req) {
auto in = fw::parse_json_object_flat(req.body);
diff --git a/example/app/agent/SessionsDemo.cpp b/example/app/agent/SessionsDemo.cpp
index bf81883..68773aa 100644
--- a/example/app/agent/SessionsDemo.cpp
+++ b/example/app/agent/SessionsDemo.cpp
@@ -9,6 +9,7 @@
#include "google/sessions/caps.h"
#include "google/sessions/calls.h"
#include "google/sessions/memory_bank.h"
+#include "google/sessions/serving_profile.h"
#include "google/sessions/sessions.h"
namespace molo::example::app {
@@ -52,6 +53,15 @@ Every call below is a JSON POST (or DELETE) and answers 503
| DELETE /agent/sessions/memories/memory | query: engine, id |
| POST /agent/sessions/memories/profiles | engine, scope_key, scope_value |
| POST /agent/sessions/memories/purge | engine, filter, force?, confirm? (dry run by default) |
+| POST /agent/sessions/operations/list | engine, parent? (engine, session or memory name), filter? |
+| POST /agent/sessions/operations/get | engine, name |
+| POST /agent/sessions/operations/wait | engine, name, timeout_seconds (server-side wait, 1..60) |
+| POST /agent/sessions/operations/cancel | engine, name |
+| DELETE /agent/sessions/operations/operation | query: engine, name |
+| POST /agent/sessions/serving-profiles/list | location? (id or projects/P/locations/L) |
+| POST /agent/sessions/serving-profiles/get | location?, profile_id |
+| POST /agent/sessions/serving-profiles/create | location?, profile_id, display_name, scope, description? |
+| DELETE /agent/sessions/serving-profiles/profile | query: location?, id |
@@ -106,6 +116,29 @@ class SessionsRoutes {
return gs::MemoryBank(client_, engine_of(engine));
}
+ // A full "projects/P/locations/L" name, or a location id (project from
+ // GOOGLE_CLOUD_PROJECT, empty: GOOGLE_CLOUD_LOCATION or us-central1).
+ gs::LocationName location_of(const std::string& value) const {
+ if (value.rfind("projects/", 0) == 0) return gs::LocationName(value);
+ google::CloudContext ctx = google::CloudContext::from_env();
+ if (!value.empty()) ctx.location = value;
+ return gs::LocationName(ctx.parent());
+ }
+ gs::ServingProfiles profiles(const std::string& location) const {
+ return gs::ServingProfiles(client_, location_of(location));
+ }
+
+ static GJson operation_json(const google::Operation& op) {
+ GJson o = GJson::object();
+ o.set("name", GJson(op.name));
+ o.set("done", GJson(op.done));
+ if (op.failed()) {
+ o.set("error_code", GJson(op.error_code));
+ o.set("error_message", GJson(op.error_message));
+ }
+ return o;
+ }
+
static gs::StringMap scope_of(const Flat& in) {
gs::StringMap scope;
if (!field(in, "scope_key").empty() || !field(in, "scope_value").empty())
@@ -147,6 +180,8 @@ void register_agent_sessions_demo(fw::Router& router, Services& services) {
caps.set("max_session_id_chars", GJson(static_cast(gs::SessionsCaps::kMaxIdChars)));
caps.set("max_list_items", GJson(static_cast(gs::SessionsCaps::kMaxListItems)));
caps.set("max_top_k", GJson(gs::MemoryCaps::kMaxTopK));
+ caps.set("max_server_wait_seconds",
+ GJson(static_cast(gs::SessionsCaps::kMaxServerWaitSeconds)));
caps.set("max_fact_chars", GJson(static_cast(gs::MemoryCaps::kMaxFactChars)));
out.set("caps", caps);
return answer(out);
@@ -355,6 +390,113 @@ void register_agent_sessions_demo(fw::Router& router, Services& services) {
return answer(out);
});
});
+
+ // Operations (engine, session, memory) -----------------------------------
+
+ router.post("/agent/sessions/operations/list", "agent-sessions-operations-list",
+ [routes](fw::Request req) {
+ Flat in = fw::parse_json_object_flat(req.body);
+ return guarded([&] {
+ gs::OperationListOptions options;
+ options.filter = field(in, "filter");
+ GJson arr = GJson::array();
+ for (const google::Operation& op :
+ routes->sessions(field(in, "engine")).list_operations(field(in, "parent"), options))
+ arr.push(SessionsRoutes::operation_json(op));
+ GJson out = GJson::object();
+ out.set("operations", arr);
+ return answer(out);
+ });
+ });
+
+ router.post("/agent/sessions/operations/get", "agent-sessions-operations-get",
+ [routes](fw::Request req) {
+ Flat in = fw::parse_json_object_flat(req.body);
+ return guarded([&] {
+ return answer(routes->sessions(field(in, "engine")).operation(field(in, "name")));
+ });
+ });
+
+ // One server-side wait (POST :wait); done=false when the timeout passed first.
+ router.post("/agent/sessions/operations/wait", "agent-sessions-operations-wait",
+ [routes](fw::Request req) {
+ Flat in = fw::parse_json_object_flat(req.body);
+ return guarded([&] {
+ int seconds = field(in, "timeout_seconds").empty()
+ ? 30
+ : std::atoi(field(in, "timeout_seconds").c_str());
+ return answer(SessionsRoutes::operation_json(
+ routes->sessions(field(in, "engine")).wait_server(field(in, "name"), seconds)));
+ });
+ });
+
+ router.post("/agent/sessions/operations/cancel", "agent-sessions-operations-cancel",
+ [routes](fw::Request req) {
+ Flat in = fw::parse_json_object_flat(req.body);
+ return guarded([&] {
+ routes->sessions(field(in, "engine")).cancel_operation(field(in, "name"));
+ GJson out = GJson::object();
+ out.set("cancel_requested", GJson(true));
+ return answer(out);
+ });
+ });
+
+ router.del("/agent/sessions/operations/operation", "agent-sessions-operations-delete",
+ [routes](fw::Request req) {
+ return guarded([&] {
+ routes->sessions(req.query_or("engine", "")).delete_operation(req.query_or("name", ""));
+ GJson out = GJson::object();
+ out.set("deleted", GJson(true));
+ return answer(out);
+ });
+ });
+
+ // Serving profiles (location level) ---------------------------------------
+
+ router.post("/agent/sessions/serving-profiles/list", "agent-serving-profiles-list",
+ [routes](fw::Request req) {
+ Flat in = fw::parse_json_object_flat(req.body);
+ return guarded([&] {
+ GJson arr = GJson::array();
+ for (const gs::ServingProfile& p : routes->profiles(field(in, "location")).list())
+ arr.push(p.to_json());
+ GJson out = GJson::object();
+ out.set("serving_profiles", arr);
+ return answer(out);
+ });
+ });
+
+ router.post("/agent/sessions/serving-profiles/get", "agent-serving-profiles-get",
+ [routes](fw::Request req) {
+ Flat in = fw::parse_json_object_flat(req.body);
+ return guarded([&] {
+ return answer(
+ routes->profiles(field(in, "location")).get(field(in, "profile_id")).to_json());
+ });
+ });
+
+ router.post("/agent/sessions/serving-profiles/create", "agent-serving-profiles-create",
+ [routes](fw::Request req) {
+ Flat in = fw::parse_json_object_flat(req.body);
+ return guarded([&] {
+ gs::ServingProfileSpec spec;
+ spec.profile_id = field(in, "profile_id");
+ spec.display_name = field(in, "display_name");
+ spec.description = field(in, "description");
+ spec.scope = gs::serving_scope_from(field(in, "scope"));
+ return answer(routes->profiles(field(in, "location")).create(spec).to_json(), 201);
+ });
+ });
+
+ router.del("/agent/sessions/serving-profiles/profile", "agent-serving-profiles-delete",
+ [routes](fw::Request req) {
+ return guarded([&] {
+ routes->profiles(req.query_or("location", "")).remove(req.query_or("id", ""));
+ GJson out = GJson::object();
+ out.set("deleted", GJson(true));
+ return answer(out);
+ });
+ });
}
} // namespace molo::example::app
diff --git a/example/assets/agent_armor.js b/example/assets/agent_armor.js
index ba9b2ad..4ebc088 100644
--- a/example/assets/agent_armor.js
+++ b/example/assets/agent_armor.js
@@ -16,13 +16,15 @@
"templates/create": ["a-template"],
"templates/delete": ["a-template"],
"floor/get": ["a-scope"],
- "findings": ["a-scope", "a-severity"],
- "dashboard": ["a-scope", "a-severity"]
+ "findings": ["a-scope", "a-severity", "a-family"],
+ "dashboard": ["a-scope", "a-severity", "a-family"],
+ "scc/availability": ["a-scope"],
+ "scc/configs/list": ["a-scope", "a-kind"]
};
function sync() {
var shown = uses[action.value] || [];
- ["a-template", "a-text", "a-scope", "a-severity"].forEach(function (id) {
+ ["a-template", "a-text", "a-scope", "a-severity", "a-family", "a-kind"].forEach(function (id) {
$(id).parentNode.style.display = shown.indexOf(id) >= 0 ? "" : "none";
});
}
@@ -34,6 +36,8 @@
if (text.value) b.text = text.value;
if (scope.value) b.scope = scope.value;
if (severity.value) b.severity = severity.value;
+ if ($("a-family").value) b.family = $("a-family").value;
+ if (a === "scc/configs/list") { b.kind = $("a-kind").value; b.parent = scope.value; delete b.scope; }
if (a === "templates/create") {
b.pi = "MEDIUM_AND_ABOVE";
b.malicious_uri = "true";
diff --git a/example/assets/agent_optimize.js b/example/assets/agent_optimize.js
index 51b8865..de61b5f 100644
--- a/example/assets/agent_optimize.js
+++ b/example/assets/agent_optimize.js
@@ -17,6 +17,15 @@
fields: [["agent_instruction", "area"], ["instruction", "text"], ["count", "text:5"]] },
runs: { help: "List evaluation runs (needs OAuth).", fields: [["limit", "text:10"]] },
traces: { help: "Cloud Trace summary (needs OAuth).", fields: [["limit", "text:20"], ["filter", "text"]] },
+ synthetic: { help: "generateSyntheticData: paste the request JSON (needs OAuth).",
+ fields: [["request", "area:{ ... }"]] },
+ "operations/list": { help: "Operations of an online evaluator (needs OAuth).",
+ fields: [["evaluator", "text:projects/P/locations/L/onlineEvaluators/ID"], ["limit", "text:20"]] },
+ "operations/get": { help: "One online evaluator operation.", fields: [["name", "text"]] },
+ "operations/wait": { help: "Server-side wait, 1..60 seconds.",
+ fields: [["name", "text"], ["timeout_seconds", "text:30"]] },
+ "logs/write": { help: "Write one log entry. Dry run unless confirm is write.",
+ fields: [["log_id", "text:agent-check"], ["text", "text"], ["confirm", "text"]] },
logs: { help: "Cloud Logging entries (needs OAuth).", fields: [["limit", "text:20"], ["trace_id", "text"], ["filter", "text"]] }
};
var $ = function (id) { return document.getElementById(id); };
diff --git a/example/assets/agent_registry.js b/example/assets/agent_registry.js
index eaa0464..d3fa237 100644
--- a/example/assets/agent_registry.js
+++ b/example/assets/agent_registry.js
@@ -28,13 +28,25 @@
function get(path) {
return fetch(path).then(function (res) { return res.json(); });
}
+ // A list that hit its cap says so loudly; it is never presented as complete.
+ function banner(j) {
+ var el = $("r-truncated");
+ if (j && j.truncated === true) {
+ el.textContent = "TRUNCATED: showing " + j.count + " of more than " + j.cap_items +
+ " items (" + j.pages + " pages). Narrow the query or continue from the page token.";
+ el.hidden = false;
+ } else {
+ el.hidden = true;
+ el.textContent = "";
+ }
+ }
function run(promise) {
- promise.then(function (j) { show(JSON.stringify(j, null, 2), false); })
+ promise.then(function (j) { banner(j); show(JSON.stringify(j, null, 2), false); })
.catch(function (e) { show(e.message, true); });
}
$("r-list").addEventListener("click", function () {
- run(post("/agent/registry/list", { kind: $("r-kind").value }));
+ run(post("/agent/registry/list", { kind: $("r-kind").value, version: $("r-version").value }));
});
$("r-search").addEventListener("click", function () {
run(post("/agent/registry/search", { kind: $("r-kind").value, q: $("r-q").value }));
@@ -47,6 +59,8 @@
if (which === "gateways") run(post("/agent/registry/gateways/list"));
else if (which === "policies") run(post("/agent/registry/policies/list"));
else if (which === "identity") run(post("/agent/registry/identity", { engine_id: $("r-q").value }));
+ else if (which.indexOf("ops-") === 0)
+ run(post("/agent/registry/operations/list", { scope: which.substring(4) }));
else if (which === "approvals") run(get("/agent/registry/approvals"));
else run(get("/agent/registry/audit"));
});
diff --git a/src/google/armor/SPEC.md b/src/google/armor/SPEC.md
index 2c2958c..de216ca 100644
--- a/src/google/armor/SPEC.md
+++ b/src/google/armor/SPEC.md
@@ -19,6 +19,19 @@ module.
Finding resource carries typed `agent`, `agentAnomaly`, `agentSessions`,
`agentDataAccessEvents`, `aiModel` and `vulnerability` members, which are
read into `Finding`.
+- Security Command Center administration, `SecurityAdmin` (every v2 method
+ except the attack exposure engine): mute configs, notification configs and
+ BigQuery exports (list, get, create, patch, delete), finding state, mute,
+ patch, security marks, create, external systems, bulk mute, findings export,
+ sources create/patch and source IAM, asset security marks, organization
+ operations (get, list, cancel, delete). Attack paths, valued resources,
+ simulations and resource value configs are excluded on purpose: they are
+ cloud posture risk scoring, not agent security (`EXCLUDED_RE` in
+ `tools/check_discovery.py`).
+- Agent Threat Detection categories: `AgentCategories` holds the documented
+ category strings (runtime detectors and control plane detectors) with module
+ names. Agent Anomaly Detection has no documented category string: its
+ findings are the ones with the typed `agentAnomaly` member.
- Agent Security dashboard: a console product with no dashboard API.
`AgentSecurityDashboard` is a LOCAL abstraction that aggregates listed
findings (counts by severity, category, class, state, per-asset worst
@@ -40,7 +53,10 @@ env: `GOOGLE_CLOUD_PROJECT`, optional `GOOGLE_CLOUD_LOCATION`.
| File | Concern |
|---|---|
| `caps.h` | Static ceilings (`ArmorCaps`) |
-| `calls.h/.cpp` | The ONE table of declared calls, schemas, enums; path matcher |
+| `calls.h/.cpp` | The ONE table of declared calls (144 rows: rpc, verb, path, query, request schema, allowed body fields), schemas, enums; path matcher |
+| `scc_name.h/.cpp` | `SccName`: a validated SCC resource name; derives the table row (scope, `locations`, `sources`) from the name |
+| `security_admin.h/.cpp` | `SecurityAdmin : Service`: every SCC v2 administration method, `SccList`, `SccAvailability` probe |
+| `agent_categories.h/.cpp` | `AgentCategories`: documented Agent Platform Threat Detection categories and module names |
| `tools/check_discovery.py` | Fails when `calls.h` and Google's Discovery documents disagree |
| `armor_types.h/.cpp` | `SanitizationResult`, `FilterOutcome`, enums |
| `template.h/.cpp` | `Template`, `FilterConfig`, `TemplateMetadata`, `FloorSetting`, rule sets |
@@ -62,8 +78,8 @@ env: `GOOGLE_CLOUD_PROJECT`, optional `GOOGLE_CLOUD_LOCATION`.
| Labels per template | 64 (63 chars each) |
| Update mask paths | 16 |
| Detail strings per filter result | 50 |
-| Findings page size (Google max) / pages / results | 1000 / 10 / 5000 |
-| Categories in a filter | 20 |
+| Findings page size (Google max) / pages / results | 1000 / 10 / 5000; config and operation lists use 100 / 10 / 5000 and report `truncated` |
+| Categories in a filter | 100 (all documented agent categories fit) |
| Dashboard distinct assets | 500 |
## 4. Contracts
@@ -77,8 +93,19 @@ env: `GOOGLE_CLOUD_PROJECT`, optional `GOOGLE_CLOUD_LOCATION`.
`global` (`https://modelarmor.googleapis.com/v1`); templates and sanitize
reject `global`. Security Command Center: `https://securitycenter.googleapis.com/v2`.
- Destructive: `delete_template` is an explicit method; the demo route also
- requires `confirm=delete`. Nothing here creates, updates or deletes
- findings, sources or any Security Command Center resource.
+ requires `confirm=delete`. `SecurityAdmin` mutations are explicit methods
+ (`delete_config`, `bulk_mute`, `set_finding_state`, ...), each checked
+ against its table row (query parameters, top-level body fields, update mask
+ roots) before traffic. `bulk_mute` refuses an empty filter and only mutes or
+ un-mutes (`MUTED`, `UNDEFINED`); its demo route needs `confirm=bulk-mute`.
+ `cancel_operation` / `delete_operation` read the operation first. Floor
+ settings are read and written at location `global` on the global host only
+ (found live, see 6).
+- Lists never truncate silently: findings (`FindingPage::truncated`), config
+ and operation lists (`SccList::truncated` with `next_page_token`).
+- Not activated is a state, not a crash: `SecurityAdmin::availability` maps
+ 403 API disabled, 404 on `sources` and 400 `FAILED_PRECONDITION` (SCC enabled
+ but not activated for the project) to `SccAvailability`.
- `retry ids`: `requestId` is accepted on create, patch and delete as a
non-zero UUID.
- Sanitization results are typed; an unknown or missing `invocationResult`
@@ -97,13 +124,13 @@ env: `GOOGLE_CLOUD_PROJECT`, optional `GOOGLE_CLOUD_LOCATION`.
## 5. Verified against discovery
-`python3 -I src/google/armor/tools/check_discovery.py` fetches
+`python3 -I src/google/armor/tools/check_discovery.py` (coverage: every method of both Discovery documents is a table row except the excluded attack exposure engine) fetches
`https://modelarmor.googleapis.com/$discovery/rest?version=v1` and
`https://securitycenter.googleapis.com/$discovery/rest?version=v2` and checks
-every row of `calls.h`: 31 calls (rpc id, HTTP method, path, query
-parameters), 66 schemas (every field this module reads or writes) and 13 enum
-value sets. Result on 2026-10-24: `OK: 31 calls, 66 schemas, 13 enums
-checked, 0 problems`. Unit tests additionally prove that every request the
+every row of `calls.h`: 144 calls (rpc id, HTTP method, path, query
+parameters, request schema, request fields), 71 schemas (every field this
+module reads or writes) and 17 enum value sets. Result on 2026-10-24: `OK:
+144 calls, 71 schemas, 17 enums checked, 0 problems`. Unit tests additionally prove that every request the
client puts on the wire matches a declared call and only uses declared query
parameters, and that every key of every request body built here is a field of
its Discovery schema (nested schemas included).
@@ -122,6 +149,34 @@ and messages, `filterVersionSelector`, `modalities`, `dataResidencyCompliant`;
Date 2026-10-24, project from `GOOGLE_CLOUD_PROJECT`, no resource created,
updated or deleted.
+**Re-run after the owner enabled Model Armor and Security Command Center
+(service-account token, read-only):**
+
+| Call | Result |
+|---|---|
+| Model Armor `GET https://modelarmor.us-central1.rep.googleapis.com/v1/projects/P/locations/us-central1/templates` | 200 `{}` (no template exists) |
+| `GET https://modelarmor.googleapis.com/v1/projects/P/locations/global/floorSetting` | 200 `{name, createTime, updateTime}` (no filterConfig: enforcement off) |
+| `GET .../locations/us-central1/floorSetting` on the regional host | 400 INVALID_ARGUMENT "Malformed name" (floor settings exist only at `global`) |
+| `GET https://modelarmor.googleapis.com/v1/projects/P/locations?pageSize=5` | 200, a list of locations (`name`, `locationId`) |
+| `GET https://modelarmor.us-central1.rep.googleapis.com/v1/projects/P/locations` | 403 "Read access to project denied" (list is global-host only) |
+| `GET .../locations/us-central1` on the regional host / `.../locations/global` on the global host | 200 `{name, locationId}` |
+| `GET .../locations/us-central1` on the global host | 403 |
+| `sanitizeUserPrompt` against an absent template id | 400 INVALID_ARGUMENT "The template named '...' was not found" (request shape accepted; absent template is 400, not 404) |
+| SCC v2 `GET projects/P/sources`, `sources/-/findings`, `sources/-/locations/global/findings` (also v1 sources) | 404 NOT_FOUND "Requested entity was not found." |
+| SCC v2 `GET projects/P/muteConfigs`, `.../locations/global/muteConfigs`, `.../locations/global/notificationConfigs`, `.../locations/global/bigQueryExports` | 400 FAILED_PRECONDITION "Precondition check failed." |
+| Cloud Resource Manager `GET v3/projects/P` | 403 API not enabled (so the project's organization could not be read) |
+
+Reading: the API is enabled but Security Command Center is not activated for
+this project (no organization or SCC tier reachable): sources do not resolve
+and every config call fails its precondition. Findings, groups, mute configs,
+notification configs, exports and every `SecurityAdmin` happy path are
+therefore NOT seen live; they stay Discovery-verified. `SecurityAdmin::availability`
+reports `not_activated` for exactly this state, and the opt-in test
+`google_live_armor.oauth_token_reads_templates_and_findings` prints it.
+Model Armor code fixed from these runs: floor settings now use location
+`global` on the global host, `list_locations` uses the global host,
+`get_location` the location's own host.
+
| Call | Credential | Result |
|---|---|---|
| Model Armor `templates.list` | express key (`AQ.`) | 401 UNAUTHENTICATED (API keys are not supported); `google_live_armor.express_key_is_refused` |
@@ -155,8 +210,25 @@ disabled API loudly. Run it once the APIs are enabled.
Nothing neither Discovery nor docs state:
-- Finding `category` strings for Agent Threat Detection and Agent Anomaly
- Detection: not read; callers pass categories they see in the console.
+- Agent Anomaly Detection category strings: neither the anomaly overview page
+ nor the threat pages name one. Settled by documentation reading
+ (2026-10-24): Agent Platform Threat Detection (runtime, Preview) and the AI
+ agent control plane detectors publish the category strings in
+ `agent_categories.cpp` (module names `AGENT_ENGINE_*`); anomaly findings are
+ recognised by the typed `agentAnomaly` member, not by category. The pages
+ disagree on a few spellings (CloudSQL / Cloud SQL, "Evidence of Port
+ Scanning from AI Agent" / "AI Agent Evidence of Port Scanning", "Remove Bulk
+ Data From Disk" / "from Disk", "cryptocurrency" / "crypto", "Abuse of Sudo" /
+ "Attempt to Abuse Sudo"): both are listed and filtered. No finding was ever
+ seen live, so which spelling Google emits is unverified.
+- `SecurityAdmin` response bodies (configs, operations, marks) are returned as
+ raw Json and were never seen; request fields are checked against Discovery
+ only. Notification configs and BigQuery exports exist only under
+ `locations` in v2 (Discovery), mute configs with and without.
+- Whether `findings:bulkMute` accepts `UNMUTED` (Discovery's enum for
+ `BulkMuteFindingsRequest.muteState` is `MUTED`, `UNDEFINED`): only those are sent.
+- Sanitize against a floor setting without a template: not possible (a
+ template name is required); no default template exists.
- That agent assets always contain `reasoningEngines` in `resourceName`
(dashboard default filter; override with `resource_contains`).
- Server-side behavior of the `resourceName:"x"` substring operator (AIP-160
@@ -178,6 +250,9 @@ Nothing neither Discovery nor docs state:
- Streaming sanitize (`streamingMode`, gRPC `StreamSanitize*`) is not
implemented; `GuardedModel` buffers instead.
- No asset inventory (Cloud Asset Inventory is a different API).
-- Findings mutation (mute, state), notification configs, BigQuery exports,
- mute configs and attack paths are out of scope (read-only module).
+- Attack exposure engine (attack paths, valued resources, simulations,
+ resource value configs) is excluded on purpose (posture risk scoring).
+- Security Command Center is not activated for the test project, so no
+ findings, group, config or admin response was ever seen. Owner: whoever
+ activates SCC at the organization; tests `google_live_armor.*`.
- Token refresh is the caller's job (foundation gap).
diff --git a/src/google/armor/agent_categories.cpp b/src/google/armor/agent_categories.cpp
new file mode 100644
index 0000000..a6a5c15
--- /dev/null
+++ b/src/google/armor/agent_categories.cpp
@@ -0,0 +1,105 @@
+#include "google/armor/agent_categories.h"
+
+namespace molo::google::armor {
+
+namespace {
+constexpr AgentFamily R = AgentFamily::kRuntime;
+constexpr AgentFamily C = AgentFamily::kControlPlane;
+
+// clang-format off
+const std::vector kTable = {
+ // Control plane (Event Threat Detection), enabled by default.
+ {"Discovery: Evidence of Port Scanning from AI Agent", "Discovery: AI Agent Evidence of Port Scanning", "AGENT_ENGINE_PORT_SCANNING_EVIDENCE", C},
+ {"Discovery: AI Agent Unauthorized Service Account API Call", "", "AGENT_ENGINE_UNAUTHORIZED_SERVICE_ACCOUNT_API_CALL", C},
+ {"Discovery: AI Agent Unauthorized Service Account API Call Affecting Sensitive Data", "", "", C},
+ {"Discovery: AI Agent Service Account Self-Investigation", "", "AGENT_ENGINE_IAM_ANOMALOUS_BEHAVIOR_SERVICE_ACCOUNT_GETS_OWN_IAM_POLICY", C},
+ {"Credential Access: AI Agent Anomalous Access to Metadata Service", "", "AGENT_ENGINE_ANOMALOUS_ACCESS_TO_METADATA_SERVICE", C},
+ {"Exfiltration: AI Agent Initiated BigQuery VPC Perimeter Violation", "", "AGENT_ENGINE_BIG_QUERY_EXFIL_VPC_PERIMETER_VIOLATION", C},
+ {"Exfiltration: AI Agent Initiated BigQuery Data Exfiltration to External Table", "", "AGENT_ENGINE_BIG_QUERY_EXFIL_TO_EXTERNAL_TABLE", C},
+ {"Exfiltration: AI Agent Initiated Sensitive BigQuery Data Exfiltration to External Table", "", "", C},
+ {"Exfiltration: AI Agent Initiated CloudSQL Exfiltration to Public Bucket", "Exfiltration: AI Agent Initiated Cloud SQL Exfiltration to Public Bucket", "AGENT_ENGINE_CLOUDSQL_EXFIL_EXPORT_TO_PUBLIC_GCS", C},
+ {"Exfiltration: AI Agent Initiated CloudSQL Exfiltration to External Bucket", "Exfiltration: AI Agent Initiated Cloud SQL Exfiltration to External Bucket", "AGENT_ENGINE_CLOUDSQL_EXFIL_EXPORT_TO_EXTERNAL_GCS", C},
+ {"Exfiltration: AI Agent Initiated BigQuery Data Extraction", "", "AGENT_ENGINE_BIG_QUERY_EXFIL_TO_CLOUD_STORAGE", C},
+ {"Exfiltration: AI Agent Initiated Sensitive BigQuery Data Extraction", "", "", C},
+ {"Initial Access: AI Agent Identity Excessive Permission Denied Actions", "", "AGENT_ENGINE_EXCESSIVE_FAILED_ATTEMPT", C},
+ {"Privilege Escalation: AI Agent Token Generation Using signJwt", "", "AGENT_ENGINE_SUSPICIOUS_TOKEN_GENERATION_SIGN_JWT", C},
+ {"Privilege Escalation: AI Agent Token Generation Using Implicit Delegation", "", "AGENT_ENGINE_SUSPICIOUS_TOKEN_GENERATION_IMPLICIT_DELEGATION", C},
+ {"Privilege Escalation: AI Agent Cross-Project OpenID Token Generation", "", "AGENT_ENGINE_SUSPICIOUS_TOKEN_GENERATION_CROSS_PROJECT_OPENID", C},
+ {"Privilege Escalation: AI Agent Cross-Project Access Token Generation", "", "AGENT_ENGINE_SUSPICIOUS_TOKEN_GENERATION_CROSS_PROJECT_ACCESS_TOKEN", C},
+ // Runtime (Agent Platform Threat Detection, Preview).
+ {"Command and Control: Steganography Tool Detected", "", "AGENT_ENGINE_STEGANOGRAPHY_TOOL_DETECTED", R},
+ {"Credential Access: Find Google Cloud Credentials", "", "AGENT_ENGINE_FIND_GCP_CREDENTIALS", R},
+ {"Credential Access: GPG Key Reconnaissance", "", "AGENT_ENGINE_GPG_KEY_RECONNAISSANCE", R},
+ {"Credential Access: Search Private Keys or Passwords", "", "AGENT_ENGINE_SEARCH_PRIVATE_KEYS_OR_PASSWORDS", R},
+ {"Defense Evasion: Base64 ELF File Command Line", "", "AGENT_ENGINE_BASE64_ELF_FILE_CMDLINE", R},
+ {"Defense Evasion: Base64 Encoded Python Script Executed", "", "AGENT_ENGINE_BASE64_ENCODED_PYTHON_SCRIPT_EXECUTED", R},
+ {"Defense Evasion: Base64 Encoded Shell Script Executed", "", "AGENT_ENGINE_BASE64_ENCODED_SHELL_SCRIPT_EXECUTED", R},
+ {"Defense Evasion: Launch Code Compiler Tool In Container", "", "AGENT_ENGINE_LAUNCH_CODE_COMPILER_TOOL_IN_CONTAINER", R},
+ {"Execution: Added Malicious Binary Executed", "", "AGENT_ENGINE_ADDED_MALICIOUS_BINARY_EXECUTED", R},
+ {"Execution: Added Malicious Library Loaded", "", "AGENT_ENGINE_ADDED_MALICIOUS_LIBRARY_LOADED", R},
+ {"Execution: Added Malicious Skill Executed", "", "AGENT_ENGINE_ADDED_MALICIOUS_SKILL_EXECUTED", R},
+ {"Execution: Added Malicious Skill Loaded", "", "AGENT_ENGINE_ADDED_MALICIOUS_SKILL_LOADED", R},
+ {"Execution: Built in Malicious Binary Executed", "", "AGENT_ENGINE_BUILT_IN_MALICIOUS_BINARY_EXECUTED", R},
+ {"Execution: Container Escape", "", "AGENT_ENGINE_CONTAINER_ESCAPE", R},
+ {"Execution: Fileless Execution in /memfd:", "", "AGENT_ENGINE_FILELESS_EXECUTION_DETECTION_MEMFD", R},
+ {"Execution: Kubernetes Attack Tool Execution", "", "AGENT_ENGINE_KUBERNETES_ATTACK_TOOL_EXECUTION", R},
+ {"Execution: Local Reconnaissance Tool Execution", "", "AGENT_ENGINE_LOCAL_RECONNAISSANCE_TOOL_EXECUTION", R},
+ {"Execution: Malicious Python Executed", "", "AGENT_ENGINE_MALICIOUS_PYTHON_EXECUTED", R},
+ {"Execution: Modified Malicious Binary Executed", "", "AGENT_ENGINE_MODIFIED_MALICIOUS_BINARY_EXECUTED", R},
+ {"Execution: Modified Malicious Library Loaded", "", "AGENT_ENGINE_MODIFIED_MALICIOUS_LIBRARY_LOADED", R},
+ {"Execution: Modified Malicious Skill Executed", "", "AGENT_ENGINE_MODIFIED_MALICIOUS_SKILL_EXECUTED", R},
+ {"Execution: Modified Malicious Skill Loaded", "", "AGENT_ENGINE_MODIFIED_MALICIOUS_SKILL_LOADED", R},
+ {"Malicious Script Executed", "", "AGENT_ENGINE_MALICIOUS_SCRIPT_EXECUTED", R},
+ {"Malicious URL Observed", "", "AGENT_ENGINE_MALICIOUS_URL_OBSERVED", R},
+ {"Reverse Shell", "", "AGENT_ENGINE_REVERSE_SHELL", R},
+ {"Unexpected Child Shell", "", "AGENT_ENGINE_UNEXPECTED_CHILD_SHELL", R},
+ {"Execution: Netcat Remote Code Execution in Container", "", "AGENT_ENGINE_NETCAT_REMOTE_CODE_EXECUTION_IN_CONTAINER", R},
+ {"Execution: Possible Arbitrary Command Execution through CUPS (CVE-2024-47177)", "", "AGENT_ENGINE_POSSIBLE_ARBITRARY_COMMAND_EXECUTION_THROUGH_CUPS", R},
+ {"Execution: Possible Remote Command Execution Detected", "", "AGENT_ENGINE_POSSIBLE_REMOTE_COMMAND_EXECUTION_DETECTED", R},
+ {"Execution: Program Run with Disallowed HTTP Proxy Env", "", "AGENT_ENGINE_PROGRAM_RUN_WITH_DISALLOWED_HTTP_PROXY_ENV", R},
+ {"Execution: Socat Reverse Shell Detected", "", "AGENT_ENGINE_SOCAT_REVERSE_SHELL_DETECTED", R},
+ {"Execution: Suspicious OpenSSL Shared Object Loaded", "", "AGENT_ENGINE_SUSPICIOUS_OPENSSL_SHARED_OBJECT_LOADED", R},
+ {"Exfiltration: Launch Remote File Copy Tools in Container", "", "AGENT_ENGINE_LAUNCH_REMOTE_FILE_COPY_TOOLS_IN_CONTAINER", R},
+ {"Impact: Detect Malicious Cmdlines", "", "AGENT_ENGINE_DETECT_MALICIOUS_CMDLINES", R},
+ {"Impact: Remove Bulk Data From Disk", "Impact: Remove Bulk Data from Disk", "AGENT_ENGINE_REMOVE_BULK_DATA_FROM_DISK", R},
+ {"Impact: Suspicious cryptocurrency mining activity using the Stratum Protocol", "Impact: Suspicious crypto mining activity using the Stratum Protocol", "AGENT_ENGINE_DETECT_CRYPTO_MINERS_USING_STRATUM_PROTOCOL", R},
+ {"Privilege Escalation: Abuse of Sudo For Privilege Escalation (CVE-2019-14287)", "Privilege Escalation: Attempt to Abuse Sudo For Privilege Escalation (CVE-2019-14287)", "AGENT_ENGINE_ABUSE_SUDO_FOR_PRIVILEGE_ESCALATION", R},
+ {"Privilege Escalation: Polkit Local Privilege Escalation Vulnerability (CVE-2021-4034)", "", "AGENT_ENGINE_POLKIT_LOCAL_PRIVILEGE_ESCALATION_VULNERABILITY", R},
+ {"Privilege Escalation: Sudo Potential Privilege Escalation (CVE-2021-3156)", "", "AGENT_ENGINE_SUDO_POTENTIAL_PRIVILEGE_ESCALATION", R},
+};
+// clang-format on
+} // namespace
+
+const std::vector& AgentCategories::all() { return kTable; }
+
+std::vector AgentCategories::strings(AgentFamily family) {
+ std::vector out;
+ for (const AgentCategory& c : kTable) {
+ if (c.family != family) continue;
+ out.push_back(c.category);
+ if (c.alt[0]) out.push_back(c.alt);
+ }
+ return out;
+}
+
+std::vector AgentCategories::strings() {
+ std::vector out = strings(AgentFamily::kControlPlane);
+ std::vector rt = strings(AgentFamily::kRuntime);
+ out.insert(out.end(), rt.begin(), rt.end());
+ return out;
+}
+
+const AgentCategory* AgentCategories::find(const std::string& category) {
+ for (const AgentCategory& c : kTable)
+ if (category == c.category || (c.alt[0] && category == c.alt)) return &c;
+ return nullptr;
+}
+
+const AgentCategory* AgentCategories::find_module(const std::string& module) {
+ if (module.empty()) return nullptr;
+ for (const AgentCategory& c : kTable)
+ if (module == c.module) return &c;
+ return nullptr;
+}
+
+} // namespace molo::google::armor
diff --git a/src/google/armor/agent_categories.h b/src/google/armor/agent_categories.h
new file mode 100644
index 0000000..a02b414
--- /dev/null
+++ b/src/google/armor/agent_categories.h
@@ -0,0 +1,39 @@
+#pragma once
+// Security Command Center finding categories of Agent Platform Threat
+// Detection (runtime detectors, module names AGENT_ENGINE_*) and of the Event
+// Threat Detection control plane detectors for AI agents, read from the
+// official pages (see SPEC section Sources):
+// https://docs.cloud.google.com/security-command-center/docs/agent-engine-threat-detection-overview
+// https://docs.cloud.google.com/security-command-center/docs/ai-threats
+// The two pages spell a few categories differently (for example "CloudSQL"
+// and "Cloud SQL"); both spellings are listed and both are filtered on.
+// Agent Anomaly Detection has no documented category string: its findings are
+// recognised by the typed `agentAnomaly` member of the Finding.
+#include
+#include
+
+namespace molo::google::armor {
+
+enum class AgentFamily { kRuntime, kControlPlane };
+
+struct AgentCategory {
+ const char* category; // As on the agent-engine-threat-detection-overview page
+ const char* alt; // Spelling on the ai-threats page when it differs, else ""
+ const char* module; // Event Threat Detection / runtime module name
+ AgentFamily family;
+};
+
+class AgentCategories {
+ public:
+ static const std::vector& all();
+ // Every category string of a family, both spellings, for FindingQuery.categories.
+ static std::vector strings(AgentFamily family);
+ static std::vector strings(); // both families
+ // The entry whose category or alt equals `category`, or nullptr.
+ static const AgentCategory* find(const std::string& category);
+ static bool is_agent_threat(const std::string& category) { return find(category) != nullptr; }
+ // Entry by module name (the Finding.moduleName value), or nullptr.
+ static const AgentCategory* find_module(const std::string& module);
+};
+
+} // namespace molo::google::armor
diff --git a/src/google/armor/calls.h b/src/google/armor/calls.h
index 21f318a..a1413d6 100644
--- a/src/google/armor/calls.h
+++ b/src/google/armor/calls.h
@@ -18,6 +18,8 @@ struct CallSpec {
const char* http; // GET | POST | PATCH | DELETE
const char* path; // Discovery `path` (relative to the service root)
const char* query; // Comma separated query parameters this module sends
+ const char* request; // Discovery request schema name, "" when no body
+ const char* fields; // Comma separated top-level request fields allowed
};
struct SchemaSpec {
@@ -37,37 +39,150 @@ struct EnumSpec {
// clang-format off
inline constexpr CallSpec kCalls[] = {
- {"modelarmor", "v1", "modelarmor.projects.locations.templates.create", "POST", "v1/{+parent}/templates", "templateId,requestId"},
- {"modelarmor", "v1", "modelarmor.projects.locations.templates.get", "GET", "v1/{+name}", ""},
- {"modelarmor", "v1", "modelarmor.projects.locations.templates.list", "GET", "v1/{+parent}/templates", "pageSize,pageToken,filter,orderBy"},
- {"modelarmor", "v1", "modelarmor.projects.locations.templates.patch", "PATCH", "v1/{+name}", "updateMask,requestId"},
- {"modelarmor", "v1", "modelarmor.projects.locations.templates.delete", "DELETE", "v1/{+name}", "requestId"},
- {"modelarmor", "v1", "modelarmor.projects.locations.templates.sanitizeUserPrompt", "POST", "v1/{+name}:sanitizeUserPrompt", ""},
- {"modelarmor", "v1", "modelarmor.projects.locations.templates.sanitizeModelResponse", "POST", "v1/{+name}:sanitizeModelResponse", ""},
- {"modelarmor", "v1", "modelarmor.projects.locations.getFloorSetting", "GET", "v1/{+name}", ""},
- {"modelarmor", "v1", "modelarmor.projects.locations.updateFloorSetting", "PATCH", "v1/{+name}", "updateMask"},
- {"modelarmor", "v1", "modelarmor.folders.locations.getFloorSetting", "GET", "v1/{+name}", ""},
- {"modelarmor", "v1", "modelarmor.folders.locations.updateFloorSetting", "PATCH", "v1/{+name}", "updateMask"},
- {"modelarmor", "v1", "modelarmor.organizations.locations.getFloorSetting", "GET", "v1/{+name}", ""},
- {"modelarmor", "v1", "modelarmor.organizations.locations.updateFloorSetting", "PATCH", "v1/{+name}", "updateMask"},
- {"modelarmor", "v1", "modelarmor.projects.locations.list", "GET", "v1/{+name}/locations", "pageToken"},
- {"modelarmor", "v1", "modelarmor.projects.locations.get", "GET", "v1/{+name}", ""},
- {"securitycenter", "v2", "securitycenter.organizations.sources.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask"},
- {"securitycenter", "v2", "securitycenter.folders.sources.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask"},
- {"securitycenter", "v2", "securitycenter.projects.sources.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask"},
- {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask"},
- {"securitycenter", "v2", "securitycenter.folders.sources.locations.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask"},
- {"securitycenter", "v2", "securitycenter.projects.sources.locations.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask"},
- {"securitycenter", "v2", "securitycenter.organizations.sources.findings.group", "POST", "v2/{+parent}/findings:group", ""},
- {"securitycenter", "v2", "securitycenter.folders.sources.findings.group", "POST", "v2/{+parent}/findings:group", ""},
- {"securitycenter", "v2", "securitycenter.projects.sources.findings.group", "POST", "v2/{+parent}/findings:group", ""},
- {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.group", "POST", "v2/{+parent}/findings:group", ""},
- {"securitycenter", "v2", "securitycenter.folders.sources.locations.findings.group", "POST", "v2/{+parent}/findings:group", ""},
- {"securitycenter", "v2", "securitycenter.projects.sources.locations.findings.group", "POST", "v2/{+parent}/findings:group", ""},
- {"securitycenter", "v2", "securitycenter.organizations.sources.list", "GET", "v2/{+parent}/sources", "pageSize,pageToken"},
- {"securitycenter", "v2", "securitycenter.folders.sources.list", "GET", "v2/{+parent}/sources", "pageSize,pageToken"},
- {"securitycenter", "v2", "securitycenter.projects.sources.list", "GET", "v2/{+parent}/sources", "pageSize,pageToken"},
- {"securitycenter", "v2", "securitycenter.organizations.sources.get", "GET", "v2/{+name}", ""},
+ {"modelarmor", "v1", "modelarmor.projects.locations.templates.create", "POST", "v1/{+parent}/templates", "templateId,requestId", "Template", "templateMetadata,name,labels,filterConfig"},
+ {"modelarmor", "v1", "modelarmor.projects.locations.templates.get", "GET", "v1/{+name}", "", "", ""},
+ {"modelarmor", "v1", "modelarmor.projects.locations.templates.list", "GET", "v1/{+parent}/templates", "pageSize,pageToken,filter,orderBy", "", ""},
+ {"modelarmor", "v1", "modelarmor.projects.locations.templates.patch", "PATCH", "v1/{+name}", "updateMask,requestId", "Template", "templateMetadata,name,labels,filterConfig"},
+ {"modelarmor", "v1", "modelarmor.projects.locations.templates.delete", "DELETE", "v1/{+name}", "requestId", "", ""},
+ {"modelarmor", "v1", "modelarmor.projects.locations.templates.sanitizeUserPrompt", "POST", "v1/{+name}:sanitizeUserPrompt", "", "SanitizeUserPromptRequest", "userPromptData,streamingMode,multiLanguageDetectionMetadata"},
+ {"modelarmor", "v1", "modelarmor.projects.locations.templates.sanitizeModelResponse", "POST", "v1/{+name}:sanitizeModelResponse", "", "SanitizeModelResponseRequest", "streamingMode,multiLanguageDetectionMetadata,modelResponseData,userPrompt"},
+ {"modelarmor", "v1", "modelarmor.projects.locations.getFloorSetting", "GET", "v1/{+name}", "", "", ""},
+ {"modelarmor", "v1", "modelarmor.projects.locations.updateFloorSetting", "PATCH", "v1/{+name}", "updateMask", "FloorSetting", "aiPlatformFloorSetting,name,integratedServices,floorSettingMetadata,enableFloorSettingEnforcement,googleMcpServerFloorSetting,filterConfig"},
+ {"modelarmor", "v1", "modelarmor.folders.locations.getFloorSetting", "GET", "v1/{+name}", "", "", ""},
+ {"modelarmor", "v1", "modelarmor.folders.locations.updateFloorSetting", "PATCH", "v1/{+name}", "updateMask", "FloorSetting", "aiPlatformFloorSetting,name,integratedServices,floorSettingMetadata,enableFloorSettingEnforcement,googleMcpServerFloorSetting,filterConfig"},
+ {"modelarmor", "v1", "modelarmor.organizations.locations.getFloorSetting", "GET", "v1/{+name}", "", "", ""},
+ {"modelarmor", "v1", "modelarmor.organizations.locations.updateFloorSetting", "PATCH", "v1/{+name}", "updateMask", "FloorSetting", "aiPlatformFloorSetting,name,integratedServices,floorSettingMetadata,enableFloorSettingEnforcement,googleMcpServerFloorSetting,filterConfig"},
+ {"modelarmor", "v1", "modelarmor.projects.locations.list", "GET", "v1/{+name}/locations", "pageToken", "", ""},
+ {"modelarmor", "v1", "modelarmor.projects.locations.get", "GET", "v1/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.sources.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.sources.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.sources.locations.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.sources.locations.findings.list", "GET", "v2/{+parent}/findings", "pageSize,pageToken,filter,orderBy,fieldMask", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.findings.group", "POST", "v2/{+parent}/findings:group", "", "GroupFindingsRequest", "pageToken,groupBy,pageSize,filter"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.findings.group", "POST", "v2/{+parent}/findings:group", "", "GroupFindingsRequest", "pageToken,groupBy,pageSize,filter"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.findings.group", "POST", "v2/{+parent}/findings:group", "", "GroupFindingsRequest", "pageToken,groupBy,pageSize,filter"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.group", "POST", "v2/{+parent}/findings:group", "", "GroupFindingsRequest", "pageToken,groupBy,pageSize,filter"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.locations.findings.group", "POST", "v2/{+parent}/findings:group", "", "GroupFindingsRequest", "pageToken,groupBy,pageSize,filter"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.locations.findings.group", "POST", "v2/{+parent}/findings:group", "", "GroupFindingsRequest", "pageToken,groupBy,pageSize,filter"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.list", "GET", "v2/{+parent}/sources", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.sources.list", "GET", "v2/{+parent}/sources", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.sources.list", "GET", "v2/{+parent}/sources", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.assets.updateSecurityMarks", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2SecurityMarks", "name,marks,canonicalName"},
+ {"securitycenter", "v2", "securitycenter.folders.findings.bulkMute", "POST", "v2/{+parent}/findings:bulkMute", "", "BulkMuteFindingsRequest", "filter,muteState"},
+ {"securitycenter", "v2", "securitycenter.folders.locations.bigQueryExports.create", "POST", "v2/{+parent}/bigQueryExports", "bigQueryExportId", "GoogleCloudSecuritycenterV2BigQueryExport", "name,filter,dataset,deletionNotificationsEnabled,description"},
+ {"securitycenter", "v2", "securitycenter.folders.locations.bigQueryExports.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.locations.bigQueryExports.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.locations.bigQueryExports.list", "GET", "v2/{+parent}/bigQueryExports", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.locations.bigQueryExports.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2BigQueryExport", "name,filter,dataset,deletionNotificationsEnabled,description"},
+ {"securitycenter", "v2", "securitycenter.folders.locations.findings.bulkMute", "POST", "v2/{+parent}/findings:bulkMute", "", "BulkMuteFindingsRequest", "filter,muteState"},
+ {"securitycenter", "v2", "securitycenter.folders.locations.muteConfigs.create", "POST", "v2/{+parent}/muteConfigs", "muteConfigId", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.folders.locations.muteConfigs.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.locations.muteConfigs.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.locations.muteConfigs.list", "GET", "v2/{+parent}/muteConfigs", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.locations.muteConfigs.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.folders.locations.notificationConfigs.create", "POST", "v2/{+parent}/notificationConfigs", "configId", "NotificationConfig", "streamingConfig,pubsubTopic,description,name,deletionNotificationsEnabled"},
+ {"securitycenter", "v2", "securitycenter.folders.locations.notificationConfigs.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.locations.notificationConfigs.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.locations.notificationConfigs.list", "GET", "v2/{+parent}/notificationConfigs", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.locations.notificationConfigs.patch", "PATCH", "v2/{+name}", "updateMask", "NotificationConfig", "streamingConfig,pubsubTopic,description,name,deletionNotificationsEnabled"},
+ {"securitycenter", "v2", "securitycenter.folders.muteConfigs.create", "POST", "v2/{+parent}/muteConfigs", "muteConfigId", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.folders.muteConfigs.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.muteConfigs.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.muteConfigs.list", "GET", "v2/{+parent}/muteConfigs", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.folders.muteConfigs.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.findings.externalSystems.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2ExternalSystem", "caseUri,name,assignees,externalUid,casePriority,status,caseSla,caseCloseTime,caseCreateTime,externalSystemUpdateTime,ticketInfo"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.findings.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2Finding", "iamBindings,eventTime,loadBalancers,findingClass,secret,database,moduleName,securityPosture,dataRetentionDeletionEvents,indicator,vertexAi,kubernetes,chokepoint,cloudArmor,exfiltration,files,notebook,toxicCombination,iamDetails,agentAnomaly,name,artifactGuardPolicies,compliances,processes,backupDisasterRecovery,parent,severity,externalExposure,connections,groupMemberships,attackExposure,disk,discoveredWorkload,agentDataAccessEvents,policyViolationSummary,logEntries,muteInitiator,vulnerability,externalUri,category,agent,mitreAttack,resourceName,orgPolicies,networks,kernelRootkit,dataAccessEvents,agentSessions,application,ipRules,job,cloudDlpInspection,aiModel,nextSteps,access,mute,cloudDlpDataProfile,affectedResources,complianceDetails,dataFlowEvents,containers,sourceProperties,description"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.findings.setMute", "POST", "v2/{+name}:setMute", "", "SetMuteRequest", "mute"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.findings.setState", "POST", "v2/{+name}:setState", "", "SetFindingStateRequest", "state"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.findings.updateSecurityMarks", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2SecurityMarks", "name,marks,canonicalName"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.locations.findings.export", "POST", "v2/{+parent}/findings:export", "", "ExportFindingsRequest", "bigQueryDestination"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.locations.findings.externalSystems.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2ExternalSystem", "caseUri,name,assignees,externalUid,casePriority,status,caseSla,caseCloseTime,caseCreateTime,externalSystemUpdateTime,ticketInfo"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.locations.findings.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2Finding", "iamBindings,eventTime,loadBalancers,findingClass,secret,database,moduleName,securityPosture,dataRetentionDeletionEvents,indicator,vertexAi,kubernetes,chokepoint,cloudArmor,exfiltration,files,notebook,toxicCombination,iamDetails,agentAnomaly,name,artifactGuardPolicies,compliances,processes,backupDisasterRecovery,parent,severity,externalExposure,connections,groupMemberships,attackExposure,disk,discoveredWorkload,agentDataAccessEvents,policyViolationSummary,logEntries,muteInitiator,vulnerability,externalUri,category,agent,mitreAttack,resourceName,orgPolicies,networks,kernelRootkit,dataAccessEvents,agentSessions,application,ipRules,job,cloudDlpInspection,aiModel,nextSteps,access,mute,cloudDlpDataProfile,affectedResources,complianceDetails,dataFlowEvents,containers,sourceProperties,description"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.locations.findings.setMute", "POST", "v2/{+name}:setMute", "", "SetMuteRequest", "mute"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.locations.findings.setState", "POST", "v2/{+name}:setState", "", "SetFindingStateRequest", "state"},
+ {"securitycenter", "v2", "securitycenter.folders.sources.locations.findings.updateSecurityMarks", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2SecurityMarks", "name,marks,canonicalName"},
+ {"securitycenter", "v2", "securitycenter.organizations.assets.updateSecurityMarks", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2SecurityMarks", "name,marks,canonicalName"},
+ {"securitycenter", "v2", "securitycenter.organizations.findings.bulkMute", "POST", "v2/{+parent}/findings:bulkMute", "", "BulkMuteFindingsRequest", "filter,muteState"},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.bigQueryExports.create", "POST", "v2/{+parent}/bigQueryExports", "bigQueryExportId", "GoogleCloudSecuritycenterV2BigQueryExport", "name,filter,dataset,deletionNotificationsEnabled,description"},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.bigQueryExports.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.bigQueryExports.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.bigQueryExports.list", "GET", "v2/{+parent}/bigQueryExports", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.bigQueryExports.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2BigQueryExport", "name,filter,dataset,deletionNotificationsEnabled,description"},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.findings.bulkMute", "POST", "v2/{+parent}/findings:bulkMute", "", "BulkMuteFindingsRequest", "filter,muteState"},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.muteConfigs.create", "POST", "v2/{+parent}/muteConfigs", "muteConfigId", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.muteConfigs.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.muteConfigs.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.muteConfigs.list", "GET", "v2/{+parent}/muteConfigs", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.muteConfigs.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.notificationConfigs.create", "POST", "v2/{+parent}/notificationConfigs", "configId", "NotificationConfig", "streamingConfig,pubsubTopic,description,name,deletionNotificationsEnabled"},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.notificationConfigs.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.notificationConfigs.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.notificationConfigs.list", "GET", "v2/{+parent}/notificationConfigs", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.locations.notificationConfigs.patch", "PATCH", "v2/{+name}", "updateMask", "NotificationConfig", "streamingConfig,pubsubTopic,description,name,deletionNotificationsEnabled"},
+ {"securitycenter", "v2", "securitycenter.organizations.muteConfigs.create", "POST", "v2/{+parent}/muteConfigs", "muteConfigId", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.organizations.muteConfigs.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.muteConfigs.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.muteConfigs.list", "GET", "v2/{+parent}/muteConfigs", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.muteConfigs.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.organizations.operations.cancel", "POST", "v2/{+name}:cancel", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.operations.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.operations.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.operations.list", "GET", "v2/{+name}", "filter,pageSize,pageToken,returnPartialSuccess", "", ""},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.create", "POST", "v2/{+parent}/sources", "", "Source", "canonicalName,name,displayName,description"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.findings.create", "POST", "v2/{+parent}/findings", "findingId", "GoogleCloudSecuritycenterV2Finding", "iamBindings,eventTime,loadBalancers,findingClass,secret,database,moduleName,securityPosture,dataRetentionDeletionEvents,indicator,vertexAi,kubernetes,chokepoint,cloudArmor,exfiltration,files,notebook,toxicCombination,iamDetails,agentAnomaly,name,artifactGuardPolicies,compliances,processes,backupDisasterRecovery,parent,severity,externalExposure,connections,groupMemberships,attackExposure,disk,discoveredWorkload,agentDataAccessEvents,policyViolationSummary,logEntries,muteInitiator,vulnerability,externalUri,category,agent,mitreAttack,resourceName,orgPolicies,networks,kernelRootkit,dataAccessEvents,agentSessions,application,ipRules,job,cloudDlpInspection,aiModel,nextSteps,access,mute,cloudDlpDataProfile,affectedResources,complianceDetails,dataFlowEvents,containers,sourceProperties,description"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.findings.externalSystems.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2ExternalSystem", "caseUri,name,assignees,externalUid,casePriority,status,caseSla,caseCloseTime,caseCreateTime,externalSystemUpdateTime,ticketInfo"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.findings.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2Finding", "iamBindings,eventTime,loadBalancers,findingClass,secret,database,moduleName,securityPosture,dataRetentionDeletionEvents,indicator,vertexAi,kubernetes,chokepoint,cloudArmor,exfiltration,files,notebook,toxicCombination,iamDetails,agentAnomaly,name,artifactGuardPolicies,compliances,processes,backupDisasterRecovery,parent,severity,externalExposure,connections,groupMemberships,attackExposure,disk,discoveredWorkload,agentDataAccessEvents,policyViolationSummary,logEntries,muteInitiator,vulnerability,externalUri,category,agent,mitreAttack,resourceName,orgPolicies,networks,kernelRootkit,dataAccessEvents,agentSessions,application,ipRules,job,cloudDlpInspection,aiModel,nextSteps,access,mute,cloudDlpDataProfile,affectedResources,complianceDetails,dataFlowEvents,containers,sourceProperties,description"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.findings.setMute", "POST", "v2/{+name}:setMute", "", "SetMuteRequest", "mute"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.findings.setState", "POST", "v2/{+name}:setState", "", "SetFindingStateRequest", "state"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.findings.updateSecurityMarks", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2SecurityMarks", "name,marks,canonicalName"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.getIamPolicy", "POST", "v2/{+resource}:getIamPolicy", "", "GetIamPolicyRequest", "options"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.create", "POST", "v2/{+parent}/findings", "findingId", "GoogleCloudSecuritycenterV2Finding", "iamBindings,eventTime,loadBalancers,findingClass,secret,database,moduleName,securityPosture,dataRetentionDeletionEvents,indicator,vertexAi,kubernetes,chokepoint,cloudArmor,exfiltration,files,notebook,toxicCombination,iamDetails,agentAnomaly,name,artifactGuardPolicies,compliances,processes,backupDisasterRecovery,parent,severity,externalExposure,connections,groupMemberships,attackExposure,disk,discoveredWorkload,agentDataAccessEvents,policyViolationSummary,logEntries,muteInitiator,vulnerability,externalUri,category,agent,mitreAttack,resourceName,orgPolicies,networks,kernelRootkit,dataAccessEvents,agentSessions,application,ipRules,job,cloudDlpInspection,aiModel,nextSteps,access,mute,cloudDlpDataProfile,affectedResources,complianceDetails,dataFlowEvents,containers,sourceProperties,description"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.export", "POST", "v2/{+parent}/findings:export", "", "ExportFindingsRequest", "bigQueryDestination"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.externalSystems.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2ExternalSystem", "caseUri,name,assignees,externalUid,casePriority,status,caseSla,caseCloseTime,caseCreateTime,externalSystemUpdateTime,ticketInfo"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2Finding", "iamBindings,eventTime,loadBalancers,findingClass,secret,database,moduleName,securityPosture,dataRetentionDeletionEvents,indicator,vertexAi,kubernetes,chokepoint,cloudArmor,exfiltration,files,notebook,toxicCombination,iamDetails,agentAnomaly,name,artifactGuardPolicies,compliances,processes,backupDisasterRecovery,parent,severity,externalExposure,connections,groupMemberships,attackExposure,disk,discoveredWorkload,agentDataAccessEvents,policyViolationSummary,logEntries,muteInitiator,vulnerability,externalUri,category,agent,mitreAttack,resourceName,orgPolicies,networks,kernelRootkit,dataAccessEvents,agentSessions,application,ipRules,job,cloudDlpInspection,aiModel,nextSteps,access,mute,cloudDlpDataProfile,affectedResources,complianceDetails,dataFlowEvents,containers,sourceProperties,description"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.setMute", "POST", "v2/{+name}:setMute", "", "SetMuteRequest", "mute"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.setState", "POST", "v2/{+name}:setState", "", "SetFindingStateRequest", "state"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.locations.findings.updateSecurityMarks", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2SecurityMarks", "name,marks,canonicalName"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.patch", "PATCH", "v2/{+name}", "updateMask", "Source", "canonicalName,name,displayName,description"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.setIamPolicy", "POST", "v2/{+resource}:setIamPolicy", "", "SetIamPolicyRequest", "updateMask,policy"},
+ {"securitycenter", "v2", "securitycenter.organizations.sources.testIamPermissions", "POST", "v2/{+resource}:testIamPermissions", "", "TestIamPermissionsRequest", "permissions"},
+ {"securitycenter", "v2", "securitycenter.projects.assets.updateSecurityMarks", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2SecurityMarks", "name,marks,canonicalName"},
+ {"securitycenter", "v2", "securitycenter.projects.findings.bulkMute", "POST", "v2/{+parent}/findings:bulkMute", "", "BulkMuteFindingsRequest", "filter,muteState"},
+ {"securitycenter", "v2", "securitycenter.projects.locations.bigQueryExports.create", "POST", "v2/{+parent}/bigQueryExports", "bigQueryExportId", "GoogleCloudSecuritycenterV2BigQueryExport", "name,filter,dataset,deletionNotificationsEnabled,description"},
+ {"securitycenter", "v2", "securitycenter.projects.locations.bigQueryExports.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.locations.bigQueryExports.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.locations.bigQueryExports.list", "GET", "v2/{+parent}/bigQueryExports", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.locations.bigQueryExports.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2BigQueryExport", "name,filter,dataset,deletionNotificationsEnabled,description"},
+ {"securitycenter", "v2", "securitycenter.projects.locations.findings.bulkMute", "POST", "v2/{+parent}/findings:bulkMute", "", "BulkMuteFindingsRequest", "filter,muteState"},
+ {"securitycenter", "v2", "securitycenter.projects.locations.muteConfigs.create", "POST", "v2/{+parent}/muteConfigs", "muteConfigId", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.projects.locations.muteConfigs.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.locations.muteConfigs.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.locations.muteConfigs.list", "GET", "v2/{+parent}/muteConfigs", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.locations.muteConfigs.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.projects.locations.notificationConfigs.create", "POST", "v2/{+parent}/notificationConfigs", "configId", "NotificationConfig", "streamingConfig,pubsubTopic,description,name,deletionNotificationsEnabled"},
+ {"securitycenter", "v2", "securitycenter.projects.locations.notificationConfigs.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.locations.notificationConfigs.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.locations.notificationConfigs.list", "GET", "v2/{+parent}/notificationConfigs", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.locations.notificationConfigs.patch", "PATCH", "v2/{+name}", "updateMask", "NotificationConfig", "streamingConfig,pubsubTopic,description,name,deletionNotificationsEnabled"},
+ {"securitycenter", "v2", "securitycenter.projects.muteConfigs.create", "POST", "v2/{+parent}/muteConfigs", "muteConfigId", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.projects.muteConfigs.delete", "DELETE", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.muteConfigs.get", "GET", "v2/{+name}", "", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.muteConfigs.list", "GET", "v2/{+parent}/muteConfigs", "pageSize,pageToken", "", ""},
+ {"securitycenter", "v2", "securitycenter.projects.muteConfigs.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2MuteConfig", "description,name,type,filter,expiryTime"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.findings.externalSystems.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2ExternalSystem", "caseUri,name,assignees,externalUid,casePriority,status,caseSla,caseCloseTime,caseCreateTime,externalSystemUpdateTime,ticketInfo"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.findings.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2Finding", "iamBindings,eventTime,loadBalancers,findingClass,secret,database,moduleName,securityPosture,dataRetentionDeletionEvents,indicator,vertexAi,kubernetes,chokepoint,cloudArmor,exfiltration,files,notebook,toxicCombination,iamDetails,agentAnomaly,name,artifactGuardPolicies,compliances,processes,backupDisasterRecovery,parent,severity,externalExposure,connections,groupMemberships,attackExposure,disk,discoveredWorkload,agentDataAccessEvents,policyViolationSummary,logEntries,muteInitiator,vulnerability,externalUri,category,agent,mitreAttack,resourceName,orgPolicies,networks,kernelRootkit,dataAccessEvents,agentSessions,application,ipRules,job,cloudDlpInspection,aiModel,nextSteps,access,mute,cloudDlpDataProfile,affectedResources,complianceDetails,dataFlowEvents,containers,sourceProperties,description"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.findings.setMute", "POST", "v2/{+name}:setMute", "", "SetMuteRequest", "mute"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.findings.setState", "POST", "v2/{+name}:setState", "", "SetFindingStateRequest", "state"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.findings.updateSecurityMarks", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2SecurityMarks", "name,marks,canonicalName"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.locations.findings.export", "POST", "v2/{+parent}/findings:export", "", "ExportFindingsRequest", "bigQueryDestination"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.locations.findings.externalSystems.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2ExternalSystem", "caseUri,name,assignees,externalUid,casePriority,status,caseSla,caseCloseTime,caseCreateTime,externalSystemUpdateTime,ticketInfo"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.locations.findings.patch", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2Finding", "iamBindings,eventTime,loadBalancers,findingClass,secret,database,moduleName,securityPosture,dataRetentionDeletionEvents,indicator,vertexAi,kubernetes,chokepoint,cloudArmor,exfiltration,files,notebook,toxicCombination,iamDetails,agentAnomaly,name,artifactGuardPolicies,compliances,processes,backupDisasterRecovery,parent,severity,externalExposure,connections,groupMemberships,attackExposure,disk,discoveredWorkload,agentDataAccessEvents,policyViolationSummary,logEntries,muteInitiator,vulnerability,externalUri,category,agent,mitreAttack,resourceName,orgPolicies,networks,kernelRootkit,dataAccessEvents,agentSessions,application,ipRules,job,cloudDlpInspection,aiModel,nextSteps,access,mute,cloudDlpDataProfile,affectedResources,complianceDetails,dataFlowEvents,containers,sourceProperties,description"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.locations.findings.setMute", "POST", "v2/{+name}:setMute", "", "SetMuteRequest", "mute"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.locations.findings.setState", "POST", "v2/{+name}:setState", "", "SetFindingStateRequest", "state"},
+ {"securitycenter", "v2", "securitycenter.projects.sources.locations.findings.updateSecurityMarks", "PATCH", "v2/{+name}", "updateMask", "GoogleCloudSecuritycenterV2SecurityMarks", "name,marks,canonicalName"},
};
// Request bodies (what to_json emits) and response documents (what from_json reads).
@@ -138,6 +253,11 @@ inline constexpr SchemaSpec kSchemas[] = {
{"securitycenter", "v2", "GoogleCloudSecuritycenterV2Cve", "id"},
{"securitycenter", "v2", "ListSourcesResponse", "sources,nextPageToken"},
{"securitycenter", "v2", "Source", "name,displayName,description,canonicalName"},
+ {"securitycenter", "v2", "ListMuteConfigsResponse", "muteConfigs,nextPageToken"},
+ {"securitycenter", "v2", "ListNotificationConfigsResponse", "notificationConfigs,nextPageToken"},
+ {"securitycenter", "v2", "ListBigQueryExportsResponse", "bigQueryExports,nextPageToken"},
+ {"securitycenter", "v2", "ListOperationsResponse", "operations,nextPageToken"},
+ {"securitycenter", "v2", "Operation", "name,done,error,response,metadata"},
};
inline constexpr EnumSpec kEnums[] = {
@@ -153,6 +273,10 @@ inline constexpr EnumSpec kEnums[] = {
{"modelarmor", "v1", "ByteDataItem", "byteDataType", "PLAINTEXT_UTF8,PDF,WORD_DOCUMENT,EXCEL_DOCUMENT,POWERPOINT_DOCUMENT,TXT,CSV,IMAGE"},
{"securitycenter", "v2", "GoogleCloudSecuritycenterV2Finding", "state", "ACTIVE,INACTIVE"},
{"securitycenter", "v2", "GoogleCloudSecuritycenterV2Finding", "severity", "CRITICAL,HIGH,MEDIUM,LOW"},
+ {"securitycenter", "v2", "SetMuteRequest", "mute", "MUTED,UNMUTED,UNDEFINED"},
+ {"securitycenter", "v2", "SetFindingStateRequest", "state", "ACTIVE,INACTIVE"},
+ {"securitycenter", "v2", "BulkMuteFindingsRequest", "muteState", "MUTED,UNDEFINED"},
+ {"securitycenter", "v2", "GoogleCloudSecuritycenterV2MuteConfig", "type", "STATIC,DYNAMIC"},
{"securitycenter", "v2", "GoogleCloudSecuritycenterV2Finding", "findingClass", "THREAT,VULNERABILITY,MISCONFIGURATION,OBSERVATION"},
};
// clang-format on
diff --git a/src/google/armor/caps.h b/src/google/armor/caps.h
index 972bf82..4e80112 100644
--- a/src/google/armor/caps.h
+++ b/src/google/armor/caps.h
@@ -34,7 +34,7 @@ struct ArmorCaps {
static constexpr std::size_t kMaxFindingPages = 10;
static constexpr std::size_t kMaxFindings = 5000;
static constexpr std::size_t kMaxFilterValueChars = 256;
- static constexpr std::size_t kMaxFilterCategories = 20;
+ static constexpr std::size_t kMaxFilterCategories = 100;
static constexpr std::size_t kMaxSources = 100;
// Distinct assets reported by the local dashboard.
static constexpr std::size_t kMaxDashboardAssets = 500;
diff --git a/src/google/armor/findings.cpp b/src/google/armor/findings.cpp
index 768f6f6..74ca79e 100644
--- a/src/google/armor/findings.cpp
+++ b/src/google/armor/findings.cpp
@@ -33,6 +33,17 @@ bool safe_value(const std::string& v) {
return true;
}
+// Finding categories are display names such as "Execution: Container Escape" or
+// "Execution: Possible Remote Command Execution Detected": printable ASCII with
+// spaces, colons and parentheses, never a quote or backslash (the value is
+// placed inside a quoted filter string).
+bool safe_category(const std::string& v) {
+ if (v.empty() || v.size() > ArmorCaps::kMaxFilterValueChars) return false;
+ for (unsigned char c : v)
+ if (c < 0x20 || c > 0x7e || c == '"' || c == '\\') return false;
+ return true;
+}
+
// Comma separated field paths: letters, digits, '_' and '.'.
bool safe_path_list(const std::string& v) {
if (v.empty() || v.size() > ArmorCaps::kMaxFilterValueChars) return false;
@@ -166,7 +177,7 @@ void FindingQuery::validate() const {
if (categories.size() > ArmorCaps::kMaxFilterCategories)
throw GoogleError::invalid("too many categories");
for (const auto& c : categories)
- if (!safe_value(c)) throw GoogleError::invalid("bad category");
+ if (!safe_category(c)) throw GoogleError::invalid("bad category");
if (!state.empty() && !one_of(state, {"ACTIVE", "INACTIVE"}))
throw GoogleError::invalid("state must be ACTIVE or INACTIVE");
if (!severity.empty() && !one_of(severity, {"CRITICAL", "HIGH", "MEDIUM", "LOW"}))
diff --git a/src/google/armor/model_armor.cpp b/src/google/armor/model_armor.cpp
index c479dfc..00d6972 100644
--- a/src/google/armor/model_armor.cpp
+++ b/src/google/armor/model_armor.cpp
@@ -104,16 +104,17 @@ std::string ModelArmor::template_path(const std::string& id) const {
return "/" + context_.child("templates", id);
}
-ServiceEndpoint ModelArmor::floor_endpoint() const {
- return endpoint_for(context_.location);
-}
+// Observed live 2026-10-24: floor settings exist only at location "global"
+// on the global host (a regional name answers 400 "Malformed name"), and
+// projects.locations.list answers 403 on a regional host.
+ServiceEndpoint ModelArmor::floor_endpoint() const { return endpoint_for("global"); }
std::string ModelArmor::floor_path(const std::string& scope) const {
std::string s = scope;
context_.parent(); // Validates project and location.
if (s.empty()) s = "projects/" + context_.project;
if (!valid_scope(s)) throw GoogleError::invalid("bad floor setting scope");
- return "/" + s + "/locations/" + context_.location + "/floorSetting";
+ return "/" + s + "/locations/global/floorSetting";
}
std::string ModelArmor::request_id_query(const std::string& request_id, char sep) {
@@ -216,7 +217,8 @@ std::vector ModelArmor::list_locations() {
}
ArmorLocation ModelArmor::get_location() {
- Json l = client_->get_json(floor_endpoint(), "/" + context_.parent());
+ // A location is served by its own host (regional or global).
+ Json l = client_->get_json(endpoint_for(context_.location), "/" + context_.parent());
return {string_at(l, "name"), string_at(l, "locationId"), string_at(l, "displayName")};
}
diff --git a/src/google/armor/scc_name.cpp b/src/google/armor/scc_name.cpp
new file mode 100644
index 0000000..b560fcb
--- /dev/null
+++ b/src/google/armor/scc_name.cpp
@@ -0,0 +1,57 @@
+#include "google/armor/scc_name.h"
+
+#include "google/errors.h"
+#include "google/resource.h"
+
+namespace molo::google::armor {
+
+SccName SccName::parse(const std::string& name) {
+ if (name.empty() || name.size() > 512 || name.front() == '/' ||
+ name.find("..") != std::string::npos || name.find("//") != std::string::npos)
+ throw GoogleError::invalid("bad Security Command Center resource name");
+ SccName out;
+ out.full_ = name;
+ std::string cur;
+ for (char c : name) {
+ if (c == '/') {
+ out.segments_.push_back(cur);
+ cur.clear();
+ } else {
+ cur.push_back(c);
+ }
+ }
+ out.segments_.push_back(cur);
+ const auto& s = out.segments_;
+ if (s.size() < 2 || s.size() > 12)
+ throw GoogleError::invalid("resource name needs 2..12 segments");
+ for (const std::string& seg : s)
+ if (!valid_segment(seg)) throw GoogleError::invalid("resource name has an invalid segment");
+ if (s[0] != "organizations" && s[0] != "folders" && s[0] != "projects")
+ throw GoogleError::invalid("resource name must start with organizations/, folders/ or projects/");
+ out.kind_ = s[0];
+ if (s.size() > 2 && s[2] == "locations") out.has_location_ = true;
+ if (s.size() > 4 && s[2] == "sources" && s[4] == "locations") out.has_location_ = true;
+ return out;
+}
+
+bool SccName::names_collection(const std::string& collection) const {
+ for (std::size_t i = 2; i < segments_.size(); ++i)
+ if (segments_[i] == collection) return true;
+ return false;
+}
+
+bool SccName::ends_with_id_of(const std::string& collection) const {
+ return segments_.size() >= 4 && segments_[segments_.size() - 2] == collection;
+}
+
+std::string SccName::rpc_for(const std::string& tail) const {
+ std::string base = "securitycenter." + kind_ + ".";
+ const std::string sources = "sources.";
+ if (tail.compare(0, sources.size(), sources) == 0)
+ return base + sources + (has_location_ ? "locations." : "") + tail.substr(sources.size());
+ return base + (has_location_ ? "locations." : "") + tail;
+}
+
+const CallSpec* SccName::row(const std::string& tail) const { return find_rpc(rpc_for(tail)); }
+
+} // namespace molo::google::armor
diff --git a/src/google/armor/scc_name.h b/src/google/armor/scc_name.h
new file mode 100644
index 0000000..1e48929
--- /dev/null
+++ b/src/google/armor/scc_name.h
@@ -0,0 +1,47 @@
+#pragma once
+// A validated Security Command Center v2 resource name or parent and the
+// table row that serves a method for it. Discovery lists each method per
+// scope (organizations, folders, projects) and, for most, again under
+// `locations`; the row is derived from the name itself so a caller can never
+// reach a different scope than the one it named:
+// projects/p/locations/global/muteConfigs/x -> securitycenter.projects.locations.muteConfigs.*
+// projects/p/muteConfigs/x -> securitycenter.projects.muteConfigs.*
+// organizations/1/sources/2/findings/f -> securitycenter.organizations.sources.findings.*
+// organizations/1/sources/2/locations/l/findings/f -> ...sources.locations.findings.*
+#include
+#include
+
+#include "google/armor/calls.h"
+
+namespace molo::google::armor {
+
+class SccName {
+ public:
+ // Throws GoogleError::invalid when the name is not a well formed resource
+ // name (scope kind, valid id, valid segments, at most 12, no "..").
+ static SccName parse(const std::string& name);
+
+ const std::string& str() const { return full_; }
+ const std::string& kind() const { return kind_; } // organizations|folders|projects
+ const std::vector& segments() const { return segments_; }
+ // True when the name goes through a `locations/{l}` segment (either directly
+ // under the scope, or under a source).
+ bool has_location() const { return has_location_; }
+ // True when the last segment is `collection` (a parent names the scope, a
+ // resource name ends with collection/id).
+ bool ends_with_id_of(const std::string& collection) const;
+ bool names_collection(const std::string& collection) const;
+
+ // The declared row for a method tail such as "muteConfigs.get" or
+ // "sources.findings.setState"; nullptr when this scope/location has none.
+ const CallSpec* row(const std::string& tail) const;
+ // The rpc id this name would use for the tail (not checked against the table).
+ std::string rpc_for(const std::string& tail) const;
+
+ private:
+ std::string full_, kind_;
+ std::vector segments_;
+ bool has_location_ = false;
+};
+
+} // namespace molo::google::armor
diff --git a/src/google/armor/security_admin.cpp b/src/google/armor/security_admin.cpp
new file mode 100644
index 0000000..c0e1893
--- /dev/null
+++ b/src/google/armor/security_admin.cpp
@@ -0,0 +1,439 @@
+#include "google/armor/security_admin.h"
+
+#include
+#include
+
+#include "clients/url.h"
+#include "google/armor/caps.h"
+#include "google/armor/findings.h"
+#include "google/errors.h"
+#include "google/resource.h"
+
+namespace molo::google::armor {
+
+using clients::body::Json;
+
+namespace {
+
+[[noreturn]] void bad(const std::string& m) { throw GoogleError::invalid(m); }
+
+std::set csv(const char* list, char sep = ',') {
+ std::set out;
+ std::string cur;
+ for (const char* p = list; *p; ++p) {
+ if (*p == sep) {
+ if (!cur.empty()) out.insert(cur);
+ cur.clear();
+ } else {
+ cur.push_back(*p);
+ }
+ }
+ if (!cur.empty()) out.insert(cur);
+ return out;
+}
+
+void check_mask(const CallSpec& row, const std::string& mask) {
+ if (mask.empty() || mask.size() > 256) bad("update_mask is required (max 256 characters)");
+ std::set roots = csv(row.fields);
+ std::size_t pos = 0;
+ while (pos <= mask.size()) {
+ std::size_t end = mask.find(',', pos);
+ if (end == std::string::npos) end = mask.size();
+ std::string path = mask.substr(pos, end - pos);
+ if (path.empty()) bad("update_mask has an empty path");
+ for (char c : path)
+ if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') ||
+ c == '_' || c == '.'))
+ bad("update_mask allows letters, digits, '_' and '.'");
+ // Security marks masks name map keys ("marks.k"); other masks name fields.
+ std::string root = path.substr(0, path.find('.'));
+ if (!roots.count(root)) bad("update_mask field not allowed for this call: " + path);
+ pos = end + 1;
+ }
+}
+
+void check_id(const std::string& id, const char* what) {
+ if (!valid_segment(id)) bad(std::string(what) + " must be 1-128 of A-Z a-z 0-9 . _ -");
+}
+
+const char* id_param(SccCollection c) {
+ switch (c) {
+ case SccCollection::kMuteConfigs: return "muteConfigId";
+ case SccCollection::kNotificationConfigs: return "configId";
+ case SccCollection::kBigQueryExports: return "bigQueryExportId";
+ }
+ return "muteConfigId";
+}
+
+} // namespace
+
+const char* scc_collection_name(SccCollection c) {
+ switch (c) {
+ case SccCollection::kMuteConfigs: return "muteConfigs";
+ case SccCollection::kNotificationConfigs: return "notificationConfigs";
+ case SccCollection::kBigQueryExports: return "bigQueryExports";
+ }
+ return "muteConfigs";
+}
+
+const char* finding_state_name(FindingState s) {
+ return s == FindingState::kActive ? "ACTIVE" : "INACTIVE";
+}
+
+const char* mute_value_name(MuteValue v) {
+ switch (v) {
+ case MuteValue::kMuted: return "MUTED";
+ case MuteValue::kUnmuted: return "UNMUTED";
+ case MuteValue::kUndefined: return "UNDEFINED";
+ }
+ return "UNDEFINED";
+}
+
+const char* availability_name(SccAvailability a) {
+ switch (a) {
+ case SccAvailability::kAvailable: return "available";
+ case SccAvailability::kNotActivated: return "not_activated";
+ case SccAvailability::kApiDisabled: return "api_disabled";
+ case SccAvailability::kDenied: return "denied";
+ case SccAvailability::kUnknown: return "unknown";
+ }
+ return "unknown";
+}
+
+Json SccList::to_json() const {
+ Json o = Json::object();
+ o.set("count", static_cast(items.as_array().size()));
+ o.set("pages", static_cast(pages));
+ o.set("truncated", truncated);
+ o.set("next_page_token", next_page_token);
+ o.set("items", items);
+ return o;
+}
+
+SecurityAdmin::SecurityAdmin(std::shared_ptr client)
+ : Service(std::move(client), SecurityFindings::endpoint()) {}
+
+namespace {
+
+struct Planned {
+ const CallSpec* row;
+ std::string path; // leading slash, no version, with query
+ clients::Method method;
+};
+
+Planned plan(const std::string& tail, const std::string& resource, const Json* body,
+ const std::map& query) {
+ SccName n = SccName::parse(resource);
+ const CallSpec* row = n.row(tail);
+ if (!row)
+ bad(tail + " is not available for " + n.kind() + (n.has_location() ? " with a location" : " without a location"));
+ std::set allowed = csv(row->query);
+ std::string q;
+ for (const auto& [k, v] : query) {
+ if (!allowed.count(k)) bad("query parameter " + k + " is not in " + row->rpc);
+ if (v.empty()) continue;
+ if (v.size() > 2048) bad("query value too long");
+ for (char c : v)
+ if (static_cast(c) < 0x20) bad("query value has control characters");
+ q += (q.empty() ? "?" : "&") + k + "=" + clients::Url::encode_component(v);
+ }
+ std::string request = row->request;
+ if (!request.empty()) {
+ if (!body || !body->is_object()) bad(std::string(row->rpc) + " needs a JSON object body");
+ std::set fields = csv(row->fields);
+ for (const auto& [k, v] : body->as_object()) {
+ (void)v;
+ if (!fields.count(k)) bad("field " + k + " is not part of " + request);
+ }
+ if (body->dump().size() > 256 * 1024) bad("request body over 256 KiB");
+ } else if (body) {
+ bad(std::string(row->rpc) + " takes no body");
+ }
+ // Discovery path "v2/{+parent}/muteConfigs": drop the version, fill the one variable.
+ std::string tmpl = row->path;
+ tmpl.erase(0, tmpl.find('/'));
+ std::size_t open = tmpl.find('{'), close = tmpl.find('}');
+ if (open == std::string::npos || close == std::string::npos) bad("bad row path");
+ std::string path = tmpl.substr(0, open) + n.str() + tmpl.substr(close + 1) + q;
+ std::string verb = row->http;
+ clients::Method m = verb == "POST" ? clients::Method::kPost
+ : verb == "PATCH" ? clients::Method::kPatch
+ : verb == "DELETE" ? clients::Method::kDelete
+ : clients::Method::kGet;
+ return {row, path, m};
+}
+
+} // namespace
+
+Json SecurityAdmin::run(const std::string& tail, const std::string& resource, const Json* body,
+ const std::map& query) const {
+ Planned p = plan(tail, resource, body, query);
+ Json empty = Json::object();
+ const Json* send = body;
+ if (!send && p.method == clients::Method::kPost) send = ∅ // cancel and friends
+ return client_->request(p.method, endpoint_, p.path, send);
+}
+
+std::string SecurityAdmin::describe(const std::string& tail, const std::string& resource,
+ const std::map& query) const {
+ Json empty = Json::object();
+ // Describing a call with a body still validates the body shape: use {} and
+ // let callers that need fields pass them through run().
+ Planned p = [&] {
+ try {
+ return plan(tail, resource, nullptr, query);
+ } catch (const GoogleError&) {
+ return plan(tail, resource, &empty, query);
+ }
+ }();
+ return std::string(p.row->http) + " " + p.path;
+}
+
+void SecurityAdmin::expect_name(const SccName& n, const std::string& collection, bool resource) {
+ if (resource) {
+ if (!n.ends_with_id_of(collection)) bad("name must end with /" + collection + "/{id}");
+ } else if (n.names_collection(collection)) {
+ bad("parent must not include /" + collection);
+ }
+}
+
+SccList SecurityAdmin::list_all_pages(const std::string& tail, const std::string& parent,
+ const std::string& items_key) const {
+ SccList out;
+ std::string token;
+ while (true) {
+ std::map q = {{"pageSize", std::to_string(ArmorCaps::kMaxTemplatePageSize)}};
+ if (!token.empty()) q["pageToken"] = token;
+ Json reply = run(tail, parent, nullptr, q);
+ ++out.pages;
+ if (const Json* arr = reply.is_object() ? reply.find(items_key) : nullptr; arr && arr->is_array())
+ for (const Json& item : arr->as_array()) {
+ if (out.items.as_array().size() >= ArmorCaps::kMaxFindings) {
+ out.truncated = true;
+ return out;
+ }
+ out.items.push(item);
+ }
+ const Json* next = reply.is_object() ? reply.find("nextPageToken") : nullptr;
+ token = next && next->is_string() ? next->as_string() : "";
+ if (token.empty()) return out;
+ if (out.pages >= ArmorCaps::kMaxFindingPages) {
+ out.truncated = true;
+ out.next_page_token = token;
+ return out;
+ }
+ }
+}
+
+// ---- Configs
+
+SccList SecurityAdmin::list_configs(SccCollection c, const std::string& parent) const {
+ expect_name(SccName::parse(parent), scc_collection_name(c), false);
+ return list_all_pages(std::string(scc_collection_name(c)) + ".list", parent,
+ scc_collection_name(c));
+}
+
+Json SecurityAdmin::get_config(SccCollection c, const std::string& name) const {
+ expect_name(SccName::parse(name), scc_collection_name(c), true);
+ return run(std::string(scc_collection_name(c)) + ".get", name);
+}
+
+Json SecurityAdmin::create_config(SccCollection c, const std::string& parent,
+ const std::string& id, const Json& body) const {
+ check_id(id, "config id");
+ expect_name(SccName::parse(parent), scc_collection_name(c), false);
+ return run(std::string(scc_collection_name(c)) + ".create", parent, &body,
+ {{id_param(c), id}});
+}
+
+Json SecurityAdmin::update_config(SccCollection c, const std::string& name, const Json& body,
+ const std::string& update_mask) const {
+ SccName n = SccName::parse(name);
+ expect_name(n, scc_collection_name(c), true);
+ std::string tail = std::string(scc_collection_name(c)) + ".patch";
+ if (const CallSpec* row = n.row(tail)) check_mask(*row, update_mask);
+ return run(tail, name, &body, {{"updateMask", update_mask}});
+}
+
+void SecurityAdmin::delete_config(SccCollection c, const std::string& name) const {
+ expect_name(SccName::parse(name), scc_collection_name(c), true);
+ run(std::string(scc_collection_name(c)) + ".delete", name);
+}
+
+// ---- Findings
+
+Json SecurityAdmin::set_finding_state(const std::string& finding, FindingState state) const {
+ expect_name(SccName::parse(finding), "findings", true);
+ Json body = Json::object();
+ body.set("state", finding_state_name(state));
+ return run("sources.findings.setState", finding, &body);
+}
+
+Json SecurityAdmin::set_finding_mute(const std::string& finding, MuteValue mute) const {
+ expect_name(SccName::parse(finding), "findings", true);
+ Json body = Json::object();
+ body.set("mute", mute_value_name(mute));
+ return run("sources.findings.setMute", finding, &body);
+}
+
+Json SecurityAdmin::patch_finding(const std::string& finding, const Json& body,
+ const std::string& update_mask) const {
+ SccName n = SccName::parse(finding);
+ expect_name(n, "findings", true);
+ if (const CallSpec* row = n.row("sources.findings.patch")) check_mask(*row, update_mask);
+ return run("sources.findings.patch", finding, &body, {{"updateMask", update_mask}});
+}
+
+Json SecurityAdmin::update_finding_marks(const std::string& finding, const Json& marks,
+ const std::string& update_mask) const {
+ SccName n = SccName::parse(finding);
+ expect_name(n, "findings", true);
+ // The resource is ".../findings/{f}" and the call patches its securityMarks.
+ if (const CallSpec* row = n.row("sources.findings.updateSecurityMarks")) check_mask(*row, update_mask);
+ return run("sources.findings.updateSecurityMarks", finding + "/securityMarks", &marks,
+ {{"updateMask", update_mask}});
+}
+
+Json SecurityAdmin::create_finding(const std::string& source, const std::string& finding_id,
+ const Json& body) const {
+ check_id(finding_id, "finding id");
+ expect_name(SccName::parse(source), "findings", false);
+ return run("sources.findings.create", source, &body, {{"findingId", finding_id}});
+}
+
+Json SecurityAdmin::patch_external_system(const std::string& external_system, const Json& body,
+ const std::string& update_mask) const {
+ SccName n = SccName::parse(external_system);
+ expect_name(n, "externalSystems", true);
+ if (const CallSpec* row = n.row("sources.findings.externalSystems.patch")) check_mask(*row, update_mask);
+ return run("sources.findings.externalSystems.patch", external_system, &body,
+ {{"updateMask", update_mask}});
+}
+
+Operation SecurityAdmin::bulk_mute(const std::string& parent, const std::string& filter,
+ BulkMuteValue value) const {
+ if (filter.empty() || filter.size() > ArmorCaps::kMaxFilterValueChars * 4)
+ bad("bulk mute needs a filter (1.." + std::to_string(ArmorCaps::kMaxFilterValueChars * 4) +
+ " characters); it never mutes everything");
+ expect_name(SccName::parse(parent), "findings", false);
+ Json body = Json::object();
+ body.set("filter", filter);
+ body.set("muteState", value == BulkMuteValue::kMuted ? "MUTED" : "UNDEFINED");
+ return Operation::from_json(run("findings.bulkMute", parent, &body));
+}
+
+Operation SecurityAdmin::export_findings(const std::string& source, const Json& body) const {
+ SccName n = SccName::parse(source);
+ if (!n.has_location()) bad("findings:export needs a source under a location");
+ return Operation::from_json(run("sources.findings.export", source, &body));
+}
+
+// ---- Sources
+
+Json SecurityAdmin::create_source(const std::string& organization, const Json& body) const {
+ SccName n = SccName::parse(organization);
+ if (n.kind() != "organizations" || n.segments().size() != 2)
+ bad("sources are created under organizations/{id}");
+ return run("sources.create", organization, &body);
+}
+
+Json SecurityAdmin::update_source(const std::string& source, const Json& body,
+ const std::string& update_mask) const {
+ SccName n = SccName::parse(source);
+ expect_name(n, "sources", true);
+ if (const CallSpec* row = n.row("sources.patch")) check_mask(*row, update_mask);
+ return run("sources.patch", source, &body, {{"updateMask", update_mask}});
+}
+
+Json SecurityAdmin::source_iam_policy(const std::string& source) const {
+ expect_name(SccName::parse(source), "sources", true);
+ Json body = Json::object();
+ return run("sources.getIamPolicy", source, &body);
+}
+
+Json SecurityAdmin::set_source_iam_policy(const std::string& source, const Json& policy) const {
+ expect_name(SccName::parse(source), "sources", true);
+ if (!policy.is_object()) bad("policy must be a JSON object");
+ source_iam_policy(source); // Read first.
+ Json body = Json::object();
+ body.set("policy", policy);
+ return run("sources.setIamPolicy", source, &body);
+}
+
+Json SecurityAdmin::test_source_iam(const std::string& source,
+ const std::vector& permissions) const {
+ expect_name(SccName::parse(source), "sources", true);
+ if (permissions.empty() || permissions.size() > 64) bad("1..64 permissions");
+ Json arr = Json::array();
+ for (const std::string& p : permissions) {
+ if (p.empty() || p.size() > 256) bad("permission empty or over 256 characters");
+ arr.push(p);
+ }
+ Json body = Json::object();
+ body.set("permissions", arr);
+ return run("sources.testIamPermissions", source, &body);
+}
+
+Json SecurityAdmin::update_asset_marks(const std::string& marks_name, const Json& marks,
+ const std::string& update_mask) const {
+ SccName n = SccName::parse(marks_name);
+ if (!n.names_collection("assets") || marks_name.size() < 14 ||
+ marks_name.compare(marks_name.size() - 14, 14, "/securityMarks") != 0)
+ bad("name must be {scope}/assets/{id}/securityMarks");
+ if (const CallSpec* row = n.row("assets.updateSecurityMarks")) check_mask(*row, update_mask);
+ return run("assets.updateSecurityMarks", marks_name, &marks, {{"updateMask", update_mask}});
+}
+
+// ---- Operations
+
+Json SecurityAdmin::get_operation(const std::string& name) const {
+ if (!SccName::parse(name).ends_with_id_of("operations")) bad("name must be organizations/{id}/operations/{op}");
+ return run("operations.get", name);
+}
+
+SccList SecurityAdmin::list_operations(const std::string& organization) const {
+ // Discovery: operations.list takes the collection name itself as {+name}.
+ SccName n = SccName::parse(organization);
+ if (n.kind() != "organizations" || n.segments().size() != 2)
+ bad("operations are listed under organizations/{id}");
+ return list_all_pages("operations.list", organization + "/operations", "operations");
+}
+
+void SecurityAdmin::cancel_operation(const std::string& name) const {
+ get_operation(name); // Read first: a missing operation is a clear 404.
+ run("operations.cancel", name);
+}
+
+void SecurityAdmin::delete_operation(const std::string& name) const {
+ get_operation(name);
+ run("operations.delete", name);
+}
+
+Operation SecurityAdmin::wait_operation_done(const std::string& name) const {
+ if (!SccName::parse(name).ends_with_id_of("operations")) bad("name must be organizations/{id}/operations/{op}");
+ return google::wait_operation(*client_, endpoint_, name);
+}
+
+// ---- Probe
+
+SccAvailability SecurityAdmin::availability(const std::string& scope) const {
+ SccName n = SccName::parse(scope);
+ if (n.segments().size() != 2) bad("scope must be organizations/{id}, folders/{id} or projects/{id}");
+ try {
+ run("sources.list", scope, nullptr, {{"pageSize", "1"}});
+ return SccAvailability::kAvailable;
+ } catch (const NotConfiguredError&) {
+ throw;
+ } catch (const GoogleError& e) {
+ if (e.service().empty() && e.status() == "INVALID_ARGUMENT") throw;
+ const std::string& m = e.message();
+ if (e.http_status() == 403 &&
+ (m.find("has not been used") != std::string::npos || m.find("disabled") != std::string::npos))
+ return SccAvailability::kApiDisabled;
+ if (e.http_status() == 403) return SccAvailability::kDenied;
+ if (e.http_status() == 404 || e.status() == "FAILED_PRECONDITION") return SccAvailability::kNotActivated;
+ return SccAvailability::kUnknown;
+ }
+}
+
+} // namespace molo::google::armor
diff --git a/src/google/armor/security_admin.h b/src/google/armor/security_admin.h
new file mode 100644
index 0000000..106d31d
--- /dev/null
+++ b/src/google/armor/security_admin.h
@@ -0,0 +1,131 @@
+#pragma once
+// Security Command Center v2 beyond reading findings: mute configs,
+// notification configs, BigQuery exports, finding state/mute/marks, bulk
+// mute, findings export, sources, asset marks, source IAM and organization
+// operations. Every method is a row of the call table in calls.h, picked by
+// SccName from the resource it is given; query parameters and top-level body
+// fields are checked against the row before any traffic. Every mutation is an
+// explicit method. Lists report truncation in their result type.
+// Out of scope on purpose (calls.h / tools/check_discovery.py): the attack
+// exposure engine (attack paths, valued resources, simulations, resource value
+// configs), which is cloud posture risk scoring and not agent security.
+#include