issue-tracking
GitHub用于 SWS 项目的缺陷追踪与调试技能,涵盖漏洞识别、复现、根因分析及修复。指导收集环境信息、使用日志和 HTTP 探针定位问题,并执行最小化复现与安全流程。
触发场景
安装
npx skills add static-web-server/static-web-server --skill issue-tracking -g -y
SKILL.md
Frontmatter
{
"name": "issue-tracking",
"description": "Triage, reproduce, debug, and fix issues in the Static Web Server (SWS) project — bug reports, regressions, root-cause analysis, minimal fixes with regression tests, v2 backports, and security reports. Use when investigating a bug report or failing behavior, writing a fix, or reviewing a bug-fix PR."
}
Issue Triage and Debugging
When to load: a bug report or regression arrives, behavior differs from the docs, a fix is being written, or a bug-fix PR is under review.
Triage
- Security first: if the report involves path traversal, file disclosure, auth bypass, header injection, or a crash from request input, treat it as a vulnerability. Follow
SECURITY.md: private channels and a GitHub Security Advisory, no public issue or descriptive commit until disclosure. Seesecurity/SKILL.md - Version and branch: v3 is
master(development); v2 is the LTS line. Note which versions are affected; v2 fixes are backported separately and titled(v2 backport) - Gather: SWS version (
static-web-server -V), OS/arch, install method (binary, Docker image, cargo), full command line, env vars,sws.toml, request (curl -v), and logs at-g trace - Check defaults: many reports come from changed defaults. v3 defaults: port
8080, root., indexindex.html,--compression-staticon, directory listing off. A TOML[general]value overrides the CLI flag, which surprises users
Bug reports use .github/ISSUE_TEMPLATE/bug_report.yml; ask for the missing fields rather than guessing.
Reproduce
Reproduce before theorizing. Reduce to the smallest root and config that still fails.
# Debug build against a fixture root with full tracing
cargo run --features all -- -d tests/fixtures/public -p 8080 -g trace
# Or with a config file
cargo run --features all -- -w ./repro.toml -g trace
HTTP probes
curl -sv http://localhost:8080/path -o /dev/null # status + headers
curl -sI -H 'Accept-Encoding: br, gzip' http://localhost:8080/app.js # compression variant
curl -s -H 'Range: bytes=0-99' -D - http://localhost:8080/file -o /dev/null
curl -sI -H 'If-None-Match: W/"..."' http://localhost:8080/index.html # expect 304
curl -sv -X OPTIONS -H 'Origin: https://example.com' \
-H 'Access-Control-Request-Method: GET' http://localhost:8080/ # CORS preflight
curl -sI -H 'Accept: text/markdown' http://localhost:8080/article # markdown negotiation
curl --path-as-is -sI 'http://localhost:8080/../../etc/passwd' # traversal must 404
openssl s_client -connect localhost:8080 -servername localhost # TLS
Use --path-as-is; plain curl normalizes .. client-side and hides traversal bugs.
Logs
-g/SERVER_LOG_LEVEL:error(default),warn,info,debug,traceinfologs effective settings at startup (each feature'sinit()); compare them with what the user believes they configuredtraceshows path resolution, pre-compressed variant selection, and compression decisions--log-format prettygives human-readable output (default is single-linejson);--log-remote-addressadds client addresses
Common Symptom → Cause
| Symptom | Check |
|---|---|
| 404 for a file that exists | Hidden component (.well-known) without --include-hidden; symlinked path; wrong root (default is .); --index-files value |
| 403 | A path component is a symlink and --follow-symlinks is off |
| Setting ignored | Same key set in sws.toml [general] (overrides CLI/env); feature not compiled in; ./config.toml picked up with a deprecation warning |
Wrong Content-Type |
Extension unknown to mime_guess; fix with an [[advanced.headers]] rule |
| Not compressed | Body under 200 bytes, MIME not compressible, HEAD request, or a pre-compressed variant already applied |
| Asset cached for a year after a 404 | Fixed in v3.0.0-beta.2: file-type Cache-Control applies only to 2xx/304 |
| Header missing | Step order: custom headers override, CORS headers only when an origin matched, security headers only with --security-headers (auto with --tls) |
Rewrite $1 empty |
Capture numbering follows pattern order; {*} stays within one segment, {**} spans segments |
Fix
- Write the failing test first: handler test in
tests/<feature>.rsor unit test beside the code (testing/SKILL.md). Confirm it fails for the reported reason - Find the root cause: the exact line or condition, not the symptom. Explain it in the commit body
- Minimal fix: change only what the root cause requires. No unrelated refactors
- Search for siblings:
rgfor the same pattern elsewhere (another pipeline step, the v2 branch,directory_listingvsstatic_files) - Run the full suite for both feature sets (
rust-backend/SKILL.md). Any new failure is yours to explain - Record it: CHANGELOG entry under Bug Fixes, and a docs-repo follow-up if documented behavior changes
Commit
Per docs/COMMITS.md (lines ≤ 100 chars, imperative, lowercase subject, no trailing period):
fix(control_headers): apply file type cache-control only to 2xx and 304
Error responses for asset URLs inherited the one-year max-age of the
requested extension, so browsers cached a missing asset as a 404.
Use `no-cache` for any status other than 2xx and 304.
Fixes #757
Scope is the module touched (server, tls, compression, fs, handler, static_files, cors, rewrites, directory_listing, ...).
Regression Prevention
- The reproduction test stays as a regression test
- Parsers that failed on unexpected input get a proptest; commit any
proptest-regressions/file it produces - Hot-path fixes get a bench so the fix doesn't regress performance unnoticed
Checklist
- Security implications assessed first
- Reproduced, with a failing test
- Root cause identified and explained in the commit body
- Minimal fix; sibling code paths checked
- Tests pass for
--features alland--no-default-features - CHANGELOG entry; v2 backport noted if affected
版本历史
-
a1500d4
当前 2026-10-20 05:08
优化了安全优先的处理流程,细化了版本分支管理(v2/v3),增加了具体的复现命令示例及常见症状排查表,替代了原有的严重性分类框架。
- 21dc11b 2026-08-20 17:42


