Skip to content

Commit ded4203

Browse files
authored
v2.0: Modernization (M1-M6, 44 tasks) (#374)
v2.0: Modernization (M1-M6, 44 tasks)
2 parents ef668a4 + ff7ba77 commit ded4203

594 files changed

Lines changed: 87503 additions & 11147 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codacy.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
# Codacy project configuration.
3+
#
4+
# specs/ holds internal groundwork artifacts (product specs, architecture
5+
# notes, task records, review notes). They are not user-facing docs and are
6+
# not subject to the same markdown style as README/ChangeLog/CONTRIBUTING.
7+
#
8+
# test/*.md are internal test-suite documents (e.g. the v2.0 routing
9+
# regression gate at test/REGRESSION.md). Same rationale as specs/.
10+
exclude_paths:
11+
- 'specs/**'
12+
- 'test/*.md'
13+
- 'test/**/*.md'

.codacy.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# Codacy repository configuration.
3+
#
4+
# Every finding Codacy raised on the v2.0 work was triaged as a false positive
5+
# or a cosmetic style nit; none was a genuine defect, and code-"fixing" most of
6+
# them would have broken already-green structural gates (check-readme.sh /
7+
# check-release-notes.sh assert byte-for-byte snippets and exact section/token
8+
# counts) or the public API.
9+
#
10+
# Codacy's config file cannot enable/disable tools (that is dashboard-only) and
11+
# is read from the repository's DEFAULT branch, so the only lever available here
12+
# is exclude_paths — global, and per-engine for the tools whose findings on the
13+
# library sources are all false positives. Globs are Java-glob: `dir/**` matches
14+
# everything under dir; `**.ext` matches that extension anywhere.
15+
16+
# Non-source trees are covered by their own purpose-built gates in
17+
# .github/workflows/verify-build.yml (check-readme, check-release-notes, cpplint,
18+
# the DR-008 stress/valgrind lanes, shellcheck-free CI helpers, etc.), not by
19+
# Codacy's generic linters. Markdown prose, tests, examples, historical review
20+
# specs and CI helper scripts produce only style/heuristic noise here.
21+
exclude_paths:
22+
- 'test/**'
23+
- 'examples/**'
24+
- 'docs/**'
25+
- 'specs/**'
26+
- 'scripts/**'
27+
- '**.md'
28+
29+
engines:
30+
# cppcheck's unusedStructMember fires on public-API struct/class fields
31+
# (features::tls, peer_address::bytes, the hook-context structs, ...) read by
32+
# library *consumers*, not within the analyzed TU, and flags the correct
33+
# unique_ptr::release() ownership transfer in webserver_websocket.cpp as an
34+
# ignored return — all false positives. The authoritative cppcheck gate
35+
# (cppcheck --error-exitcode=1 with the repo's own suppressions) runs green in
36+
# GitHub Actions, so dropping Codacy's redundant copy over src/ loses nothing.
37+
cppcheck:
38+
exclude_paths:
39+
- 'src/**'
40+
# Flawfinder flags every strlen()/strncasecmp() on a \0-terminated char-array
41+
# literal as a potential over-read (CWE-126 / CWE-120); in this codebase those
42+
# arguments are always constexpr constants, so every hit is a false positive.
43+
flawfinder:
44+
exclude_paths:
45+
- 'src/**'
Lines changed: 64 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
name: "CodeQL"
22

3+
# Supply-chain hardening (TASK-090): every action below is pinned to a full
4+
# 40-hex commit SHA, mirroring the convention in verify-build.yml. The trailing
5+
# `# vX.Y.Z` comment records the upstream release tag each SHA corresponds to,
6+
# for rotation.
7+
#
8+
# Pinned actions and how to rotate them (read-only `gh` API; dereference the
9+
# annotated tag to its commit SHA):
10+
# actions/checkout v4.2.2 -> 11bd71901bbe5b1630ceea73d27597364c9af683
11+
# (kept identical to verify-build.yml so both workflows rotate together)
12+
# gh api repos/actions/checkout/git/refs/tags/v4.2.2 --jq .object.sha
13+
# github/codeql-action/* v3.36.3 -> 411c4c9a36b3fca4d674f06b6396b2c6d23522c6
14+
# init AND analyze ship from one repo/release and MUST share one SHA.
15+
# SHA=$(gh api repos/github/codeql-action/git/refs/tags/v3.36.3 --jq .object.sha)
16+
# gh api repos/github/codeql-action/git/tags/$SHA --jq .object.sha # deref annotated tag
17+
# (@v1/@v2 of codeql-action are deprecated; v3 is the current major.)
18+
319
on:
420
push:
521
branches: [master]
@@ -9,6 +25,17 @@ on:
925
schedule:
1026
- cron: '0 4 * * 4'
1127

28+
# Least-privilege GITHUB_TOKEN: restrict to exactly what the CodeQL scan
29+
# needs. `security-events: write` is required by github/codeql-action/analyze
30+
# to upload the SARIF report to the security dashboard. `contents: read` is
31+
# required by actions/checkout. `actions: read` is required on some GitHub
32+
# plans/repository configurations to read the workflow run. Without an
33+
# explicit block the token defaults to the repository's global setting.
34+
permissions:
35+
actions: read
36+
contents: read
37+
security-events: write
38+
1239
jobs:
1340
analyze:
1441
name: Analyze
@@ -25,7 +52,7 @@ jobs:
2552

2653
steps:
2754
- name: Checkout repository
28-
uses: actions/checkout@v2
55+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2956
with:
3057
# We must fetch at least the immediate parents so that if this is
3158
# a pull request then we can checkout the head.
@@ -36,38 +63,55 @@ jobs:
3663
- run: git checkout HEAD^2
3764
if: ${{ github.event_name == 'pull_request' }}
3865

39-
- name: Install libmicrohttpd dependency
66+
- name: Fetch libmicrohttpd from cache
67+
id: cache-libmicrohttpd
68+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
69+
with:
70+
path: libmicrohttpd-1.0.3
71+
key: ${{ runner.os }}-libmicrohttpd-1.0.3-codeql
72+
73+
- name: Build libmicrohttpd dependency (if not cached)
74+
# Supply-chain: libmicrohttpd-1.0.3.tar.gz is sha256-pinned. The digest
75+
# must match the value used in verify-build.yml; both workflows track the
76+
# same release. To rotate the libmicrohttpd version, update both the URL
77+
# and the digest in the same PR (keep this file and verify-build.yml in
78+
# sync). Obtain the new digest by downloading the tarball and running:
79+
# sha256sum libmicrohttpd-<version>.tar.gz
80+
# Cross-check against the libmicrohttpd project's official release page.
81+
# rotate: sha256 7816b57aae199cf5c3645e8770e1be5f0a4dfafbcb24b3772173dc4ee634126a
4082
run: |
41-
curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-1.0.3.tar.gz -o libmicrohttpd-1.0.3.tar.gz ;
83+
curl -fsSL https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-1.0.3.tar.gz -o libmicrohttpd-1.0.3.tar.gz ;
84+
echo "7816b57aae199cf5c3645e8770e1be5f0a4dfafbcb24b3772173dc4ee634126a libmicrohttpd-1.0.3.tar.gz" | sha256sum -c ;
4285
tar -xzf libmicrohttpd-1.0.3.tar.gz ;
4386
cd libmicrohttpd-1.0.3 ;
4487
./configure --disable-examples ;
4588
make ;
46-
sudo make install ;
89+
timeout-minutes: 30
90+
if: steps.cache-libmicrohttpd.outputs.cache-hit != 'true'
91+
92+
- name: Install libmicrohttpd dependency
93+
run: cd libmicrohttpd-1.0.3 ; sudo make install ;
94+
timeout-minutes: 30
4795

4896
# Initializes the CodeQL tools for scanning.
4997
- name: Initialize CodeQL
50-
uses: github/codeql-action/init@v1
98+
uses: github/codeql-action/init@411c4c9a36b3fca4d674f06b6396b2c6d23522c6 # v3.36.3
5199
with:
52100
languages: ${{ matrix.language }}
53101

54-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55-
# If this step fails, then you should remove it and run the build manually (see below)
56-
#- name: Autobuild
57-
# uses: github/codeql-action/autobuild@v1
58-
59-
# ℹ️ Command-line programs to run using the OS shell.
60-
# 📚 https://git.io/JvXDl
61-
62-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63-
# and modify them (or add more) to build your code if your project
64-
# uses a compiled language
65-
66-
- name: Manual steps to build the library
102+
# CodeQL's C/C++ database extractor traces the actual compile commands, so
103+
# the library is built explicitly here rather than via the CodeQL Autobuild
104+
# action (autobuild guesses the build and is intentionally not used). The
105+
# build must be a clean from-scratch `make` so every TU is extracted; the
106+
# in-source build (--enable-same-directory-build) keeps object files where
107+
# the extractor expects them.
108+
- name: Build the library (CodeQL manual mode)
67109
run: |
68110
./bootstrap ;
69-
./configure --enable-same-directory-build;
111+
./configure --enable-same-directory-build ;
70112
make ;
113+
timeout-minutes: 30
71114

72115
- name: Perform CodeQL Analysis
73-
uses: github/codeql-action/analyze@v1
116+
uses: github/codeql-action/analyze@411c4c9a36b3fca4d674f06b6396b2c6d23522c6 # v3.36.3
117+
timeout-minutes: 30

0 commit comments

Comments
 (0)