From 39bfb70ccfbe3cc3e4cdc5c39b9dea6c360d94ff Mon Sep 17 00:00:00 2001 From: therealsama <263038098+therealsama@users.noreply.github.com> Date: Sat, 23 May 2026 12:20:50 +0200 Subject: [PATCH] chore: strengthen repository security, CI, and community health - add a security policy and private GitHub advisory reporting path - add issue forms and disable blank public issues for stricter security intake - add CodeQL and OpenSSF Scorecard workflows - consolidate CI checks into a single fail-fast validate job - expand README with badges and deployment, security, and contributing guidance - add a contributor guide and pull request template --- .github/ISSUE_TEMPLATE/bug_report.yml | 73 ++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 5 ++ .github/ISSUE_TEMPLATE/feature_request.yml | 52 +++++++++++++ .github/pull_request_template.md | 17 +++++ .github/workflows/ci.yml | 21 +----- .github/workflows/codeql.yml | 38 ++++++++++ .github/workflows/scorecard.yml | 42 +++++++++++ CONTRIBUTING.md | 86 ++++++++++++++++++++++ README.md | 39 ++++++++-- SECURITY.md | 35 +++++++++ 10 files changed, 385 insertions(+), 23 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/scorecard.yml create mode 100644 CONTRIBUTING.md create mode 100644 SECURITY.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..41c4874 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,73 @@ +name: Bug report +description: Report a reproducible problem in the app, tests, or developer workflow. +title: "bug: " +labels: + - bug +body: + - type: markdown + attributes: + value: | + Thanks for filing a bug. Please include a clear reproduction so the issue can be triaged quickly. + + Security vulnerabilities should not be reported here. Use the private reporting flow in SECURITY.md instead. + - type: checkboxes + id: checks + attributes: + label: Pre-flight checks + options: + - label: I searched existing issues and did not find a duplicate. + required: true + - label: This is not a security vulnerability or private disclosure. + required: true + - type: textarea + id: summary + attributes: + label: What happened? + description: Describe the bug and the actual behavior. + placeholder: Opening a story from the mobile swipe view causes... + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps to reproduce + description: Be precise enough that someone else can follow the same path. + placeholder: | + 1. Open ... + 2. Tap ... + 3. Scroll or swipe ... + 4. Observe ... + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected behavior + placeholder: The comment thread should remain visible after... + validations: + required: true + - type: input + id: route + attributes: + label: Affected page, route, or feed + description: "Examples: ask, best, item detail, user profile" + placeholder: best feed + - type: textarea + id: environment + attributes: + label: Environment + description: Include browser, OS, device, and whether this happened in the installed PWA if relevant. + placeholder: macOS 15, Safari 18, desktop + validations: + required: true + - type: textarea + id: evidence + attributes: + label: Screenshots, logs, or recordings + description: Paste any helpful screenshots, console errors, or failing test output. + render: shell + - type: textarea + id: additional + attributes: + label: Additional context + description: Add any extra detail that may help reproduce or narrow down the problem. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..b1af709 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Security vulnerability report + url: https://github.com/hackertok/hackertok.github.io/security/advisories/new + about: Report security issues privately instead of opening a public issue. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..449d3e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,52 @@ +name: Feature request +description: Propose a product, UX, accessibility, or developer-experience improvement. +title: "feat: " +labels: + - enhancement +body: + - type: markdown + attributes: + value: | + Please describe the problem first, then the proposed change. Concrete use cases are much easier to evaluate than abstract ideas. + - type: checkboxes + id: checks + attributes: + label: Pre-flight checks + options: + - label: I searched existing issues and did not find a duplicate. + required: true + - label: This request is scoped to this project and not a security report. + required: true + - type: textarea + id: problem + attributes: + label: Problem or opportunity + description: What user or contributor pain point does this solve? + placeholder: It is currently difficult to... + validations: + required: true + - type: textarea + id: proposal + attributes: + label: Proposed change + description: Describe the behavior, UI, or workflow you want. + placeholder: Add a setting that lets users... + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Alternatives considered + description: List workarounds or other ideas you considered. + - type: textarea + id: context + attributes: + label: Additional context + description: Mockups, examples, links, or screenshots are helpful. + - type: checkboxes + id: contribution + attributes: + label: Contribution intent + options: + - label: I would be willing to open a pull request for this. + required: false diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..898748e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,17 @@ +## Summary + +Describe the change and its user-visible impact. + +## Related issues + +Link any relevant issue or write `none`. + +## Screenshots or recordings + +Include before/after screenshots or a short recording for UI changes when helpful. + +## Checklist + +- [ ] Changes are focused and avoid unrelated refactors +- [ ] Tests were added or updated when behavior changed +- [ ] Accessibility and mobile behavior were considered diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e27ab2..86d4d40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,8 +39,9 @@ jobs: LGPL-2.1-or-later, LGPL-3.0-only, LGPL-3.0-or-later, AGPL-3.0-only, AGPL-3.0-or-later - lint-and-build: + validate: runs-on: ubuntu-latest + timeout-minutes: 60 steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -66,24 +67,8 @@ jobs: - name: Build run: npm run build - e2e: - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Setup Node - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: '24' - cache: 'npm' - - - name: Install dependencies - run: npm ci - - name: Install Playwright Browsers run: npx playwright install --with-deps - name: Run Playwright tests - run: npx playwright test + run: npm run e2e diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..0da9c59 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,38 @@ +name: CodeQL + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: '30 1 * * 0' + +permissions: read-all + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + security-events: write + contents: read + + strategy: + fail-fast: false + matrix: + language: [javascript-typescript] + + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3 + with: + languages: ${{ matrix.language }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3 + with: + category: /language:${{ matrix.language }} diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000..f57e4f6 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,42 @@ +name: Scorecard + +on: + push: + branches: [main] + schedule: + - cron: '30 1 * * 6' + +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + security-events: write + id-token: write + + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Run Scorecard + uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 + with: + results_file: results.sarif + results_format: sarif + publish_results: true + + - name: Upload artifact + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + - name: Upload to code-scanning + uses: github/codeql-action/upload-sarif@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3 + with: + sarif_file: results.sarif diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9f2b1e8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,86 @@ +# Contributing to HackerTok + +Thanks for helping improve HackerTok. + +This project is a React + TypeScript + Vite progressive web app for browsing +Hacker News, with Vitest for unit tests and Playwright for end-to-end coverage. +The fastest way to make a useful contribution is to keep changes focused, +reproducible, and easy to review. + +## Before You Start + +- Search existing issues and pull requests before opening a new one. +- For larger changes, open an issue first so the scope and direction can be + aligned before implementation. +- Keep behavior changes small and isolated when possible. +- Security issues must follow [SECURITY.md](SECURITY.md), not public issues. + +## Development Setup + +### Prerequisites + +- Node.js +- npm + +### Install + +```bash +npm ci +``` + +### Start the app + +```bash +npm run dev +``` + +### Run tests locally + +```bash +npm run typecheck +npm run lint +npm run test:run +npm run build +``` + +If your change affects navigation, comments, theme behavior, responsive layout, +or touch/swipe interactions, also run Playwright: + +```bash +npx playwright install +npm run e2e +``` + +## Contribution Guidelines + +- Prefer TypeScript-first changes and match the existing React component style. +- Keep accessibility intact: keyboard support, focus behavior, semantics, and + readable states matter for this app. +- Preserve mobile behavior. Swipe flows, viewport sizing, and responsive layout + are part of the product surface, not edge cases. +- Reuse the existing Tailwind-based styling approach instead of adding a second + styling system. +- Avoid adding dependencies unless they solve a clear problem that the current + stack cannot reasonably handle. +- If you touch GitHub Actions, keep actions pinned to full commit SHAs. +- If you render remote HTML or user-generated content, keep the existing + sanitization guarantees intact. + +## Testing Expectations + +- Add or update tests when behavior changes. +- Prefer the narrowest test that proves the change. +- Run the relevant local checks before opening a pull request. +- For UI changes, include screenshots or a short recording when it helps review. + +## Pull Requests + +- Use a clear title and explain the user-visible impact. +- Link the related issue when one exists. +- Note the commands you ran locally. +- Call out follow-up work or known limitations explicitly. + +## Licensing + +By contributing to this repository, you agree that your contributions will be +licensed under the project's AGPL-3.0-only license. \ No newline at end of file diff --git a/README.md b/README.md index 3d3e103..569c2fe 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,13 @@
-

