-
Notifications
You must be signed in to change notification settings - Fork 103
feat(auth): implement SigV4 authentication for REST catalog #616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e15a318
038ca1b
914a1da
c29da25
438575d
c6c5223
db9620a
dd22630
03bdda1
9140e2b
205f2db
4872fc8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you 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. | ||
|
|
||
| # SigV4 build + unit tests (Linux only; aws-cpp-sdk-core via vcpkg). | ||
| name: SigV4 Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - '**' | ||
| - '!dependabot/**' | ||
| tags: | ||
| - '**' | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| ICEBERG_HOME: /tmp/iceberg | ||
|
|
||
| jobs: | ||
| sigv4: | ||
| name: SigV4 (AMD64 Ubuntu 24.04) | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 35 | ||
| env: | ||
| CC: gcc-14 | ||
| CXX: g++-14 | ||
| AWS_EC2_METADATA_DISABLED: "TRUE" | ||
| steps: | ||
| - name: Checkout iceberg-cpp | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Install dependencies | ||
| shell: bash | ||
| run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev | ||
| - name: Cache vcpkg packages | ||
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | ||
| id: vcpkg-cache | ||
| with: | ||
| path: /usr/local/share/vcpkg/installed | ||
| key: vcpkg-x64-linux-aws-sdk-cpp-core-${{ hashFiles('.github/workflows/sigv4_test.yml') }} | ||
| - name: Install AWS SDK via vcpkg | ||
| if: steps.vcpkg-cache.outputs.cache-hit != 'true' | ||
| shell: bash | ||
| run: vcpkg install aws-sdk-cpp[core]:x64-linux | ||
| - name: Build and test Iceberg with SigV4 | ||
| shell: bash | ||
| env: | ||
| CMAKE_TOOLCHAIN_FILE: /usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
| run: ci/scripts/build_iceberg.sh "$(pwd)" OFF OFF OFF ON |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,8 @@ set(ICEBERG_REST_SOURCES | |
| rest_util.cc | ||
| types.cc) | ||
|
|
||
| list(APPEND ICEBERG_REST_SOURCES auth/sigv4_auth_manager.cc) | ||
|
|
||
| set(ICEBERG_REST_STATIC_BUILD_INTERFACE_LIBS) | ||
| set(ICEBERG_REST_SHARED_BUILD_INTERFACE_LIBS) | ||
| set(ICEBERG_REST_STATIC_INSTALL_INTERFACE_LIBS) | ||
|
|
@@ -52,6 +54,13 @@ list(APPEND | |
| "$<IF:$<TARGET_EXISTS:iceberg::iceberg_shared>,iceberg::iceberg_shared,iceberg::iceberg_static>" | ||
| "$<IF:$<BOOL:${CPR_VENDORED}>,iceberg::cpr,cpr::cpr>") | ||
|
|
||
| if(ICEBERG_SIGV4) | ||
| list(APPEND ICEBERG_REST_STATIC_BUILD_INTERFACE_LIBS aws-cpp-sdk-core) | ||
| list(APPEND ICEBERG_REST_SHARED_BUILD_INTERFACE_LIBS aws-cpp-sdk-core) | ||
| list(APPEND ICEBERG_REST_STATIC_INSTALL_INTERFACE_LIBS aws-cpp-sdk-core) | ||
| list(APPEND ICEBERG_REST_SHARED_INSTALL_INTERFACE_LIBS aws-cpp-sdk-core) | ||
| endif() | ||
|
|
||
| add_iceberg_lib(iceberg_rest | ||
| SOURCES | ||
| ${ICEBERG_REST_SOURCES} | ||
|
|
@@ -64,4 +73,12 @@ add_iceberg_lib(iceberg_rest | |
| SHARED_INSTALL_INTERFACE_LIBS | ||
| ${ICEBERG_REST_SHARED_INSTALL_INTERFACE_LIBS}) | ||
|
|
||
| if(ICEBERG_SIGV4) | ||
| foreach(LIB iceberg_rest_static iceberg_rest_shared) | ||
| if(TARGET ${LIB}) | ||
| target_compile_definitions(${LIB} PUBLIC ICEBERG_SIGV4) | ||
| endif() | ||
| endforeach() | ||
| endif() | ||
|
|
||
| iceberg_install_all_headers(iceberg/catalog/rest) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,4 +47,10 @@ Result<std::unique_ptr<AuthManager>> MakeOAuth2Manager( | |
| std::string_view name, | ||
| const std::unordered_map<std::string, std::string>& properties); | ||
|
|
||
| /// \brief Create a SigV4 authentication manager with a delegate. Returns | ||
| /// NotSupported when the library was built without ICEBERG_SIGV4. | ||
| Result<std::unique_ptr<AuthManager>> MakeSigV4AuthManager( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is the definition? BTW, we don't need to use macro |
||
| std::string_view name, | ||
| const std::unordered_map<std::string, std::string>& properties); | ||
|
|
||
| } // namespace iceberg::rest::auth | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,10 +54,14 @@ class ICEBERG_REST_EXPORT AuthProperties : public ConfigBase<AuthProperties> { | |
|
|
||
| // ---- SigV4 entries ---- | ||
|
|
||
| inline static const std::string kSigV4Region = "rest.auth.sigv4.region"; | ||
| inline static const std::string kSigV4Service = "rest.auth.sigv4.service"; | ||
| inline static const std::string kSigV4DelegateAuthType = | ||
| "rest.auth.sigv4.delegate-auth-type"; | ||
| inline static const std::string kSigV4SigningRegion = "rest.signing-region"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove the legacy key kSigV4Region/kSigV4Service
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| inline static const std::string kSigV4SigningName = "rest.signing-name"; | ||
| inline static const std::string kSigV4SigningNameDefault = "execute-api"; | ||
| inline static const std::string kSigV4AccessKeyId = "rest.access-key-id"; | ||
| inline static const std::string kSigV4SecretAccessKey = "rest.secret-access-key"; | ||
| inline static const std::string kSigV4SessionToken = "rest.session-token"; | ||
|
|
||
| // ---- OAuth2 entries ---- | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it records only AWSSDK for installed-package dependency discovery, while src/iceberg/catalog/rest/CMakeLists.txt exports
aws-cpp-sdk-corein the REST install interface. The generated iceberg-config.cmake can only call find_dependency(AWSSDK) without COMPONENTS core, but AWS SDK’s CMake config loads component packages from AWSSDK_FIND_COMPONENTS. A downstream installed SigV4 build can therefore fail to find/link AWS core unless it happens to be on the default linker path.I'd suggest to special-case find_dependency(AWSSDK COMPONENTS core) in the iceberg-config.cmake.in or otherwise export the AWS SDK dependency component-aware.