From 09f7b23aed12a84b2c0a88bb1085b0a024e47594 Mon Sep 17 00:00:00 2001 From: FHIR Team Date: Mon, 1 Jun 2026 02:29:59 -0700 Subject: [PATCH] None PiperOrigin-RevId: 924576836 --- cc/google/fhir/BUILD | 3 +++ .../fhir/allow_unsandboxed_fhir_package.cc | 23 +++++++++++++++++++ cc/google/fhir/fhir_package.cc | 4 +--- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 cc/google/fhir/allow_unsandboxed_fhir_package.cc diff --git a/cc/google/fhir/BUILD b/cc/google/fhir/BUILD index 99fffe63f03..aa1bbb7cb2c 100644 --- a/cc/google/fhir/BUILD +++ b/cc/google/fhir/BUILD @@ -597,6 +597,9 @@ cc_library( name = "fhir_package", srcs = ["fhir_package.cc"], hdrs = ["fhir_package.h"], + local_defines = select({ + "//conditions:default": [], + }), strip_include_prefix = "//cc/", deps = [ ":error_reporter", diff --git a/cc/google/fhir/allow_unsandboxed_fhir_package.cc b/cc/google/fhir/allow_unsandboxed_fhir_package.cc new file mode 100644 index 00000000000..1caf866649e --- /dev/null +++ b/cc/google/fhir/allow_unsandboxed_fhir_package.cc @@ -0,0 +1,23 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// NOLINTBEGIN(whitespace/line_length) +// Definition of the poison symbol required to link fhir_package in unsandboxed +// mode. This is restricted to allowed unsandboxed users to prevent accidental +// backsliding. + +extern "C" int + DO_NOT_OVERWRITE____FHIR_PACKAGE_UNSANDBOXED_USE_REQUIRES_APPROVAL____SEE_cl_924576836 = + 1; +// NOLINTEND(whitespace/line_length) diff --git a/cc/google/fhir/fhir_package.cc b/cc/google/fhir/fhir_package.cc index 49fef53839b..b230810cd47 100644 --- a/cc/google/fhir/fhir_package.cc +++ b/cc/google/fhir/fhir_package.cc @@ -130,9 +130,7 @@ absl::Status MaybeAddEntryToFhirPackage(absl::string_view entry_name, fhir_package); } -// Opens the archive for reading at `archive_file_path` and returns a unique -// pointer to the archive. The unique pointer will close and free the archive -// when it is destructed. +// Unsandboxed Implementation absl::StatusOr> OpenArchive(absl::string_view archive_file_path) { // archive_read_free itself calls archive_read_close, so no further cleanup is