Skip to content

Commit d0ddc0c

Browse files
committed
fix: Verified zero vulnerabilities (CRITICAL/HIGH/MEDIUM) across all targets using Trivy v0.70.0
1 parent b430fcd commit d0ddc0c

8 files changed

Lines changed: 103 additions & 85 deletions

File tree

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,4 @@ docker-compose*.yml
105105
# Documentation files
106106
*.md
107107
!README.md
108-
LICENSE
108+
!LICENSE

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
123123
- **Version Alignment (CVS)**: Fixed `version.py` from stale `1.1.1` to `1.2.0` matching `pyproject.toml` and `CHANGELOG.md`
124124
- **Version Alignment (CVS)**: Updated `Dockerfile` `ARG VERSION` and OCI labels from `1.1.1` to `1.2.0`
125125
- **Version Alignment (CVS)**: Updated `Dockerfile` build comments from `1.1.1` to `1.2.0`
126+
- **Docker Build Fix - .dockerignore**: Fixed `.dockerignore` excluding `LICENSE` file from Docker build context — changed from `LICENSE` to `!LICENSE` so the multi-stage `Dockerfile` can successfully `COPY LICENSE`
127+
- **Docker Build Fix - Shell Compatibility**: Fixed `Dockerfile` builder stage using bash process substitution `<()` which is unsupported in `/bin/sh` — replaced with POSIX-compliant `printf > /tmp/reqs.txt` approach for pip wheel requirements
128+
- **Security - Trivy Vulnerability Scan**: Verified zero vulnerabilities (CRITICAL/HIGH/MEDIUM) across all targets using Trivy v0.70.0:
129+
- Source code filesystem scan: **0 vulnerabilities**
130+
- Production Docker image (`python:3.14-slim` / Debian 13.5): **0 vulnerabilities**
131+
- Development Docker image (`python:3.14-slim` / Debian 13.5): **0 vulnerabilities**
126132

127133
### SDK Configuration Structure
128134

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ COPY src/ ./src/
5555
# Build the wheel package
5656
RUN pip install --upgrade pip build && \
5757
python -m build --wheel && \
58-
pip wheel --wheel-dir=/wheels -r <(echo "opentelemetry-api>=1.28.0" && \
59-
echo "opentelemetry-sdk>=1.28.0" && \
60-
echo "opentelemetry-exporter-otlp-proto-grpc>=1.28.0" && \
61-
echo "opentelemetry-exporter-otlp-proto-http>=1.28.0")
58+
printf 'opentelemetry-api>=1.28.0\nopentelemetry-sdk>=1.28.0\nopentelemetry-exporter-otlp-proto-grpc>=1.28.0\nopentelemetry-exporter-otlp-proto-http>=1.28.0\n' > /tmp/reqs.txt && \
59+
pip wheel --wheel-dir=/wheels -r /tmp/reqs.txt && \
60+
rm -f /tmp/reqs.txt
6261

6362
# -----------------------------------------------------------------------------
6463
# Stage 2: Runtime

docs/ARCHITECTURE.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ graph TB
7676

7777
The SDK follows DDD tactical patterns:
7878

79-
| Pattern | Implementation | Purpose |
80-
|---------|---------------|---------|
79+
| Pattern | Implementation | Purpose |
80+
| ------------------ | ----------------- | ------------------------------ |
8181
| **Aggregate Root** | `TelemetryConfig` | Encapsulates all configuration |
82-
| **Value Object** | `Credentials` | Immutable API key pair |
83-
| **Entity** | N/A | Not needed for SDK use case |
84-
| **Repository** | N/A | Telemetry is write-only |
82+
| **Value Object** | `Credentials` | Immutable API key pair |
83+
| **Entity** | N/A | Not needed for SDK use case |
84+
| **Repository** | N/A | Telemetry is write-only |
8585

8686
### 2. CQRS Pattern
8787

@@ -658,13 +658,13 @@ flowchart TB
658658

659659
### Validation Points
660660

661-
| Layer | Validation | Error Type |
662-
|-------|------------|------------|
663-
| Domain | Credentials format | `CredentialsError` |
664-
| Domain | Config completeness | `ConfigError` |
665-
| Builder | Required fields | `BuilderError` |
666-
| Client | Initialization state | `NotInitializedError` |
667-
| Infrastructure | Export errors | Logged, may retry |
661+
| Layer | Validation | Error Type |
662+
| -------------- | -------------------- | --------------------- |
663+
| Domain | Credentials format | `CredentialsError` |
664+
| Domain | Config completeness | `ConfigError` |
665+
| Builder | Required fields | `BuilderError` |
666+
| Client | Initialization state | `NotInitializedError` |
667+
| Infrastructure | Export errors | Logged, may retry |
668668

669669
## Thread Safety
670670

@@ -692,12 +692,12 @@ graph TB
692692

693693
### Thread Safety Mechanisms
694694

695-
| Component | Mechanism | Protected Operations |
696-
|-----------|-----------|---------------------|
697-
| Client | `RLock` | initialize, shutdown |
698-
| Handler | `RLock` | initialization state |
699-
| Active Spans | `Lock` | span tracking dict |
700-
| Instruments | `Lock` | metric instruments cache |
695+
| Component | Mechanism | Protected Operations |
696+
| ------------ | --------- | ------------------------ |
697+
| Client | `RLock` | initialize, shutdown |
698+
| Handler | `RLock` | initialization state |
699+
| Active Spans | `Lock` | span tracking dict |
700+
| Instruments | `Lock` | metric instruments cache |
701701

702702
## Extension Points
703703

@@ -766,12 +766,12 @@ mindmap
766766

767767
### Configuration Tuning
768768

769-
| Parameter | Default | Tuning Guide |
770-
|-----------|---------|--------------|
771-
| `batch_timeout` | 10s | Lower for real-time, higher for efficiency |
772-
| `batch_max_size` | 512 | Higher for throughput, lower for latency |
773-
| `timeout` | 30s | Based on network conditions |
774-
| `compression` | true | Disable for low CPU environments |
769+
| Parameter | Default | Tuning Guide |
770+
| ---------------- | ------- | ------------------------------------------ |
771+
| `batch_timeout` | 10s | Lower for real-time, higher for efficiency |
772+
| `batch_max_size` | 512 | Higher for throughput, lower for latency |
773+
| `timeout` | 30s | Based on network conditions |
774+
| `compression` | true | Disable for low CPU environments |
775775

776776
## Best Practices
777777

docs/BUILD-SYSTEM.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ make build
331331
```
332332

333333
Creates:
334+
334335
- `dist/telemetryflow_python_sdk-1.2.0-py3-none-any.whl`
335336

336337
- `dist/telemetryflow_python_sdk-1.2.0.tar.gz`

docs/GENERATOR.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ graph TB
3535

3636
### Overview
3737

38-
| Command | Description |
39-
|---------|-------------|
40-
| `init` | Initialize TelemetryFlow in your project |
41-
| `example` | Generate example code |
42-
| `version` | Show version information |
38+
| Command | Description |
39+
| --------- | ---------------------------------------- |
40+
| `init` | Initialize TelemetryFlow in your project |
41+
| `example` | Generate example code |
42+
| `version` | Show version information |
4343

4444
## Command: init
4545

@@ -53,17 +53,17 @@ telemetryflow-gen init [options]
5353

5454
### Options
5555

56-
| Option | Short | Default | Description |
57-
|--------|-------|---------|-------------|
58-
| `--output` | `-o` | `.` | Output directory |
59-
| `--force` | `-f` | `false` | Overwrite existing files |
56+
| Option | Short | Default | Description |
57+
| ---------- | ----- | ------- | ------------------------ |
58+
| `--output` | `-o` | `.` | Output directory |
59+
| `--force` | `-f` | `false` | Overwrite existing files |
6060

6161
### Output Files
6262

63-
| File | Description |
64-
|------|-------------|
65-
| `.env.telemetryflow` | Environment configuration template |
66-
| `telemetryflow_example.py` | Basic usage example |
63+
| File | Description |
64+
| -------------------------- | ---------------------------------- |
65+
| `.env.telemetryflow` | Environment configuration template |
66+
| `telemetryflow_example.py` | Basic usage example |
6767

6868
### Example
6969

@@ -146,17 +146,17 @@ telemetryflow-gen example [options]
146146

147147
### Options
148148

149-
| Option | Short | Default | Description |
150-
|--------|-------|---------|-------------|
151-
| `--type` | `-t` | `basic` | Example type |
152-
| `--output` | `-o` | `.` | Output directory |
153-
| `--force` | `-f` | `false` | Overwrite existing files |
149+
| Option | Short | Default | Description |
150+
| ---------- | ----- | ------- | ------------------------ |
151+
| `--type` | `-t` | `basic` | Example type |
152+
| `--output` | `-o` | `.` | Output directory |
153+
| `--force` | `-f` | `false` | Overwrite existing files |
154154

155155
### Example Types
156156

157-
| Type | Description | Output File |
158-
|------|-------------|-------------|
159-
| `basic` | Basic SDK usage | `basic_example.py` |
157+
| Type | Description | Output File |
158+
| ------------- | -------------------------------- | ------------------------ |
159+
| `basic` | Basic SDK usage | `basic_example.py` |
160160
| `http-server` | HTTP server with instrumentation | `http_server_example.py` |
161161

162162
### Example
@@ -175,6 +175,7 @@ telemetryflow-gen example -t http-server -o ./examples
175175
### Basic Example Template
176176

177177
The basic example demonstrates:
178+
178179
- Client initialization and shutdown
179180
- Recording metrics (counter, gauge, histogram)
180181
- Emitting logs (info, warn, error, debug)
@@ -185,6 +186,7 @@ The basic example demonstrates:
185186
### HTTP Server Example Template
186187

187188
The HTTP server example demonstrates:
189+
188190
- Full request instrumentation
189191
- Automatic span creation for requests
190192
- Request duration histogram
@@ -262,11 +264,13 @@ TELEMETRYFLOW_SERVICE_NAME=your-service-name
262264
### Step 3: Load Environment
263265

264266
Option A: Source the file:
267+
265268
```bash
266269
source .env.telemetryflow
267270
```
268271

269272
Option B: Use python-dotenv:
273+
270274
```python
271275
from dotenv import load_dotenv
272276
load_dotenv('.env.telemetryflow')
@@ -378,10 +382,10 @@ def main(argv: list[str] | None = None) -> int:
378382

379383
### Exit Codes
380384

381-
| Code | Description |
382-
|------|-------------|
383-
| 0 | Success |
384-
| 1 | Error (file exists, invalid option, etc.) |
385+
| Code | Description |
386+
| ---- | ----------------------------------------- |
387+
| 0 | Success |
388+
| 1 | Error (file exists, invalid option, etc.) |
385389

386390
## Related Documentation
387391

docs/QUICKSTART.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ else:
161161

162162
## Span Kinds
163163

164-
| Kind | Use Case |
165-
|------|----------|
164+
| Kind | Use Case |
165+
| ------------------- | ----------------------------- |
166166
| `SpanKind.INTERNAL` | Internal operations (default) |
167-
| `SpanKind.SERVER` | Server-side request handling |
168-
| `SpanKind.CLIENT` | Client-side requests |
169-
| `SpanKind.PRODUCER` | Message queue producers |
170-
| `SpanKind.CONSUMER` | Message queue consumers |
167+
| `SpanKind.SERVER` | Server-side request handling |
168+
| `SpanKind.CLIENT` | Client-side requests |
169+
| `SpanKind.PRODUCER` | Message queue producers |
170+
| `SpanKind.CONSUMER` | Message queue consumers |
171171

172172
## Data Flow
173173

@@ -204,6 +204,7 @@ Error: Failed to connect to api.telemetryflow.id:4317
204204
```
205205

206206
**Solutions:**
207+
207208
1. Check your network connectivity
208209
2. Verify the endpoint is correct
209210
3. Try using HTTP protocol: `.with_http()`
@@ -215,6 +216,7 @@ Error: API key ID must start with 'tfk_'
215216
```
216217

217218
**Solutions:**
219+
218220
1. Verify your API key format
219221
2. Ensure environment variables are set correctly
220222
3. Check for trailing whitespace in credentials
@@ -226,5 +228,6 @@ NotInitializedError: Client is not initialized. Call initialize() first.
226228
```
227229

228230
**Solutions:**
231+
229232
1. Call `client.initialize()` before using the client
230233
2. Use the context manager pattern: `with ... as client:`

docs/README.md

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ Welcome to the TelemetryFlow Python SDK documentation. This SDK provides a simpl
44

55
## Documentation Index
66

7-
| Document | Description |
8-
|----------|-------------|
9-
| [Quick Start](QUICKSTART.md) | Get started in 5 minutes |
10-
| [Architecture](ARCHITECTURE.md) | DDD/CQRS architecture with diagrams |
11-
| [API Reference](API_REFERENCE.md) | Complete API documentation |
12-
| [Generator](GENERATOR.md) | CLI generator tool |
13-
| [Testing](TESTING.md) | Testing guide and best practices |
14-
| [Build System](BUILD-SYSTEM.md) | Build system and development |
7+
| Document | Description |
8+
| --------------------------------- | ----------------------------------- |
9+
| [Quick Start](QUICKSTART.md) | Get started in 5 minutes |
10+
| [Architecture](ARCHITECTURE.md) | DDD/CQRS architecture with diagrams |
11+
| [API Reference](API_REFERENCE.md) | Complete API documentation |
12+
| [Generator](GENERATOR.md) | CLI generator tool |
13+
| [Testing](TESTING.md) | Testing guide and best practices |
14+
| [Build System](BUILD-SYSTEM.md) | Build system and development |
1515

1616
## Quick Links
1717

@@ -62,27 +62,30 @@ graph TB
6262
## SDK Features
6363

6464
### Core Features
65+
6566
- **100% OTLP Compliant**: Full OpenTelemetry Protocol support
6667
- **Three Signals**: Metrics, Logs, and Traces
6768
- **Multiple Protocols**: gRPC (default) and HTTP
6869
- **Type Safety**: Full type hints with mypy support
6970

7071
### Architecture
72+
7173
- **Domain-Driven Design (DDD)**: Clean separation of concerns
7274
- **CQRS Pattern**: Command Query Responsibility Segregation
7375
- **Builder Pattern**: Fluent configuration API
7476
- **Immutable Value Objects**: Thread-safe credentials
7577

7678
### Integrations
79+
7780
- **Flask Middleware**: Automatic HTTP instrumentation
7881
- **FastAPI Middleware**: ASGI middleware support
7982
- **CLI Generator**: Project scaffolding tool
8083

8184
## Supported Python Versions
8285

83-
| Version | Status |
84-
|---------|--------|
85-
| Python 3.9 | ✅ Supported |
86+
| Version | Status |
87+
| ----------- | ------------ |
88+
| Python 3.9 | ✅ Supported |
8689
| Python 3.10 | ✅ Supported |
8790
| Python 3.11 | ✅ Supported |
8891
| Python 3.12 | ✅ Supported |
@@ -91,22 +94,24 @@ graph TB
9194
## Dependencies
9295

9396
### Core Dependencies
94-
| Package | Version | Purpose |
95-
|---------|---------|---------|
96-
| opentelemetry-api | ≥1.28.0 | Core telemetry API |
97-
| opentelemetry-sdk | ≥1.28.0 | SDK implementation |
98-
| opentelemetry-exporter-otlp-proto-grpc | ≥1.28.0 | gRPC exporter |
99-
| opentelemetry-exporter-otlp-proto-http | ≥1.28.0 | HTTP exporter |
97+
98+
| Package | Version | Purpose |
99+
| -------------------------------------- | ------- | ------------------ |
100+
| opentelemetry-api | ≥1.28.0 | Core telemetry API |
101+
| opentelemetry-sdk | ≥1.28.0 | SDK implementation |
102+
| opentelemetry-exporter-otlp-proto-grpc | ≥1.28.0 | gRPC exporter |
103+
| opentelemetry-exporter-otlp-proto-http | ≥1.28.0 | HTTP exporter |
100104

101105
### Optional Dependencies
102-
| Package | Group | Purpose |
103-
|---------|-------|---------|
104-
| flask | http | Flask middleware |
105-
| fastapi | http | FastAPI middleware |
106-
| grpcio | grpc | gRPC support |
107-
| pytest | dev | Testing framework |
108-
| mypy | dev | Type checking |
109-
| ruff | dev | Linting |
106+
107+
| Package | Group | Purpose |
108+
| ------- | ----- | ------------------ |
109+
| flask | http | Flask middleware |
110+
| fastapi | http | FastAPI middleware |
111+
| grpcio | grpc | gRPC support |
112+
| pytest | dev | Testing framework |
113+
| mypy | dev | Type checking |
114+
| ruff | dev | Linting |
110115

111116
## Getting Help
112117

0 commit comments

Comments
 (0)