Skip to content

Commit 3c0a042

Browse files
authored
Merge branch 'main' into feature/log-config-source
2 parents 9606842 + 82c37fb commit 3c0a042

68 files changed

Lines changed: 13781 additions & 823 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/commands/bump-version.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Bump the project version. The bump type is: $ARGUMENTS (default to "patch" if empty or not one of: patch, minor, major).
2+
3+
Follow these steps exactly:
4+
5+
1. **Parse bump type**: Use "$ARGUMENTS". If blank or not one of `patch`, `minor`, `major`, default to `patch`.
6+
7+
2. **Read current version**: Read `pyproject.toml` and extract the current version from the `version = "X.Y.Z"` line.
8+
9+
3. **Compute new version**: Given current version `X.Y.Z`:
10+
- `patch``X.Y.(Z+1)`
11+
- `minor``X.(Y+1).0`
12+
- `major``(X+1).0.0`
13+
14+
4. **Update all version files**: Run the following Python command from the project root to invoke the existing hook logic, which updates `pyproject.toml`, `socket_basics/version.py`, and all doc files:
15+
```
16+
python3 -c "import importlib.util; spec = importlib.util.spec_from_file_location('version_check', '.hooks/version-check.py'); mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod); mod.inject_version('NEW_VERSION')"
17+
```
18+
Replace `NEW_VERSION` with the computed version string.
19+
20+
5. **Update `socket_basics/__init__.py`**: This file is NOT handled by the hook. Use the Edit tool to replace the old `__version__ = "OLD"` line with `__version__ = "NEW_VERSION"`.
21+
22+
6. **Regenerate lock file**: Run `uv lock` to update `uv.lock` with the new version.
23+
24+
7. **Verify**: Use grep to confirm no remaining references to the OLD version in these files:
25+
- `pyproject.toml`
26+
- `socket_basics/version.py`
27+
- `socket_basics/__init__.py`
28+
- `uv.lock`
29+
- `README.md`
30+
- `docs/github-action.md`
31+
- `docs/pre-commit-hook.md`
32+
33+
8. **Report**: Summarize what version was bumped (OLD → NEW) and list all files that were modified.
34+
35+
Do NOT commit the changes. Just make the edits and report.

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @SocketDev/eng
1+
* @SocketDev/customer-engineering

.github/workflows/python-tests.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: python-tests
2+
3+
env:
4+
PYTHON_VERSION: "3.12"
5+
6+
on:
7+
push:
8+
branches: [main]
9+
paths:
10+
- "socket_basics/**/*.py"
11+
- "tests/**/*.py"
12+
- "pyproject.toml"
13+
- "uv.lock"
14+
- ".github/workflows/python-tests.yml"
15+
pull_request:
16+
paths:
17+
- "socket_basics/**/*.py"
18+
- "tests/**/*.py"
19+
- "pyproject.toml"
20+
- "uv.lock"
21+
- ".github/workflows/python-tests.yml"
22+
workflow_dispatch:
23+
24+
permissions:
25+
contents: read
26+
27+
concurrency:
28+
group: python-tests-${{ github.ref }}
29+
cancel-in-progress: true
30+
31+
jobs:
32+
python-tests:
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 20
35+
steps:
36+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
37+
with:
38+
fetch-depth: 1
39+
persist-credentials: false
40+
- name: 🐍 setup python
41+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
42+
with:
43+
python-version: ${{ env.PYTHON_VERSION }}
44+
cache: "pip"
45+
- name: 🛠️ install deps
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install -e ".[dev]"
49+
- name: 🧪 run tests
50+
run: pytest -q tests/

.github/workflows/smoke-test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: smoke-test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'Dockerfile'
8+
- 'scripts/smoke-test-docker.sh'
9+
- '.github/workflows/smoke-test.yml'
10+
pull_request:
11+
paths:
12+
- 'Dockerfile'
13+
- 'scripts/smoke-test-docker.sh'
14+
- '.github/workflows/smoke-test.yml'
15+
schedule:
16+
- cron: '0 */12 * * *' # every 12 hours
17+
workflow_dispatch:
18+
19+
permissions:
20+
contents: read
21+
22+
concurrency:
23+
group: smoke-test-${{ github.ref }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
smoke-test:
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 30
30+
env:
31+
DOCKER_BUILDKIT: "1"
32+
SMOKE_TEST_BUILD_PROGRESS: plain
33+
steps:
34+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35+
- name: 🐳 smoke test
36+
run: bash ./scripts/smoke-test-docker.sh --image-tag socket-basics:smoke-test

.gitignore

Lines changed: 68 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,105 @@
1-
2-
.idea
3-
venv
4-
.venv
5-
build
6-
dist
7-
*.build
8-
*.dist
9-
*.egg-info
10-
test
11-
*.env
12-
run_container.sh
13-
*.zip
14-
bin
15-
scripts/*.py
16-
*.json
17-
markdown_overview_temp.md
18-
markdown_security_temp.md
1+
# OS files
192
.DS_Store
20-
*.pyc
21-
test.py
223

23-
# Note: requirements.txt is no longer needed - using pyproject.toml + uv.lock instead
24-
# Version files are auto-managed by .hooks/version-check.py
25-
*.cpython-312.pyc
26-
file_generator.py
27-
.env
28-
*.md
29-
test_results
30-
local_tests/
31-
custom_rules/
4+
# IDEs and editors
5+
.idea/
6+
.vscode/
7+
*.sublime-workspace
8+
*.sublime-project
9+
*.swp
10+
*~
3211

33-
# Common Python ignores
12+
# Python
3413
__pycache__/
3514
*.py[cod]
3615
*$py.class
16+
.python-version
17+
18+
# Virtual environments
19+
venv/
20+
.venv/
21+
env/
22+
ENV/
23+
env.bak/
24+
venv.bak/
25+
26+
# Build and distribution
27+
build/
28+
dist/
29+
*.build
30+
*.dist
31+
*.egg-info
32+
.eggs/
33+
*.egg
34+
35+
# Testing and coverage
3736
.pytest_cache/
3837
.mypy_cache/
3938
.coverage
4039
.coverage.*
4140
htmlcov/
41+
coverage/
42+
coverage.xml
43+
nosetests.xml
44+
test-results/
45+
test_results/
46+
47+
# pip
4248
pip-wheel-metadata/
4349
pip-log.txt
4450
pip-delete-this-directory.txt
4551

46-
# Virtual environments
47-
env/
48-
ENV/
49-
env.bak/
50-
venv.bak/
51-
52-
# IDEs and editors
53-
.vscode/
54-
.idea/
55-
*.sublime-workspace
56-
*.sublime-project
57-
*.swp
58-
*~
59-
6052
# Node
6153
node_modules/
6254
npm-debug.log*
6355
yarn-debug.log*
6456
yarn-error.log*
6557
.pnp/
6658

67-
# Build and distribution
68-
.eggs/
69-
*.egg
70-
dist/
71-
build/
72-
73-
# Coverage and test output
74-
coverage/
75-
coverage.xml
76-
nosetests.xml
77-
test-results/
59+
# Jupyter
60+
.ipynb_checkpoints/
7861

7962
# Logs and runtime files
80-
logs/
81-
63+
*.log
8264
*.pid
8365
*.sock
66+
logs/
8467

85-
# OS files
86-
.DS_Store
68+
# Temporary files
69+
*.tmp
70+
*.temp
71+
*.zip
8772

8873
# Binary and compiled
8974
*.exe
9075
*.dll
9176
*.so
9277
*.dylib
9378

94-
# Jupyter
95-
.ipynb_checkpoints/
96-
97-
# Local temporary files
98-
*.tmp
99-
*.temp
100-
# Ignore output logs and generated src files
101-
*.log
79+
# Environment and secrets
80+
*.env
10281

103-
.python-version
82+
# Data files (generated)
83+
*.json
10484
.socket.fact.json
10585

106-
custom_rules/
86+
# Markdown: ignore all except documentation
87+
*.md
88+
!README.md
89+
!docs/*.md
90+
!tests/README.md
91+
92+
# Project-specific (local scripts and test files)
93+
test/
94+
test.py
95+
run_container.sh
96+
bin/
97+
scripts/*.py
98+
!scripts/enrich_rules.py
99+
!scripts/rewrite_messages.py
100+
!scripts/update_cwe_catalog.py
101+
!scripts/verify_jira_dashboard_config.py
102+
!scripts/preview_pr_comments.py
103+
file_generator.py
104+
local_tests/
105+
custom_rules/

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
1919
RUN npm install -g socket
2020

2121
# Install Trivy
22-
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.67.2
22+
ARG TRIVY_VERSION=v0.69.2
23+
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin "${TRIVY_VERSION}"
2324

2425
# Install Trufflehog
25-
RUN curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin
26+
ARG TRUFFLEHOG_VERSION=v3.93.6
27+
RUN curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin "${TRUFFLEHOG_VERSION}"
2628

2729
# Install OpenGrep (connector/runtime dependency)
28-
RUN curl -fsSL https://raw.githubusercontent.com/opengrep/opengrep/main/install.sh | bash
30+
ARG OPENGREP_VERSION=v1.16.2
31+
RUN curl -fsSL https://raw.githubusercontent.com/opengrep/opengrep/main/install.sh | bash -s -- -v "${OPENGREP_VERSION}"
2932

3033
# Copy the specific files needed for the project
3134
COPY socket_basics /socket-basics/socket_basics

0 commit comments

Comments
 (0)