Skip to content

Post-public-flip hardening tracker: branch protection, CodeQL, dep pinning, pre-commit activation, templates, CoC #144

@MartinCastroAlvarez

Description

@MartinCastroAlvarez

Summary

Captures the post-visibility-flip hardening backlog Security flagged on Discussion #127. None of these block the public flip; all of them are worth landing within the first cycle after the repo goes public so the hardening posture matches the public-target threat model.

Filing as a single tracker so the items don't drift into folklore. Each box is one or more separate PRs (mostly Tier 5 — human merge — because they touch pyproject.toml, .github/workflows/, or SECURITY.md).

Items

  • Enable branch protection on main (manual, GitHub Settings). Once the repo is public, Settings → Branches → Protection rules becomes available. Recommended ruleset (matches what pr-workflow.md already enforces by convention):

    • Require pull request before merging.
    • Require status checks to pass before merging (whenever CI lands — even an empty check makes the toggle settle).
    • Dismiss stale approvals when new commits are pushed.
    • Block force-push.
    • Block branch deletion.
    • Apply to administrators (so an admin can't bypass during a "quick fix").

    No PR for this — it's a GitHub Settings flip. Captured here for the audit trail.

  • CodeQL / code scanning workflow (.github/workflows/codeql.yml). Tier 5 — adds a new workflow file. Default Python + JavaScript queries. Schedule: weekly + on every PR. Free for public repos. Captures the same class of issues bandit / eslint already flag, but in the GitHub Security tab where reporters find them.

  • Enable Secret scanning + push protection (manual, GitHub Settings). Auto-enables on public repos but worth explicitly verifying — the existing gitleaks pre-commit hook + the test_s37_no_committed_token_patterns_in_head test become defence-in-depth against the GitHub-native check.

  • Tighten pyproject.toml dev-dep constraints to the Dependabot-fixed versions (Tier 5 — pyproject.toml). Current state:

    • black = "^24.8""^26.3.1" (matches the lockfile, blocks Poetry from resolving 26.3.0 on a fresh checkout).
    • pytest = "^8.0""^9.0.3" (matches the lockfile, blocks 9.0.09.0.2).
    • Same exercise for vite and esbuild on the frontend root if their constraints are looser than the lockfile.
  • Activate the pre-commit hook in CONTRIBUTING.md / scripts/lint.sh. Today .pre-commit-config.yaml carries gitleaks + bandit + custom pygrep hooks, but a fresh checkout has them inactive until the contributor runs pre-commit install. First external contributor will discover this after they push a commit that should have been caught locally. Two paths:

    • Document the install step prominently in CONTRIBUTING.md (Tier 1).
    • Add a pre-commit run --all-files invocation to scripts/lint.sh so the lint pipeline covers the same patterns even without the per-checkout install (Tier 3).
  • PAT rotation. Per Security's note on Discussion Go-public readiness: Architect lane assessment + 3-blocker plan (cross-role consensus) #127: the local-only PAT in .git/config should be rotated after the visibility flip on the principle that any local artifact eventually leaks. Repo-owner action — no PR.

  • Add a .github/ISSUE_TEMPLATE/ with at least:

    • consumer-integration.yml — structured form for real-consumer feedback (modelled on the laminr pilot in #116 — what mount? which Django version? which DRF/middleware? what broke?). Tier 1.
    • bug_report.yml — standard bug intake.
    • feature_request.yml — standard intake.

    Also a PULL_REQUEST_TEMPLATE.md that pre-fills the pr-workflow.md §5.1 checklist. Tier 1.

  • Add CODE_OF_CONDUCT.md. Drop-in Contributor Covenant 2.1. Tier 1. Was one of the original Discussion Go-public readiness: Architect lane assessment + 3-blocker plan (cross-role consensus) #127 blockers; deferred to a separate PR. Until it lands, the repo flip from private → public is still soft-blocked per the cross-role consensus.

Out of scope

  • Releases / TestPyPI / prod PyPI changes — those stay tier 6, human-only.
  • Any code change to the package itself — these items are CI / metadata only.

Priority + sequence

P1 / "first sprint after the public flip". The branch-protection + CodeQL + Secret-scanning enablement should be the same-day follow-up to the visibility flip; everything else can wait one sprint.

— filed by the Software Architect lane (claude-architect-opus47-2026-05-26-2), 2026-05-26. Cross-referenced to Discussion #127 cross-role consensus.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions