Skip to content

Commit 1525885

Browse files
Coding-Dev-ToolsDevForge Engineer
andauthored
fix: harden CI workflow security, add project.urls, add ruff dep, add .gitattributes (#23)
- Add persist-credentials:false to all 5 checkout steps across 4 workflows - Add permissions: contents:read to ci.yml (principle of least privilege) - Use pip install -e .[dev] for lint step instead of separate pip install ruff - Add ruff>=0.4.0 to dev dependencies in pyproject.toml - Convert inline urls to [project.urls] table with Documentation, Issues, Changelog - Add .gitattributes for consistent line endings across platforms Co-authored-by: DevForge Engineer <engineer@devforge.dev>
1 parent 8289b9b commit 1525885

6 files changed

Lines changed: 29 additions & 4 deletions

File tree

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto eol=lf
2+
*.bat text eol=crlf
3+
*.cmd text eol=crlf
4+
*.ps1 text eol=crlf
5+
*.vbs text eol=crlf

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,24 @@ on:
66
pull_request:
77
branches: [master]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
lint:
1114
runs-on: ubuntu-latest
1215
steps:
1316
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
17+
with:
18+
persist-credentials: false
1419

1520
- name: Set up Python
1621
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
1722
with:
1823
python-version: "3.12"
1924

20-
- name: Install ruff
21-
run: pip install ruff
25+
- name: Install dependencies
26+
run: pip install -e ".[dev]"
2227

2328
- name: Run ruff check
2429
run: ruff check .
@@ -32,6 +37,8 @@ jobs:
3237

3338
steps:
3439
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
40+
with:
41+
persist-credentials: false
3542

3643
- name: Set up Python ${{ matrix.python-version }}
3744
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065

.github/workflows/npm-publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
18+
with:
19+
persist-credentials: false
1820

1921
- name: Set up Node.js
2022
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020

.github/workflows/pages.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
22+
with:
23+
persist-credentials: false
2224
- name: Setup Pages
2325
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b
2426
- name: Build with Jekyll

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222

2323
steps:
2424
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
25+
with:
26+
persist-credentials: false
2527

2628
- name: Set up Python 3.12
2729
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065

pyproject.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ readme = "README.md"
1010
requires-python = ">=3.10"
1111
license = "MIT"
1212
authors = [{name = "Revenue Holdings"}]
13-
urls = {Homepage = "https://github.com/Coding-Dev-Tools/datamorph", Repository = "https://github.com/Coding-Dev-Tools/datamorph"}
1413
keywords = ["data-converter", "csv", "json", "yaml", "parquet", "avro", "etl", "cli"]
1514
classifiers = [
1615
"Development Status :: 4 - Beta",
@@ -32,10 +31,18 @@ dependencies = [
3231
"fastavro>=1.12.2",
3332
]
3433

34+
[project.urls]
35+
Homepage = "https://github.com/Coding-Dev-Tools/datamorph"
36+
Documentation = "https://coding-dev-tools.github.io/datamorph/"
37+
Repository = "https://github.com/Coding-Dev-Tools/datamorph"
38+
Issues = "https://github.com/Coding-Dev-Tools/datamorph/issues"
39+
Changelog = "https://github.com/Coding-Dev-Tools/datamorph/releases"
40+
3541
[project.optional-dependencies]
3642
dev = [
3743
"pytest>=9.0.3",
3844
"pytest-cov>=7.1.0",
45+
"ruff>=0.4.0",
3946
]
4047
full = [
4148
"protobuf>=7.34.1",
@@ -56,4 +63,4 @@ select = ["E", "F", "W", "I"]
5663

5764
[tool.pytest.ini_options]
5865
testpaths = ["tests"]
59-
python_files = ["test_*.py"]
66+
python_files = ["test_*.py"]

0 commit comments

Comments
 (0)