safe-file-example 0.2.1__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/.gitignore +3 -0
- safe_file_example-0.3.1/.gitlab-ci.yml +221 -0
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/.pre-commit-config.yaml +0 -1
- safe_file_example-0.3.1/CHANGELOG.md +56 -0
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/PKG-INFO +3 -3
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/pyproject.toml +20 -3
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/safe/main.py +224 -153
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/safe/modules/export_module.py +1 -9
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/safe/modules/helper_functions.py +4 -1
- safe_file_example-0.3.1/safe/modules/import_module.py +84 -0
- safe_file_example-0.3.1/safe/modules/ldap.py +41 -0
- safe_file_example-0.3.1/tests/__init__.py +1 -0
- safe_file_example-0.3.1/tests/conftest.py +86 -0
- safe_file_example-0.3.1/tests/test_export_module.py +84 -0
- safe_file_example-0.3.1/tests/test_helper_functions.py +150 -0
- safe_file_example-0.3.1/tests/test_import_module.py +207 -0
- safe_file_example-0.3.1/tests/test_ldap.py +62 -0
- safe_file_example-0.3.1/tests/test_list_export_module.py +83 -0
- safe_file_example-0.3.1/tests/test_main.py +956 -0
- safe_file_example-0.3.1/uv.lock +502 -0
- safe_file_example-0.2.1/safe/modules/import_module.py +0 -70
- safe_file_example-0.2.1/uv.lock +0 -251
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/LICENSE +0 -0
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/README.md +0 -0
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/safe/__init__.py +0 -0
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/safe/assets/safe_logo.png +0 -0
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/safe/modules/__init__.py +0 -0
- {safe_file_example-0.2.1 → safe_file_example-0.3.1}/safe/modules/list_export_module.py +0 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- validate
|
|
3
|
+
- build
|
|
4
|
+
- test
|
|
5
|
+
- coverage
|
|
6
|
+
- scan
|
|
7
|
+
|
|
8
|
+
include:
|
|
9
|
+
- template: Jobs/Dependency-Scanning.gitlab-ci.yml
|
|
10
|
+
- template: Jobs/SAST.gitlab-ci.yml
|
|
11
|
+
|
|
12
|
+
variables:
|
|
13
|
+
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache"
|
|
14
|
+
TRIVY_CACHE_DIR: ".cache/trivy"
|
|
15
|
+
TRIVY_IGNORE_FILE: .trivyignore
|
|
16
|
+
|
|
17
|
+
# NOTE: All stages needs to pass Ruff Format
|
|
18
|
+
# Require Ruff Format by using:
|
|
19
|
+
# needs: ["Ruff Format"]
|
|
20
|
+
|
|
21
|
+
# Validate stage
|
|
22
|
+
|
|
23
|
+
.base_ruff:
|
|
24
|
+
stage: validate
|
|
25
|
+
interruptible: true
|
|
26
|
+
image:
|
|
27
|
+
name: ghcr.io/astral-sh/ruff:0.15.6-alpine
|
|
28
|
+
before_script:
|
|
29
|
+
- cd $CI_PROJECT_DIR
|
|
30
|
+
- ruff --version
|
|
31
|
+
|
|
32
|
+
Ruff Format:
|
|
33
|
+
extends: .base_ruff
|
|
34
|
+
script:
|
|
35
|
+
- ruff format --diff
|
|
36
|
+
|
|
37
|
+
# Build stage
|
|
38
|
+
|
|
39
|
+
build-safe-cli:
|
|
40
|
+
stage: build
|
|
41
|
+
image: ghcr.io/astral-sh/uv:python3.13-alpine
|
|
42
|
+
needs: ["Ruff Format"]
|
|
43
|
+
before_script:
|
|
44
|
+
- python --version
|
|
45
|
+
- uv --version
|
|
46
|
+
script:
|
|
47
|
+
- echo "Building safe-file-example package..."
|
|
48
|
+
- uv build
|
|
49
|
+
artifacts:
|
|
50
|
+
paths:
|
|
51
|
+
- dist/
|
|
52
|
+
expire_in: 1 week
|
|
53
|
+
|
|
54
|
+
# Test stage
|
|
55
|
+
|
|
56
|
+
test_job:
|
|
57
|
+
stage: test
|
|
58
|
+
image: ghcr.io/astral-sh/uv:python3.13-alpine
|
|
59
|
+
needs: ["Ruff Format"]
|
|
60
|
+
cache:
|
|
61
|
+
paths:
|
|
62
|
+
- .pip-cache/
|
|
63
|
+
before_script:
|
|
64
|
+
- python --version
|
|
65
|
+
- uv venv
|
|
66
|
+
- source .venv/bin/activate
|
|
67
|
+
- uv pip install --upgrade pip
|
|
68
|
+
- uv sync --group test
|
|
69
|
+
script:
|
|
70
|
+
- echo "Running the tests"
|
|
71
|
+
- uv run pytest
|
|
72
|
+
- echo "Tests Finished!"
|
|
73
|
+
artifacts:
|
|
74
|
+
paths:
|
|
75
|
+
- .coverage
|
|
76
|
+
|
|
77
|
+
# Coverage stage
|
|
78
|
+
|
|
79
|
+
coverage-job:
|
|
80
|
+
stage: coverage
|
|
81
|
+
image: ghcr.io/astral-sh/uv:python3.13-alpine
|
|
82
|
+
needs: ["Ruff Format", "test_job"]
|
|
83
|
+
cache:
|
|
84
|
+
paths:
|
|
85
|
+
- .pip-cache/
|
|
86
|
+
before_script:
|
|
87
|
+
- python --version
|
|
88
|
+
- uv venv
|
|
89
|
+
- source .venv/bin/activate
|
|
90
|
+
- uv pip install --upgrade pip
|
|
91
|
+
- uv sync --group test
|
|
92
|
+
script:
|
|
93
|
+
- uv pip install pytest pytest-cov
|
|
94
|
+
- uv run pytest --cov --cov-report term --cov-report xml:coverage.xml
|
|
95
|
+
artifacts:
|
|
96
|
+
reports:
|
|
97
|
+
coverage_report:
|
|
98
|
+
coverage_format: cobertura
|
|
99
|
+
path: coverage.xml
|
|
100
|
+
coverage: /TOTAL.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
|
|
101
|
+
|
|
102
|
+
trivy_scan:
|
|
103
|
+
stage: scan
|
|
104
|
+
image:
|
|
105
|
+
name: aquasec/trivy:0.73.0
|
|
106
|
+
entrypoint: [""]
|
|
107
|
+
needs: ["build-safe-cli"]
|
|
108
|
+
variables:
|
|
109
|
+
TRIVY_SEVERITY: LOW,MEDIUM,HIGH,CRITICAL
|
|
110
|
+
TRIVY_CACHE_DIR: ".cache/trivy"
|
|
111
|
+
cache:
|
|
112
|
+
paths:
|
|
113
|
+
- .cache/trivy
|
|
114
|
+
script:
|
|
115
|
+
- echo "Scanning artifacts with Trivy filesystem scan"
|
|
116
|
+
|
|
117
|
+
- echo "Trivy caches in $TRIVY_CACHE_DIR"
|
|
118
|
+
- 'ls -ltrR $TRIVY_CACHE_DIR || echo "no cache dir found!"'
|
|
119
|
+
|
|
120
|
+
- wget -O /tmp/trivy-gitlab.tpl https://github.com/aquasecurity/trivy/raw/main/contrib/gitlab.tpl
|
|
121
|
+
- head /tmp/trivy-gitlab.tpl
|
|
122
|
+
|
|
123
|
+
- echo "Running Trivy scan"
|
|
124
|
+
|
|
125
|
+
- |
|
|
126
|
+
trivy fs \
|
|
127
|
+
--scanners vuln uv.lock \
|
|
128
|
+
--cache-dir "$TRIVY_CACHE_DIR" \
|
|
129
|
+
--severity "$TRIVY_SEVERITY" \
|
|
130
|
+
--format template \
|
|
131
|
+
--template "@/tmp/trivy-gitlab.tpl" \
|
|
132
|
+
--output safe-cli-scanning-report.json
|
|
133
|
+
|
|
134
|
+
- cat safe-cli-scanning-report.json
|
|
135
|
+
|
|
136
|
+
artifacts:
|
|
137
|
+
paths:
|
|
138
|
+
- safe-cli-scanning-report.json
|
|
139
|
+
when: always
|
|
140
|
+
|
|
141
|
+
cve_count:
|
|
142
|
+
stage: scan
|
|
143
|
+
image: alpine:3.22.2
|
|
144
|
+
needs:
|
|
145
|
+
- job: trivy_scan
|
|
146
|
+
artifacts: true
|
|
147
|
+
script:
|
|
148
|
+
- apk add --no-cache jq
|
|
149
|
+
- echo "Starting cve count"
|
|
150
|
+
|
|
151
|
+
- echo "Generating CVE summary..."
|
|
152
|
+
- |
|
|
153
|
+
jq -r '.vulnerabilities[] | "\(.id) - \(.severity): \(.name)"' safe-cli-scanning-report.json > cve_summary.txt || echo "No vulnerabilities found." > cve_summary.txt
|
|
154
|
+
|
|
155
|
+
- echo "Checking for HIGH or CRITICAL vulnerabilities..."
|
|
156
|
+
- |
|
|
157
|
+
critical_count=$(jq -r '.vulnerabilities[] | select(.severity=="Critical") | .id' safe-cli-scanning-report.json | sort -u | wc -l)
|
|
158
|
+
high_count=$(jq -r '.vulnerabilities[] | select(.severity=="High") | .id' safe-cli-scanning-report.json | sort -u | wc -l)
|
|
159
|
+
medium_count=$(jq -r '.vulnerabilities[] | select(.severity=="Medium") | .id' safe-cli-scanning-report.json | sort -u | wc -l)
|
|
160
|
+
low_count=$(jq -r '.vulnerabilities[] | select(.severity=="Low") | .id' safe-cli-scanning-report.json | sort -u | wc -l)
|
|
161
|
+
echo "CRITICAL: $critical_count" > cve_critical_count.txt
|
|
162
|
+
echo "HIGH: $high_count" > cve_high_count.txt
|
|
163
|
+
echo "MEDIUM: $medium_count" > cve_medium_count.txt
|
|
164
|
+
echo "LOW: $low_count" > cve_low_count.txt
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
if [ "$critical_count" -eq 0 ]; then
|
|
169
|
+
wget -q -O "badge-critical-count.svg" \
|
|
170
|
+
"https://img.shields.io/badge/Critical_CVE-0-brightgreen"
|
|
171
|
+
else
|
|
172
|
+
wget -q -O "badge-critical-count.svg" \
|
|
173
|
+
"https://img.shields.io/badge/Critical_CVE-${critical_count}-darkred"
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
if [ "$high_count" -eq 0 ]; then
|
|
177
|
+
wget -q -O "badge-high-count.svg" \
|
|
178
|
+
"https://img.shields.io/badge/High_CVE-0-brightgreen"
|
|
179
|
+
else
|
|
180
|
+
wget -q -O "badge-high-count.svg" \
|
|
181
|
+
"https://img.shields.io/badge/High_CVE-${high_count}-red"
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
if [ "$medium_count" -eq 0 ]; then
|
|
185
|
+
wget -q -O "badge-medium-count.svg" \
|
|
186
|
+
"https://img.shields.io/badge/Medium_CVE-0-brightgreen"
|
|
187
|
+
else
|
|
188
|
+
wget -q -O "badge-medium-count.svg" \
|
|
189
|
+
"https://img.shields.io/badge/Medium_CVE-${medium_count}-orange"
|
|
190
|
+
fi
|
|
191
|
+
|
|
192
|
+
if [ "$low_count" -eq 0 ]; then
|
|
193
|
+
wget -q -O "badge-low-count.svg" \
|
|
194
|
+
"https://img.shields.io/badge/Low_CVE-0-brightgreen"
|
|
195
|
+
else
|
|
196
|
+
wget -q -O "badge-low-count.svg" \
|
|
197
|
+
"https://img.shields.io/badge/Low_CVE-${low_count}-yellow"
|
|
198
|
+
fi
|
|
199
|
+
|
|
200
|
+
if [ "$critical_count" -gt 0 ] || [ "$high_count" -gt 0 ]; then
|
|
201
|
+
echo "HIGH or CRITICAL vulnerabilities found."
|
|
202
|
+
exit_code=1
|
|
203
|
+
else
|
|
204
|
+
echo "No HIGH or CRITICAL vulnerabilities found."
|
|
205
|
+
exit_code=0
|
|
206
|
+
fi
|
|
207
|
+
- exit $exit_code
|
|
208
|
+
|
|
209
|
+
artifacts:
|
|
210
|
+
paths:
|
|
211
|
+
- safe-cli-scanning-report.json
|
|
212
|
+
- cve_high_count.txt
|
|
213
|
+
- cve_critical_count.txt
|
|
214
|
+
- cve_medium_count.txt
|
|
215
|
+
- cve_low_count.txt
|
|
216
|
+
- cve_summary.txt
|
|
217
|
+
- badge-high-count.svg
|
|
218
|
+
- badge-critical-count.svg
|
|
219
|
+
- badge-medium-count.svg
|
|
220
|
+
- badge-low-count.svg
|
|
221
|
+
when: always
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/2.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
### Types of changes
|
|
8
|
+
|
|
9
|
+
- `Added` for new features.
|
|
10
|
+
- `Changed` for changes in existing functionality. (The behavior worked as intended, and now works differently.)
|
|
11
|
+
- `Deprecated` for soon-to-be removed features.
|
|
12
|
+
- `Removed` for now removed features.
|
|
13
|
+
- `Fixed` for bug fixes. (The behavior was wrong, and is now correct.)
|
|
14
|
+
- `Security` for vulnerabilities. (The change addresses a vulnerability. It could fit under Fixed or Changed, but its urgency and audience are different.)
|
|
15
|
+
|
|
16
|
+
## [0.3.1] - 2026-09-29
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- Fixed an issue with the URL of SAFE File API.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.3.0] - 2026-09-25 [YANKED]
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- Added support for batch importing multiple files via both interactive and non-interactive methods.
|
|
26
|
+
- Added progress indicators for file import operations.
|
|
27
|
+
- Added command `exit` to exit the interactive mode in CLI.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
- Display of file size in menu when exporting files is now limited to one decimal.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [0.2.1] - 2026-08-06
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- Updated project dependencies.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## [0.2.0] - 2026-05-11
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- Added a VPN usage reminder on application startup.
|
|
43
|
+
- Added a JWT token security reminder on application startup.
|
|
44
|
+
- Added automatic version checks on application startup.
|
|
45
|
+
- Added human-friendly display of file size in export file selection.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## [0.1.1] - 2026-04-20
|
|
49
|
+
- Initial release
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
[0.3.1]: https://git.app.uib.no/itpublic/python/safe-file-example/-/compare/0.3.0...0.3.1?from_project_id=1062
|
|
53
|
+
[0.3.0]: https://git.app.uib.no/itpublic/python/safe-file-example/-/compare/0.2.1...0.3.0?from_project_id=1062
|
|
54
|
+
[0.2.1]: https://git.app.uib.no/itpublic/python/safe-file-example/-/compare/0.2.0...0.2.1?from_project_id=1062
|
|
55
|
+
[0.2.0]: https://git.app.uib.no/itpublic/python/safe-file-example/-/compare/0.1.1...0.2.0?from_project_id=1062
|
|
56
|
+
[0.1.1]: https://git.app.uib.no/itpublic/python/safe-file-example/-/tree/0.1.1?ref_type=tags
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: safe-file-example
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: A python package for interacting with SAFE File transfer API
|
|
5
5
|
Project-URL: Homepage, https://git.app.uib.no/itpublic/python/safe-file-example
|
|
6
|
-
Author-email: Dip Paul <dip.paul@uib.no>, Eirik Halseth <eirik.halseth@uib.no>, Marco Antonio Corrales Cardenas <marco.corrales@uib.no>
|
|
6
|
+
Author-email: Dip Paul <dip.paul@uib.no>, Eirik Halseth <eirik.halseth@uib.no>, Elena Nicole Jacobsen <Elena.Nicole.Jacobsen@uib.no>, Kai Imoda Waløen <kai.waloen@uib.no>, Lukas Lussand Iversen <lukas.lussand.iversen@uib.no>, Marco Antonio Corrales Cardenas <marco.corrales@uib.no>
|
|
7
7
|
License-File: LICENSE
|
|
8
8
|
Classifier: Operating System :: OS Independent
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -4,18 +4,21 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "safe-file-example"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.1"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Dip Paul", email="dip.paul@uib.no" },
|
|
10
10
|
{ name="Eirik Halseth", email="eirik.halseth@uib.no" },
|
|
11
|
-
{ name="
|
|
11
|
+
{ name="Elena Nicole Jacobsen", email="Elena.Nicole.Jacobsen@uib.no" },
|
|
12
|
+
{ name="Kai Imoda Waløen", email="kai.waloen@uib.no"},
|
|
13
|
+
{ name="Lukas Lussand Iversen", email="lukas.lussand.iversen@uib.no" },
|
|
14
|
+
{ name="Marco Antonio Corrales Cardenas", email="marco.corrales@uib.no" }
|
|
12
15
|
]
|
|
13
16
|
description = "A python package for interacting with SAFE File transfer API"
|
|
14
17
|
readme = "README.md"
|
|
15
18
|
requires-python = ">=3.12"
|
|
16
19
|
|
|
17
20
|
dependencies = [
|
|
18
|
-
|
|
21
|
+
"annotated-doc==0.0.5",
|
|
19
22
|
"certifi==2026.7.22",
|
|
20
23
|
"charset-normalizer==3.4.9",
|
|
21
24
|
"click==8.4.2",
|
|
@@ -30,6 +33,7 @@ dependencies = [
|
|
|
30
33
|
"typer==0.27.1",
|
|
31
34
|
"urllib3==2.7.0",
|
|
32
35
|
]
|
|
36
|
+
|
|
33
37
|
classifiers = [
|
|
34
38
|
"Programming Language :: Python :: 3",
|
|
35
39
|
"Operating System :: OS Independent",
|
|
@@ -46,3 +50,16 @@ packages = ["safe"]
|
|
|
46
50
|
include = [
|
|
47
51
|
"safe/assets/*.png"
|
|
48
52
|
]
|
|
53
|
+
|
|
54
|
+
[dependency-groups]
|
|
55
|
+
|
|
56
|
+
test = [
|
|
57
|
+
"aiofiles==25.1.0",
|
|
58
|
+
"anyio==4.15.0",
|
|
59
|
+
"coverage==7.16.0",
|
|
60
|
+
"mock==5.2.0",
|
|
61
|
+
"pyfakefs==6.2.0",
|
|
62
|
+
"pytest==9.1.1",
|
|
63
|
+
"pytest-cov==7.1.0",
|
|
64
|
+
"pytest-env==1.7.0",
|
|
65
|
+
]
|