Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
374c3bc
chore: add CDK for basic CI resources
kessplas Aug 6, 2025
df36ec1
add basic S3EC implementation
kessplas Aug 6, 2025
62edf8a
include decryptionMaterials change
kessplas Aug 6, 2025
d4baef1
add Github workflows
kessplas Aug 6, 2025
fae5819
permissions
kessplas Aug 6, 2025
99c9591
fix test
kessplas Aug 6, 2025
52dc9ab
fix region
kessplas Aug 6, 2025
61096c6
debug
kessplas Aug 6, 2025
23362e3
or dict
kessplas Aug 6, 2025
8c76a5b
debug
kessplas Aug 6, 2025
24bcb48
github env vars
kessplas Aug 6, 2025
ef416de
vars not secrets
kessplas Aug 6, 2025
480a398
remove debug, raise error on mismatch
kessplas Aug 6, 2025
21b5906
run formatter, add linting
kessplas Aug 7, 2025
454c0eb
address feedback (ruff, uv, etc)
kessplas Aug 11, 2025
351431a
GHA stuff
kessplas Aug 11, 2025
c15f2da
uv venv
kessplas Aug 11, 2025
5e3f122
black
kessplas Aug 11, 2025
dac7ab7
only ruff, remove isort
kessplas Aug 11, 2025
3cd450b
use makefile
kessplas Aug 11, 2025
be51b70
fix CI
kessplas Aug 11, 2025
8bbae1a
split out integ tests
kessplas Aug 11, 2025
090c8a4
match boto3, use abc
kessplas Aug 11, 2025
15d2144
snake case renaming
kessplas Aug 11, 2025
cac76ce
format
kessplas Aug 11, 2025
f231ab2
remove lock file, format, simplify attrs
kessplas Aug 11, 2025
2d686bc
remove typehint
kessplas Aug 11, 2025
aed461e
use pytest
kessplas Aug 11, 2025
2f6bc1e
remove uv lock
kessplas Aug 11, 2025
fa000a5
ruff fixes
kessplas Aug 12, 2025
6c0b92a
enforce ruff for src
kessplas Aug 12, 2025
bee9218
now fix black
kessplas Aug 12, 2025
4b5ab01
empty body plus tests
kessplas Aug 12, 2025
c440af4
fix type hints
kessplas Aug 12, 2025
d113d54
try client type hint again
kessplas Aug 12, 2025
a73d544
PDK to plaintext_data_key
kessplas Aug 12, 2025
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
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint

on:
push:
branches: [ main ]
workflow_call:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Uv
run: pip install uv

- name: Install dependencies and run linting
run: |
make install
make lint
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Main Workflow

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:
inputs:
python-version:
description: 'Python version to use'
default: '3.11'
required: false
type: string

jobs:
lint:
name: Lint
uses: ./.github/workflows/lint.yml

run-tests:
name: Run Tests
uses: ./.github/workflows/test.yml
with:
python-version: ${{ inputs.python-version || '3.11' }}
secrets: inherit
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Run Tests

on:
workflow_call:
# Optional inputs that can be provided when calling this workflow
inputs:
python-version:
description: 'Python version to use'
default: '3.11'
required: false
type: string

jobs:
test:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version || '3.11' }}

- name: Install Uv
run: pip install uv

- name: Install dependencies
run: make install

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::370957321024:role/S3EC-Python-Github-test-role
aws-region: us-west-2

- name: Run unit tests
run: make test-unit

- name: Run integration tests
run: make test-integration
env:
CI_S3_BUCKET: ${{ vars.CI_S3_BUCKET }}
CI_KMS_KEY_ALIAS: ${{ vars.CI_KMS_KEY_ALIAS }}
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.idea
.vscode
# Exclude all pycache directories and bytecode
__pycache__/
*.pyc
*.pyo
*.pyd

# Distribution / packaging
dist/
build/
*.egg-info/

# Uv
.uv/
uv.lock
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.PHONY: lint format test test-unit test-integration install

# Default target
all: lint test

# Install dependencies
install:
uv venv
uv pip install -e ".[dev,test]"

# Run linting checks
lint:
uv run black --check .
# Enforce ruff checks on src/ but allow test/ to fail
uv run ruff check src/
uv run ruff check test/ || true

# Format code with Black and Ruff
format:
uv run black .
uv run ruff check --fix src/ test/

# Run all tests
test: test-unit test-integration

# Run unit tests
test-unit:
uv run pytest test/ --ignore=test/integration/ --verbose

# Run integration tests
test-integration:
uv run pytest test/integration/ --verbose

# Clean up cache files
clean:
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type d -name .pytest_cache -exec rm -rf {} +
find . -type d -name .coverage -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
76 changes: 67 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,75 @@
## My Project
# Amazon S3 Encryption Client Python

TODO: Fill this README out!
This library provides an S3 client that supports client-side encryption.

