Skip to content

Repo hygiene + cookie hardening + initial test suite#1

Merged
jcddc83 merged 3 commits into
mainfrom
claude/audit-github-repo-EWQDn
May 19, 2026
Merged

Repo hygiene + cookie hardening + initial test suite#1
jcddc83 merged 3 commits into
mainfrom
claude/audit-github-repo-EWQDn

Conversation

@jcddc83

@jcddc83 jcddc83 commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

Post-v1.0.0 audit pass. Three logical chunks, each in its own commit:

  1. Repo hygiene (f9076bb) — pyproject.toml (pip-installable, substack-link-checker console entry point), GitHub Actions CI (ruff lint + Py 3.8/3.10/3.12 smoke test + build), SECURITY.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md, CHANGELOG.md, issue/PR templates, Dependabot, .env.example, README fixes (wrong clone URL, CI badge, pip-install path).
  2. Version correction (cc60b3c) — pyproject 0.1.01.0.0 to match the existing v1.0.0 git tag and Release; CHANGELOG rewritten to reference the real v1.0.0 release notes; SECURITY.md softens the private-advisory link in case that GitHub setting isn't enabled.
  3. Cookie audit + first test suite (2ff2899):
    • SUBSTACK_COOKIE env var now supported (was promised in .env.example but unimplemented). --cookie still wins if both are set, so you can override ad-hoc.
    • --cookie help text + README + SECURITY.md updated to recommend the env var (CLI args leak into shell history and ps aux).
    • 29-test pytest suite under tests/ covering domain filtering, CSV report writing, history persistence, and cookie-handling guarantees (the cookie tests pin SECURITY.md's no-leak promises as executable contracts).
    • CI's pytest step no longer runs with continue-on-error: true.
    • ruff format auto-applied across the repo so the format check passes.

What's NOT in this PR

  • Repo settings that need the GitHub UI: enabling Discussions, enabling private vulnerability reporting, branch protection on main, setting the About → Website URL.
  • Phase B follow-ups that should be their own PRs: release automation workflow (B6), package refactor into src/ (B3), CodeQL + pre-commit (B7), type hints + mypy (B8), README screenshot + 403/expired-cookie troubleshooting (B9), optional HTML report mode (B10).

Test plan

  • CI green on this PR (lint + Py 3.8/3.10/3.12 import + pytest + build)
  • pip install -e . then substack-link-checker --help works locally
  • SUBSTACK_COOKIE=abc python substack_link_checker.py --base-url ... --year 2024 --limit 1 uses the env var (verified by unit test, worth a manual smoke against a real Substack)
  • After merge: cut v1.1.0 tag/release (once B6 release automation lands, this becomes one-step)

Generated by Claude Code

claude added 3 commits May 18, 2026 19:05
- pyproject.toml makes the project pip-installable with a
  substack-link-checker console entry point
- GitHub Actions CI workflow (ruff lint, multi-version Python smoke
  tests, build artifact)
- SECURITY.md with vulnerability reporting and session-cookie guidance
- CONTRIBUTING.md, CODE_OF_CONDUCT.md, CHANGELOG.md
- Issue and PR templates under .github/
- Dependabot for pip and github-actions
- .env.example documenting supported env vars
- Fix incorrect clone URL in README, add CI badge
- pyproject.toml: 0.1.0 -> 1.0.0 to match the existing git tag and
  GitHub Release
- CHANGELOG.md: replace fabricated 0.1.0 entry with a real 1.0.0 -
  2026-01-01 section sourced from the v1.0.0 release notes; keep
  Unreleased section for the audit-branch additions
- SECURITY.md: clarify the private-advisory link may 404 if the
  setting is not enabled, and reinforce no-exploit-details rule
Cookie handling (B2):
- main() now reads SUBSTACK_COOKIE env var; --cookie still wins if both
  are set so users can override ad-hoc. This is the path README and
  .env.example were already promising.
- --cookie help text now warns about shell-history / ps aux exposure
  and points at the env var.
- README: env var is documented as the recommended path; --cookie is
  shown as the fallback.
- SECURITY.md: explicit guidance on env-var-vs-CLI; documents that the
  cookie is .substack.com-scoped on the requests session and that the
  outbound aiohttp link-check session is cookie-less.

Tests (B1):
- New tests/ suite with 29 tests covering:
  - should_skip_domain / is_broken_domain (exact, subdomain, lookalike,
    case-insensitive, malformed URL)
  - load_domains_from_file (comments, blanks, whitespace, missing file)
  - generate_report (empty results skip file; CSV header + rows; comma
    escaping in titles)
  - load/save history round-trip + corrupt-JSON recovery +
    filter_unchecked_posts
  - cookie handling: scoped to substack.com, not leaked via _log,
    history file, or repr; env-var fallback and CLI override
- pytest now runs without continue-on-error in CI.
- Also: ruff format auto-applied across the repo (cosmetic only), so
  CI's `ruff format --check .` passes.
@jcddc83 jcddc83 merged commit bb56c45 into main May 19, 2026
5 checks passed
@jcddc83 jcddc83 deleted the claude/audit-github-repo-EWQDn branch May 19, 2026 15:19
jcddc83 pushed a commit that referenced this pull request May 19, 2026
The CI test job has been running `python substack_link_checker.py --help`
as a post-install smoke test since PR #1. B3 (PR #3) deleted that file
when refactoring the codebase into the src-layout package, but didn't
update this step. CI has been failing on every PR since B3 merged.

Replace with two invocations against the installed console script:
- `substack-link-checker --help` (top-level dispatcher)
- `substack-link-checker check --help` (check subcommand)

This is also why the actions/checkout Dependabot PR (#7) was reported
as failing — same root cause, not the action bump itself.
jcddc83 added a commit that referenced this pull request May 19, 2026
)

* Prepare v1.1.0: bump version + fix stale troubleshooting invocations

Version bump:
- pyproject.toml: 1.0.0 -> 1.1.0
- src/substack_link_checker/__init__.py: __version__ -> 1.1.0
- CHANGELOG.md: rename [Unreleased] -> [1.1.0] - 2026-05-19, add a
  fresh empty [Unreleased] section above it

Troubleshooting fix:
- README.md Troubleshooting section's code blocks still used the
  pre-refactor `python substack_link_checker.py ...` /
  `python fetch_archive_urls.py ...` form because PR #4 was based on
  the audit branch before B3's CLI rewrite landed. Updated to the
  current `substack-link-checker check ...` and
  `substack-link-checker fetch-archive ...` invocations so a reader
  following the troubleshooting steps doesn't hit "command not found"
  on the main entry point.

Once this lands, push tag v1.1.0 to trigger the release workflow
(which builds the wheel/sdist and attaches them to the GitHub
Release).

* Fix CI smoke test (root-level substack_link_checker.py is gone)

The CI test job has been running `python substack_link_checker.py --help`
as a post-install smoke test since PR #1. B3 (PR #3) deleted that file
when refactoring the codebase into the src-layout package, but didn't
update this step. CI has been failing on every PR since B3 merged.

Replace with two invocations against the installed console script:
- `substack-link-checker --help` (top-level dispatcher)
- `substack-link-checker check --help` (check subcommand)

This is also why the actions/checkout Dependabot PR (#7) was reported
as failing — same root cause, not the action bump itself.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants