Skip to content

Commit 35bab7e

Browse files
authored
Merge pull request #58 from b-long/develop
Release 0.2.17
2 parents a015f9a + a5d9d0d commit 35bab7e

13 files changed

+97
-90
lines changed

.github/workflows/build-golang-macos.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
4848
# - uses: ./.github/workflows/platform-integration-test.yaml
4949
# with:
50-
# wheel: dist/otdf_python-0.2.16-py3-none-any.whl
50+
# wheel: dist/otdf_python-0.2.17-py3-none-any.whl

.github/workflows/build-golang-ubuntu.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343
4444
- uses: actions/cache/restore@v4
4545
with:
46-
path: dist/otdf_python-0.2.16-py3-none-any.whl
46+
path: dist/otdf_python-0.2.17-py3-none-any.whl
4747
key: ${{ runner.os }}${{ matrix.python3_version }}-data-${{ github.sha }}
4848

4949
- uses: actions/cache/save@v4
5050
with:
51-
path: dist/otdf_python-0.2.16-py3-none-any.whl
51+
path: dist/otdf_python-0.2.17-py3-none-any.whl
5252
key: ${{ runner.os }}${{ matrix.python3_version }}-data-${{ github.sha }}
5353
restore-keys: |
5454
${{ runner.os }}${{ matrix.python3_version }}-data-
@@ -61,5 +61,5 @@ jobs:
6161
needs: build
6262
uses: ./.github/workflows/platform-integration-test.yaml
6363
with:
64-
wheel: dist/otdf_python-0.2.16-py3-none-any.whl
64+
wheel: dist/otdf_python-0.2.17-py3-none-any.whl
6565
python_version: ${{ matrix.python3_version }}

.github/workflows/platform-integration-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
- uses: actions/cache/restore@v4
3131
with:
32-
path: dist/otdf_python-0.2.16-py3-none-any.whl
32+
path: dist/otdf_python-0.2.17-py3-none-any.whl
3333
key: ${{ runner.os }}${{ inputs.python_version }}-data-${{ github.sha }}
3434

3535
- name: Prove that the input file is available

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ Install from the [Python Package Index (PyPI)](https://pypi.org):
2727
pip install otdf_python
2828

2929
# Install a pinned version
30-
pip install otdf-python==0.2.16
30+
pip install otdf-python==0.2.17
3131

3232
# Install a pinned version, from test.pypi.org
33-
pip install -i https://test.pypi.org/simple/ otdf-python==0.2.16
33+
pip install -i https://test.pypi.org/simple/ otdf-python==0.2.17
3434
```
3535

3636
## Usage

build-scripts/ci-build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ echo "✨✨✨ Build wheel"
7272
poetry run python3 setup.py bdist_wheel
7373

7474
echo "✨✨✨ Install wheel"
75-
pip install dist/otdf_python-0.2.16-py3-none-any.whl
75+
pip install dist/otdf_python-0.2.17-py3-none-any.whl

build-scripts/make_and_validate_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ python3 -m pip install --upgrade setuptools wheel
4747
python3 setup.py bdist_wheel
4848

4949
# Prove that the wheel can be installed
50-
pip install dist/otdf_python-0.2.16-py3-none-any.whl
50+
pip install dist/otdf_python-0.2.17-py3-none-any.whl
5151

5252
if [[ "$SKIP_TESTS" == "-s" || "$SKIP_TESTS" == "--skip-tests" ]]; then
5353
echo "Build is complete, skipping tests."

build-scripts/uv_make_and_validate_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ loud_print "Installing wheel"
7070
uv venv .venv-wheel --python 3.12 "$PY_TYPE"
7171
source "${BUILD_ROOT}/.venv-wheel/bin/activate"
7272
pip install pybindgen
73-
pip install dist/otdf_python-0.2.16-py3-none-any.whl
73+
pip install dist/otdf_python-0.2.17-py3-none-any.whl
7474

7575
if [[ "$SKIP_TESTS" == "-s" || "$SKIP_TESTS" == "--skip-tests" ]]; then
7676
echo "Build is complete, skipping tests."

main.go

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ TODO: Consider testing against attributes that are returned by some listing.
1010
TODO: Consider exposing an sdkClient that can be returned to the caller
1111
* Note, previously this failed in a 'gopy' compiled context
1212
13-
TODO: Platform knows about the IdP, perhaps we don't need to specify the TOKEN_ENDPOINT ?
14-
1513
*/
1614
import (
1715
"bytes"
@@ -35,11 +33,12 @@ type TokenAuth struct {
3533
}
3634

3735
type OpentdfConfig struct {
38-
ClientId string
39-
ClientSecret string
40-
PlatformEndpoint string
41-
TokenEndpoint string
42-
KasUrl string
36+
ClientId string
37+
ClientSecret string
38+
PlatformEndpoint string
39+
TokenEndpoint string
40+
KasUrl string
41+
InsecureSkipVerify bool
4342
}
4443

4544
func getEnv(key, defaultValue string) string {
@@ -49,10 +48,6 @@ func getEnv(key, defaultValue string) string {
4948
return defaultValue
5049
}
5150

52-
/*
53-
NOTE: When the environment variable 'INSECURE_SKIP_VERIFY' is set to 'TRUE',
54-
this option for the OpenTDF SDK will be set.
55-
*/
5651
func newSdkClient(config OpentdfConfig, authScopes []string) (*sdk.SDK, error) {
5752
// NOTE: The 'platformEndpoint' is sometimes referenced as 'host'
5853
if strings.Count(config.TokenEndpoint, "http://") == 1 {
@@ -67,7 +62,7 @@ func newSdkClient(config OpentdfConfig, authScopes []string) (*sdk.SDK, error) {
6762
sdk.WithTokenEndpoint(config.TokenEndpoint),
6863
}
6964

70-
if getEnv("INSECURE_SKIP_VERIFY", "FALSE") == "TRUE" {
65+
if config.InsecureSkipVerify {
7166
opts = append(opts, sdk.WithInsecureSkipVerifyConn())
7267
}
7368

@@ -97,7 +92,7 @@ func peSdkClient(config OpentdfConfig, authScopes []string, token TokenAuth) (*s
9792
sdk.WithTokenExchange(token.AccessToken, []string{token.NpeClientId}),
9893
}
9994

100-
if getEnv("INSECURE_SKIP_VERIFY", "FALSE") == "TRUE" {
95+
if config.InsecureSkipVerify {
10196
opts = append(opts, sdk.WithInsecureSkipVerifyConn())
10297
}
10398

otdf_python_test.go

Lines changed: 74 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ import (
1818
var defaultAuthScopes = []string{"email"}
1919

2020
type TestConfiguration struct {
21-
platformEndpoint string
22-
tokenEndpoint string
23-
kasEndpoint string
24-
npeClientId string
25-
npeClientSecret string
26-
peUsername string
27-
pePassword string
28-
testAttribute1 string
29-
testAttribute2 string
21+
platformEndpoint string
22+
tokenEndpoint string
23+
kasEndpoint string
24+
npeClientId string
25+
npeClientSecret string
26+
peUsername string
27+
pePassword string
28+
testAttribute1 string
29+
testAttribute2 string
30+
insecureSkipVerify bool
3031
}
3132

3233
var config = TestConfiguration{
@@ -38,8 +39,9 @@ var config = TestConfiguration{
3839
peUsername: os.Getenv("TEST_OPENTDF_SECRET_USER_ID"),
3940
pePassword: os.Getenv("TEST_OPENTDF_SECRET_USER_PASSWORD"),
4041
// For default values, we added a helper function
41-
testAttribute1: getEnv("TEST_OPENTDF_ATTRIBUTE_1", "https://example.com/attr/attr1/value/value1"),
42-
testAttribute2: getEnv("TEST_OPENTDF_ATTRIBUTE_2", "https://example.com/attr/attr1/value/value2"),
42+
testAttribute1: getEnv("TEST_OPENTDF_ATTRIBUTE_1", "https://example.com/attr/attr1/value/value1"),
43+
testAttribute2: getEnv("TEST_OPENTDF_ATTRIBUTE_2", "https://example.com/attr/attr1/value/value2"),
44+
insecureSkipVerify: getEnv("INSECURE_SKIP_VERIFY", "FALSE") == "TRUE",
4345
}
4446

4547
/*
@@ -61,7 +63,7 @@ https://stackoverflow.com/q/24493116
6163
*/
6264
func authHelper(form url.Values, isPEAuth bool) (TokenAuth, error) {
6365
tr := &http.Transport{
64-
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
66+
TLSClientConfig: &tls.Config{InsecureSkipVerify: config.insecureSkipVerify},
6567
}
6668
// FIXME: Use a client with TLS verification
6769
// client := http.Client{}
@@ -133,11 +135,12 @@ func getMultiDataAttribute(config TestConfiguration) []string {
133135
func doEncryptString(t *testing.T, dataAttributes []string) {
134136

135137
got, err := EncryptString("Hello, world", OpentdfConfig{
136-
ClientId: config.npeClientId,
137-
ClientSecret: config.npeClientSecret,
138-
PlatformEndpoint: config.platformEndpoint,
139-
TokenEndpoint: config.tokenEndpoint,
140-
KasUrl: config.kasEndpoint,
138+
ClientId: config.npeClientId,
139+
ClientSecret: config.npeClientSecret,
140+
PlatformEndpoint: config.platformEndpoint,
141+
TokenEndpoint: config.tokenEndpoint,
142+
KasUrl: config.kasEndpoint,
143+
InsecureSkipVerify: config.insecureSkipVerify,
141144
}, dataAttributes, defaultAuthScopes)
142145
if err != nil {
143146
t.Fatal(err)
@@ -198,11 +201,12 @@ func encrypt_file_NPE(t *testing.T, dataAttributes []string) string {
198201
defer tmpOutputFile.Close()
199202

200203
got, err := EncryptFile(tmpInputFile.Name(), tmpOutputFile.Name(), OpentdfConfig{
201-
ClientId: config.npeClientId,
202-
ClientSecret: config.npeClientSecret,
203-
PlatformEndpoint: config.platformEndpoint,
204-
TokenEndpoint: config.tokenEndpoint,
205-
KasUrl: config.kasEndpoint,
204+
ClientId: config.npeClientId,
205+
ClientSecret: config.npeClientSecret,
206+
PlatformEndpoint: config.platformEndpoint,
207+
TokenEndpoint: config.tokenEndpoint,
208+
KasUrl: config.kasEndpoint,
209+
InsecureSkipVerify: config.insecureSkipVerify,
206210
}, dataAttributes, defaultAuthScopes)
207211
if err != nil {
208212
t.Error("Failed to EncryptFile()!")
@@ -244,11 +248,12 @@ func encrypt_file_PE(t *testing.T, dataAttributes []string, tokenAuth TokenAuth)
244248
defer tmpOutputFile.Close()
245249

246250
got, err := EncryptFilePE(tmpInputFile.Name(), tmpOutputFile.Name(), OpentdfConfig{
247-
ClientId: config.npeClientId,
248-
ClientSecret: config.npeClientSecret,
249-
PlatformEndpoint: config.platformEndpoint,
250-
TokenEndpoint: config.tokenEndpoint,
251-
KasUrl: config.kasEndpoint,
251+
ClientId: config.npeClientId,
252+
ClientSecret: config.npeClientSecret,
253+
PlatformEndpoint: config.platformEndpoint,
254+
TokenEndpoint: config.tokenEndpoint,
255+
KasUrl: config.kasEndpoint,
256+
InsecureSkipVerify: config.insecureSkipVerify,
252257
}, tokenAuth, dataAttributes, defaultAuthScopes)
253258
if err != nil {
254259
t.Fatal("Failed to EncryptFilePE()!")
@@ -301,11 +306,12 @@ func e2e_test_as_PE(t *testing.T, dataAttributes []string) {
301306
t.Error(err)
302307
}
303308
got, err := DecryptFilePE(input_TDF_path, plaintext_output_path.Name(), OpentdfConfig{
304-
ClientId: config.npeClientId,
305-
ClientSecret: config.npeClientSecret,
306-
PlatformEndpoint: config.platformEndpoint,
307-
TokenEndpoint: config.tokenEndpoint,
308-
KasUrl: config.kasEndpoint,
309+
ClientId: config.npeClientId,
310+
ClientSecret: config.npeClientSecret,
311+
PlatformEndpoint: config.platformEndpoint,
312+
TokenEndpoint: config.tokenEndpoint,
313+
KasUrl: config.kasEndpoint,
314+
InsecureSkipVerify: config.insecureSkipVerify,
309315
}, token_for_decrypt, defaultAuthScopes)
310316
if err != nil {
311317
t.Fatal(err)
@@ -376,11 +382,12 @@ func Test_Multifile_NPE_Encrypt_Files_In_Dir_Nil_Attributes(t *testing.T) {
376382
}
377383

378384
cfg := OpentdfConfig{
379-
ClientId: config.npeClientId,
380-
ClientSecret: config.npeClientSecret,
381-
PlatformEndpoint: config.platformEndpoint,
382-
TokenEndpoint: config.tokenEndpoint,
383-
KasUrl: config.kasEndpoint,
385+
ClientId: config.npeClientId,
386+
ClientSecret: config.npeClientSecret,
387+
PlatformEndpoint: config.platformEndpoint,
388+
TokenEndpoint: config.tokenEndpoint,
389+
KasUrl: config.kasEndpoint,
390+
InsecureSkipVerify: config.insecureSkipVerify,
384391
}
385392

386393
got, err := EncryptFilesWithExtensionsNPE(tmpDir, []string{".txt", ".csv"}, cfg, nil, defaultAuthScopes)
@@ -409,11 +416,12 @@ func Test_Multifile_NPE_Encrypt_Files_With_Extensions_Nil_Attributes(t *testing.
409416

410417
// Call the EncryptFilesWithExtensionsNPE function
411418
got, err := EncryptFilesWithExtensionsNPE(tmpDir, []string{".txt", ".csv", ".pdf"}, OpentdfConfig{
412-
ClientId: config.npeClientId,
413-
ClientSecret: config.npeClientSecret,
414-
PlatformEndpoint: config.platformEndpoint,
415-
TokenEndpoint: config.tokenEndpoint,
416-
KasUrl: config.kasEndpoint,
419+
ClientId: config.npeClientId,
420+
ClientSecret: config.npeClientSecret,
421+
PlatformEndpoint: config.platformEndpoint,
422+
TokenEndpoint: config.tokenEndpoint,
423+
KasUrl: config.kasEndpoint,
424+
InsecureSkipVerify: config.insecureSkipVerify,
417425
}, nil, defaultAuthScopes)
418426
if err != nil {
419427
t.Fatal("Failed to EncryptFilesWithExtensionsNPE()!", err)
@@ -440,23 +448,25 @@ func Test_Multifile_NPE_Decrypt_Files_In_Dir_Nil_Attributes(t *testing.T) {
440448

441449
// Encrypt the file
442450
_, err = EncryptFilesInDirNPE(tmpDir, OpentdfConfig{
443-
ClientId: config.npeClientId,
444-
ClientSecret: config.npeClientSecret,
445-
PlatformEndpoint: config.platformEndpoint,
446-
TokenEndpoint: config.tokenEndpoint,
447-
KasUrl: config.kasEndpoint,
451+
ClientId: config.npeClientId,
452+
ClientSecret: config.npeClientSecret,
453+
PlatformEndpoint: config.platformEndpoint,
454+
TokenEndpoint: config.tokenEndpoint,
455+
KasUrl: config.kasEndpoint,
456+
InsecureSkipVerify: config.insecureSkipVerify,
448457
}, nil, defaultAuthScopes)
449458
if err != nil {
450459
t.Fatal("Failed to EncryptFilesInDirNPE()!", err)
451460
}
452461

453462
// Call the DecryptFilesInDirNPE function
454463
got, err := DecryptFilesInDirNPE(tmpDir, OpentdfConfig{
455-
ClientId: config.npeClientId,
456-
ClientSecret: config.npeClientSecret,
457-
PlatformEndpoint: config.platformEndpoint,
458-
TokenEndpoint: config.tokenEndpoint,
459-
KasUrl: config.kasEndpoint,
464+
ClientId: config.npeClientId,
465+
ClientSecret: config.npeClientSecret,
466+
PlatformEndpoint: config.platformEndpoint,
467+
TokenEndpoint: config.tokenEndpoint,
468+
KasUrl: config.kasEndpoint,
469+
InsecureSkipVerify: config.insecureSkipVerify,
460470
}, defaultAuthScopes)
461471
if err != nil {
462472
t.Fatal("Failed to DecryptFilesInDirNPE()!", err)
@@ -482,23 +492,25 @@ func Test_Multifile_NPE_Decrypt_Files_With_Extensions_Nil_Attributes(t *testing.
482492

483493
// Encrypt the files
484494
_, err = EncryptFilesWithExtensionsNPE(tmpDir, []string{".txt", ".csv", ".pdf"}, OpentdfConfig{
485-
ClientId: config.npeClientId,
486-
ClientSecret: config.npeClientSecret,
487-
PlatformEndpoint: config.platformEndpoint,
488-
TokenEndpoint: config.tokenEndpoint,
489-
KasUrl: config.kasEndpoint,
495+
ClientId: config.npeClientId,
496+
ClientSecret: config.npeClientSecret,
497+
PlatformEndpoint: config.platformEndpoint,
498+
TokenEndpoint: config.tokenEndpoint,
499+
KasUrl: config.kasEndpoint,
500+
InsecureSkipVerify: config.insecureSkipVerify,
490501
}, nil, defaultAuthScopes)
491502
if err != nil {
492503
t.Fatal("Failed to EncryptFilesWithExtensionsNPE()!", err)
493504
}
494505

495506
// Call the DecryptFilesWithExtensionsNPE function
496507
got, err := DecryptFilesWithExtensionsNPE(tmpDir, []string{".tdf"}, OpentdfConfig{
497-
ClientId: config.npeClientId,
498-
ClientSecret: config.npeClientSecret,
499-
PlatformEndpoint: config.platformEndpoint,
500-
TokenEndpoint: config.tokenEndpoint,
501-
KasUrl: config.kasEndpoint,
508+
ClientId: config.npeClientId,
509+
ClientSecret: config.npeClientSecret,
510+
PlatformEndpoint: config.platformEndpoint,
511+
TokenEndpoint: config.tokenEndpoint,
512+
KasUrl: config.kasEndpoint,
513+
InsecureSkipVerify: config.insecureSkipVerify,
502514
}, defaultAuthScopes)
503515
if err != nil {
504516
t.Fatal("Failed to DecryptFilesWithExtensionsNPE()!", err)

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "otdf-python"
33
# Should match 'setup.py' version number (used for gopy/pybindgen)
4-
version = "0.2.16"
4+
version = "0.2.17"
55
description = "Unofficial OpenTDF SDK for Python."
66
authors = [
77
{name="b-long", email="[email protected]"}
@@ -19,7 +19,7 @@ pybindgen = "^0.22.1"
1919

2020
[tool.poetry]
2121
package-mode = false
22-
version = "0.2.16"
22+
version = "0.2.17"
2323

2424
[tool.poetry.dependencies]
2525
python = ">=3.10,<3.14"

0 commit comments

Comments
 (0)