No public description PiperOrigin-RevId: 859579516
diff --git a/sandbox/sandbox.h b/sandbox/sandbox.h index 9896b34..23644aa 100644 --- a/sandbox/sandbox.h +++ b/sandbox/sandbox.h
@@ -6,7 +6,9 @@ #include <utility> #include "third_party/hunspell/sandbox/sandboxed_hunspell.sapi.h" +#include "third_party/sandboxed_api/sandbox.h" #include "third_party/sandboxed_api/sandbox2/policy.h" +#include "third_party/sandboxed_api/sandbox2/policybuilder.h" namespace sandboxed_hunspell { @@ -14,19 +16,20 @@ public: explicit LibHunspellSapiSandbox(std::string affix_file_name, std::string dictionary_file_name) - : affix_file_name_(std::move(affix_file_name)), - dictionary_file_name_(std::move(dictionary_file_name)) {} + : LibHunspellSandbox( + CreateConfig(affix_file_name, dictionary_file_name)) {} private: - std::unique_ptr<sandbox2::Policy> ModifyPolicy( - sandbox2::PolicyBuilder* builder) override { - return builder->AddFile(affix_file_name_, /*is_ro=*/true) - .AddFile(dictionary_file_name_, /*is_ro=*/true) - .BuildOrDie(); + static sapi::SandboxConfig CreateConfig( + const std::string& affix_file_name, + const std::string& dictionary_file_name) { + return {.sandbox2 = { + .policy = sapi::Sandbox2Config::DefaultPolicyBuilder() + .AddFile(affix_file_name, /*is_ro=*/true) + .AddFile(dictionary_file_name, /*is_ro=*/true) + .BuildOrDie(), + }}; } - - std::string affix_file_name_; - std::string dictionary_file_name_; }; } // namespace sandboxed_hunspell