Skip to content

Commit 4230d6a

Browse files
alexph-devclaude
andcommitted
fix: comprehensive audit — 16 fixes across docs, code, and metadata
Documentation: remove non-existent --text flag, fix default format claims, fix jq pipe example, correct redirect URI default, add OS requirement note. Code: section index keyed by id (collision-safe), warn on --by-customer with json/txns, remove dead branch, remove unused param, add -o to create/update/ delete, extract _read_stdin_json + _txn_to_dict helpers, cached_property on GLSection, move calendar import to top-level, simplify output_text logic. Metadata: OS classifier POSIX, CHANGELOG backfilled 0.2-0.6. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0feebeb commit 4230d6a

5 files changed

Lines changed: 148 additions & 68 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# 2026-02-17 — Comprehensive Non-Security Audit Fixes
2+
3+
## Summary
4+
5+
16 fixes across 4 files covering documentation inaccuracies, code bugs,
6+
consistency issues, DRY violations, and performance improvements.
7+
8+
## Changes
9+
10+
### Documentation (README.md)
11+
- Removed non-existent `--text` flag from 2 gl-report examples
12+
- Fixed "JSON (default)" → "text (default)" in output format section
13+
- Added `-f json` to jq pipe example (was piping text to jq)
14+
- Fixed redirect URI default: "—" → `http://localhost:8844/callback`
15+
- Added macOS/Linux note (fcntl dependency)
16+
17+
### Metadata (pyproject.toml)
18+
- `Operating System :: OS Independent``Operating System :: POSIX`
19+
20+
### CHANGELOG.md
21+
- Backfilled versions 0.2 through 0.6 from git history
22+
23+
### Code (cli.py)
24+
- `_build_section_index`: keys by both name AND id (prevents collision)
25+
- `_find_gl_section`: prefers id-based lookup, 7 callers updated
26+
- `--by-customer` + json/txns: warns instead of silently ignoring
27+
- Dead `elif e_clean` branch removed from `_format_date_range`
28+
- `Config.validate(need_tokens)`: unused param removed, both callers updated
29+
- `create`/`update`/`delete` parsers: added `-o`/`--output` flag
30+
- `auth status`: now uses `_resolve_fmt()` like all other commands
31+
- `_read_stdin_json()`: extracted from duplicate stdin-read pattern
32+
- `_txn_to_dict()`: extracted from duplicate 8-field dict literal
33+
- `import calendar` moved to top-level (was deferred in function body)
34+
- GLSection: `@property``@functools.cached_property` (3 properties)
35+
- `output_text`: simplified confusing double-isinstance check
36+
37+
## Verification
38+
- `ruff check`
39+
- `ruff format --check`
40+
- `py_compile`

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
# Changelog
22

3+
## 0.6.0 (2026-02-17)
4+
5+
- Security hardening: OAuth `state` parameter validation (CSRF protection)
6+
- Security: lock file permissions restricted to `0o600`
7+
- Performance: O(n) account tree and GL section lookups (was O(n^2))
8+
- Fix: LIKE wildcard `%` stripped in query escaping
9+
- Fix: version defined in single source (`__init__.py`), no more triplication
10+
- CI: GitHub Actions pinned to immutable commit SHAs
11+
- Python 3.9 compatibility restored (`from __future__ import annotations`)
12+
13+
## 0.5.0 (2026-02-16)
14+
15+
- Fix: author metadata updated in package config
16+
17+
## 0.4.0 (2026-02-16)
18+
19+
- Security: SQL injection prevention, directory permission hardening
20+
- Fix: entity paths auto-lowercase for get/create/update/delete
21+
- Text output for single entities shows key-value pairs
22+
23+
## 0.3.0 (2026-02-16)
24+
25+
- Text output as default for all commands
26+
- Per-subcommand `-o` output flag
27+
- `gl-report --by-customer` / `-g` flag with customer grouping
28+
- `gl-report` output modes: text, json, txns, expanded
29+
- `gl-report --no-sub` flag to roll up sub-accounts
30+
- Customer filter made optional in `gl-report`
31+
32+
## 0.2.0 (2026-02-16)
33+
34+
- `qbo auth setup` interactive config wizard
35+
- `config.json.example` added
36+
- `qbo gl-report` subcommand — hierarchical GL reports by account and customer
37+
- CI/CD: lint workflow + auto-publish to PyPI on release
38+
339
## 0.1.0 (2026-02-16)
440

541
Initial release.

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Built for QuickBooks automation — giving AI agents (like [OpenClaw](https://op
2222
pip install qbo-cli
2323
```
2424

25-
Requires Python 3.9+.
25+
Requires Python 3.9+ on macOS or Linux (uses `fcntl` for file locking).
2626

2727
## Setup
2828

@@ -188,30 +188,33 @@ qbo gl-report --list-accounts
188188
# Drill into a specific account's sub-accounts
189189
qbo gl-report -a 125 --list-accounts
190190

191-
# Generate a report (JSON by default)
191+
# Generate a report (text by default)
192192
qbo gl-report -c "John Smith" -a 125
193193

194194
# Human-readable text with currency prefix
195-
qbo gl-report -c "John Smith" -a 125 --text --currency USD
195+
qbo gl-report -c "John Smith" -a 125 --currency USD
196196

197197
# Custom date range
198198
qbo gl-report -c "John Smith" -a "Revenue" --start 2025-01-01 --end 2025-12-31
199199

200200
# Dates default to: first transaction → today
201-
qbo gl-report -c "John Smith" -a 125 --text
201+
qbo gl-report -c "John Smith" -a 125
202202
```
203203

204204
### Output formats
205205

206206
```bash
207-
# JSON (default)
207+
# Text output (default, human-readable table)
208208
qbo query "SELECT * FROM Customer"
209209

210+
# JSON
211+
qbo query "SELECT * FROM Customer" -f json
212+
210213
# TSV (tab-separated, for spreadsheets/awk)
211214
qbo query "SELECT * FROM Customer" -f tsv
212215

213216
# Pipe to jq
214-
qbo query "SELECT * FROM Customer" | jq '.[].DisplayName'
217+
qbo query "SELECT * FROM Customer" -f json | jq '.[].DisplayName'
215218
```
216219

217220
### Sandbox mode
@@ -230,7 +233,7 @@ export QBO_SANDBOX=true
230233
|---------|-------------|------------|---------|
231234
| Client ID | `QBO_CLIENT_ID` | `client_id` ||
232235
| Client Secret | `QBO_CLIENT_SECRET` | `client_secret` ||
233-
| Redirect URI | `QBO_REDIRECT_URI` | `redirect_uri` | — (must match your Intuit app) |
236+
| Redirect URI | `QBO_REDIRECT_URI` | `redirect_uri` | `http://localhost:8844/callback` |
234237
| Realm ID | `QBO_REALM_ID` | `realm_id` | From auth flow |
235238
| Sandbox mode | `QBO_SANDBOX` | `sandbox` | `false` |
236239

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ classifiers = [
1919
"Intended Audience :: Developers",
2020
"Intended Audience :: Financial and Insurance Industry",
2121
"License :: OSI Approved :: MIT License",
22-
"Operating System :: OS Independent",
22+
"Operating System :: POSIX",
2323
"Programming Language :: Python :: 3",
2424
"Programming Language :: Python :: 3.9",
2525
"Programming Language :: Python :: 3.10",

0 commit comments

Comments
 (0)