Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
lint:
runs-on: ubuntu-latest
runs-on: macos-13

steps:
- name: Checkout code
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: macos-13
permissions:
id-token: write
contents: read
Expand Down Expand Up @@ -50,6 +50,11 @@ jobs:
shell: bash
run: composer install

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.25

# Cache uv dependencies
- name: Cache uv dependencies
uses: actions/cache@v3
Expand Down
39 changes: 39 additions & 0 deletions test-server/cpp-v2-server/CMakeLists.txt
Comment thread
ajewellamz marked this conversation as resolved.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code works well overall, but the main things to watch out for are thread safety with client_cache and the manual new/delete handling.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.16)
project(s3ec-cpp-v2-server)

set(CMAKE_CXX_STANDARD 17)

# Configure AWS SDK build options
set(BUILD_ONLY "kms;s3;s3-encryption" CACHE STRING "Build only KMS, S3, and S3-encryption components")
set(ENABLE_TESTING OFF CACHE BOOL "Disable testing")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries")

# Add AWS SDK as subdirectory
add_subdirectory(aws-sdk-cpp)

find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBMICROHTTPD REQUIRED libmicrohttpd)

find_package(nlohmann_json REQUIRED)

add_executable(s3ec-server main.cpp)

target_include_directories(s3ec-server PRIVATE
${LIBMICROHTTPD_INCLUDE_DIRS}
/opt/homebrew/include
)

target_link_directories(s3ec-server PRIVATE
${LIBMICROHTTPD_LIBRARY_DIRS}
/opt/homebrew/lib
)

target_link_libraries(s3ec-server
${LIBMICROHTTPD_LIBRARIES}
aws-cpp-sdk-core
aws-cpp-sdk-kms
aws-cpp-sdk-s3
aws-cpp-sdk-s3-encryption
nlohmann_json::nlohmann_json
uuid
)
31 changes: 31 additions & 0 deletions test-server/cpp-v2-server/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Makefile for S3 Encryption Client Testing

.PHONY: start-server stop-server wait-for-server

PID_FILE := server.pid
PORT := 8085

build/s3ec-server:
brew install libmicrohttpd nlohmann-json ossp-uuid
git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp.git
cd aws-sdk-cpp && git checkout --track remotes/origin/ajewell/ec-for-get-object
mkdir -p build && cd build && cmake ..

start-server: | build/s3ec-server
@echo "Starting Cpp V2 server..."
cd build && make && \
AWS_ACCESS_KEY_ID="$$AWS_ACCESS_KEY_ID" \
AWS_SECRET_ACCESS_KEY="$$AWS_SECRET_ACCESS_KEY" \
AWS_SESSION_TOKEN="$$AWS_SESSION_TOKEN" \
AWS_REGION="us-west-2" \
./s3ec-server & echo $$! > $(PID_FILE)
@echo "Cpp V2 server starting..."

stop-server:
@if [ -f $(PID_FILE) ]; then \
kill $$(cat $(PID_FILE)) 2>/dev/null || true; \
rm $(PID_FILE); \
fi

wait-for-server:
$(MAKE) -C .. wait-for-port PORT=$(PORT)
37 changes: 37 additions & 0 deletions test-server/cpp-v2-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# C++ S3 Encryption Test Server

Minimal C++ implementation of the S3 Encryption test server.

## Dependencies

- libmicrohttpd
- AWS SDK for C++
- nlohmann/json
- uuid

On MacOS you can
```bash
brew install libmicrohttpd nlohmann-json ossp-uuid
```

## Build

```bash
mkdir build && cd build
cmake ..
make
```

## Run

```bash
./s3ec-server
```

Server runs on localhost:8085

## API Endpoints

- `POST /client` - Create S3 encryption client
- `GET /object/{bucket}/{key}` - Get encrypted object
- `PUT /object/{bucket}/{key}` - Put encrypted object
Loading
Loading