Be sure to:
## Development

* Change the title in this README
* Edit your repository description on GitHub
### Prerequisites

## Security
- Python 3.11 or higher
- [Poetry](https://python-poetry.org/) for dependency management

See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
### Setup

## License
Install dependencies:

This project is licensed under the Apache-2.0 License.
```bash
make install
```

### Testing

Run all tests:

```bash
make test
```

Run unit tests only:

```bash
make test-unit
```

Run integration tests only:

```bash
make test-integration
```

### Code Quality

This project uses [Black](https://black.readthedocs.io/) for code formatting, [isort](https://pycqa.github.io/isort/) for import sorting, and [Flake8](https://flake8.pycqa.org/) for linting.

Check code quality:

```bash
make lint
```

Format code with Black and isort:

```bash
make format
```

Clean up cache files:

```bash
make clean
```

#### Linting Standards

The project is configured with Black, isort, and Flake8 to enforce consistent code style and quality. Currently, Flake8 is set to report issues but not fail the build, allowing for gradual adoption of linting standards.

Common Flake8 issues in the codebase include:

- **Missing docstrings** (D100-D104): Add docstrings to modules, classes, and functions
- **Docstring formatting** (D200, D212, D415): Follow Google docstring style
- **Line length** (E501): Keep lines under 100 characters
- **Unused imports** (F401): Remove unused imports
- **Unused variables** (F841): Remove or use assigned variables
- **Code complexity** (C901): Refactor complex functions

When contributing to this project, please try to fix linting issues in the files you modify.
29 changes: 29 additions & 0 deletions SUPPORT_POLICY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Overview
========
This page describes the support policy for the Amazon S3 Encryption Client. We regularly provide the Amazon S3 Encryption Client with updates that may contain support for new or updated APIs, new features, enhancements, bug fixes, security patches, or documentation updates. Updates may also address changes with dependencies, language runtimes, and operating systems.

We recommend users to stay up-to-date with Amazon S3 Encryption Client releases to keep up with the latest features, security updates, and underlying dependencies. Continued use of an unsupported client version is not recommended and is done at the user’s discretion


Major Version Lifecycle
========================
The Amazon S3 Encryption Client follows the same major version lifecycle as the AWS SDK. For details on this lifecycle, see `AWS SDKs and Tools Maintenance Policy`_.

Version Support Matrix
======================
This table describes the current support status of each major version of the Amazon S3 Encryption Client for Python. It also shows the next status each major version will transition to, and the date at which that transition will happen.

.. list-table::
:widths: 30 50 50 50
:header-rows: 1

* - Major version
- Current status
- Next status
- Next status date
* - 3.x
- Pre-Release
- Generally Available
-

.. _AWS SDKs and Tools Maintenance Policy: https://docs.aws.amazon.com/sdkref/latest/guide/maint-policy.html#version-life-cycle
8 changes: 8 additions & 0 deletions cdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.js
!jest.config.js
*.d.ts
node_modules

# CDK asset staging directory
.cdk.staging
cdk.out
6 changes: 6 additions & 0 deletions cdk/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
14 changes: 14 additions & 0 deletions cdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npm run test` perform the jest unit tests
* `cdk deploy` deploy this stack to your default AWS account/region
* `cdk diff` compare deployed stack with current state
* `cdk synth` emits the synthesized CloudFormation template
57 changes: 57 additions & 0 deletions cdk/cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"app": "npx ts-node --prefer-ts-exts bin/cdk.ts",
"watch": {
"include": [
"**"
],
"exclude": [
"README.md",
"cdk*.json",
"**/*.d.ts",
"**/*.js",
"tsconfig.json",
"package*.json",
"yarn.lock",
"node_modules",
"test"
]
},
"context": {
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
"@aws-cdk/core:checkSecretUsage": true,
"@aws-cdk/core:target-partitions": [
"aws",
"aws-cn"
],
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
"@aws-cdk/aws-iam:minimizePolicies": true,
"@aws-cdk/core:validateSnapshotRemovalPolicy": true,
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true,
"@aws-cdk/core:enablePartitionLiterals": true,
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
"@aws-cdk/aws-iam:standardizedServicePrincipals": true,
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
"@aws-cdk/aws-route53-patters:useCertificate": true,
"@aws-cdk/customresources:installLatestAwsSdkDefault": false,
"@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true,
"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true,
"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true,
"@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true,
"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true,
"@aws-cdk/aws-redshift:columnId": true,
"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true,
"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true,
"@aws-cdk/aws-apigateway:requestValidatorUniqueId": true,
"@aws-cdk/aws-kms:aliasNameRef": true,
"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true,
"@aws-cdk/core:includePrefixInUniqueNameGeneration": true,
"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true
}
}
8 changes: 8 additions & 0 deletions cdk/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/test'],
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.tsx?$': 'ts-jest'
}
};
Loading