- hackertok.github.io -

-

An open-source, blazingly fast, progressive Hacker News client.

+

An open-source, blazingly fast, progressive Hacker News client.

+

+ CI + OpenSSF Scorecard + License: AGPL-3.0-only + HackerTok +


@@ -28,7 +31,33 @@ | ♾️ **Infinite Feed** | Swipe or scroll endlessly β€” no job posts, no hiring threads | | πŸ“² **Installable PWA** | Add to home screen for a native app experience | | β™Ώ **Accessible** | WCAG-tested with keyboard navigation and screen reader support | -| βš–οΈ **Open Source** | Free as in freedom, licensed under AGPL-3.0 | + +## πŸš€ Deployment + +The production site is published to GitHub Pages at [hackertok.github.io](https://hackertok.github.io). + +Deployments are release-driven rather than branch-driven. This keeps production tied to explicit versioned releases. + +## πŸ” Security + +This project follows a defense-in-depth model with strong governance, tightly controlled maintainer access, automated +dependency updates, security scanning, and modern open-source security best practices. + +Please report security vulnerabilities privately +through [GitHub Security Advisories](https://github.com/hackertok/hackertok.github.io/security/advisories/new), not +public issues. The full disclosure process is documented in [SECURITY.md](SECURITY.md). + +## πŸ› οΈ Tech Stack + +HackerTok is built with React, TypeScript, and Vite, styled with Tailwind CSS and Radix UI, and tested and automated +with Vitest, Playwright, and GitHub Actions. + +## 🀝 Contributing + +Contributions are welcome, especially bug fixes and focused improvements to performance, accessibility, mobile +ergonomics, and reading flow. + +For the full contribution workflow and review expectations, see [CONTRIBUTING.md](CONTRIBUTING.md). ## πŸ“œ License diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..2247dca --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,35 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +|---------|--------------------| +| Latest | :white_check_mark: | + +Only the latest released deployment of HackerTok receives security updates. Older releases are not maintained. + +## Reporting a Vulnerability + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them using [GitHub Security Advisories](https://github.com/hackertok/hackertok.github.io/security/advisories/new). + +You should receive an initial response within 72 hours. If the issue is confirmed, a fix will be released as soon as possible depending on complexity. + +### What to Include + +- Description of the vulnerability +- Steps to reproduce +- Potential impact +- Suggested fix (if any) + +## Security Measures + +This project employs the following security practices: + +- All GitHub Actions are pinned to full-length commit SHAs +- Automated dependency updates via Dependabot (daily) +- Dependency review on all pull requests +- CodeQL static analysis on pushes and pull requests to `main`, plus weekly scheduled scans +- OpenSSF Scorecard monitoring +- HTML sanitization via DOMPurify