Skip to content

Commit af84d6f

Browse files
committed
docs: strengthen public security signals
1 parent a34cdee commit af84d6f

File tree

13 files changed

+404
-127
lines changed

13 files changed

+404
-127
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @tw93

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ assignees: ''
1010

1111
A clear and concise description of what the bug is. We suggest using English for better global understanding.
1212

13+
If you believe the issue may allow unsafe deletion, path validation bypass, privilege boundary bypass, or release/install integrity issues, do not file a public bug report. Report it privately using the contact details in `SECURITY.md`.
14+
1315
## Steps to reproduce
1416

1517
1. Run command: `mo ...`

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
blank_issues_enabled: false
22
contact_links:
3+
- name: Private Security Report
4+
url: mailto:hitw93@gmail.com?subject=Mole%20security%20report
5+
about: Report a suspected vulnerability privately instead of opening a public issue
36
- name: Telegram Community
47
url: https://t.me/+GclQS9ZnxyI2ODQ1
58
about: Join our Telegram group for questions and discussions

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "weekly"
7+
labels:
8+
- "dependencies"
9+
reviewers:
10+
- "tw93"
11+
open-pull-requests-limit: 10
712

813
- package-ecosystem: "gomod"
914
directory: "/"
1015
schedule:
1116
interval: "weekly"
17+
labels:
18+
- "dependencies"
19+
reviewers:
20+
- "tw93"
21+
open-pull-requests-limit: 10

.github/pull_request_template.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Summary
2+
3+
- Describe the change.
4+
5+
## Safety Review
6+
7+
- Does this change affect cleanup, uninstall, optimize, installer, remove, analyze delete, update, or install behavior?
8+
- Does this change affect path validation, protected directories, symlink handling, sudo boundaries, or release/install integrity?
9+
- If yes, describe the new boundary or risk change clearly.
10+
11+
## Tests
12+
13+
- List the automated tests you ran.
14+
- List any manual checks for high-risk paths or destructive flows.
15+
16+
## Safety-related changes
17+
18+
- None.

.github/workflows/codeql.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
pull_request:
7+
branches: [main, dev]
8+
schedule:
9+
- cron: '17 3 * * 1'
10+
11+
permissions:
12+
contents: read
13+
security-events: write
14+
15+
jobs:
16+
analyze:
17+
name: Analyze (${{ matrix.language }})
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- language: go
24+
build-mode: manual
25+
- language: actions
26+
build-mode: none
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
31+
32+
- name: Set up Go
33+
if: matrix.language == 'go'
34+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v5
35+
with:
36+
go-version: "1.24.6"
37+
38+
- name: Initialize CodeQL
39+
uses: github/codeql-action/init@v4
40+
with:
41+
languages: ${{ matrix.language }}
42+
build-mode: ${{ matrix.build-mode }}
43+
queries: security-extended
44+
45+
- name: Build for CodeQL
46+
if: matrix.build-mode == 'manual'
47+
run: make build
48+
49+
- name: Perform CodeQL Analysis
50+
uses: github/codeql-action/analyze@v4
51+
with:
52+
category: "/language:${{ matrix.language }}"

.github/workflows/release.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'V*'
77

88
permissions:
9-
contents: write
9+
contents: read
1010

1111
jobs:
1212
build:
@@ -58,6 +58,10 @@ jobs:
5858
name: Publish Release
5959
needs: build
6060
runs-on: ubuntu-latest
61+
permissions:
62+
contents: write
63+
attestations: write
64+
id-token: write
6165
steps:
6266
- name: Download all artifacts
6367
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
@@ -69,16 +73,32 @@ jobs:
6973
- name: Display structure of downloaded files
7074
run: ls -R bin/
7175

76+
- name: Generate release checksums
77+
run: |
78+
cd bin
79+
mapfile -t release_files < <(find . -maxdepth 1 -type f -printf '%P\n' | sort)
80+
if [[ ${#release_files[@]} -eq 0 ]]; then
81+
echo "No release assets found"
82+
exit 1
83+
fi
84+
sha256sum "${release_files[@]}" > SHA256SUMS
85+
cat SHA256SUMS
86+
87+
- name: Generate artifact attestation
88+
uses: actions/attest-build-provenance@v3
89+
with:
90+
subject-path: |
91+
bin/analyze-darwin-*
92+
bin/status-darwin-*
93+
bin/binaries-darwin-*.tar.gz
94+
bin/SHA256SUMS
95+
7296
- name: Create Release
7397
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
7498
if: startsWith(github.ref, 'refs/tags/')
7599
with:
76100
name: ${{ github.ref_name }}
77101
files: bin/*
78-
body: |
79-
Release assets are ready.
80-
81-
Final curated release notes should be applied with `gh release edit` after workflow verification.
82102
generate_release_notes: false
83103
draft: false
84104
prerelease: false

.github/workflows/test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ jobs:
5252
steps:
5353
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
5454

55+
- name: Install tools
56+
run: brew install bats-core
57+
5558
- name: Check for unsafe rm usage
5659
run: |
5760
echo "Checking for unsafe rm patterns..."
@@ -86,3 +89,10 @@ jobs:
8689
exit 1
8790
fi
8891
echo "✓ No secrets found"
92+
93+
- name: Run high-risk path regression tests
94+
env:
95+
BATS_FORMATTER: tap
96+
LANG: en_US.UTF-8
97+
LC_ALL: en_US.UTF-8
98+
run: bats tests/core_safe_functions.bats tests/purge.bats tests/installer.bats

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,28 @@ mo purge --paths # Configure project scan directories
7474
mo analyze /Volumes # Analyze external drives only
7575
```
7676

77+
## Security & Safety Design
78+
79+
Mole is a local system maintenance tool. Commands such as `clean`, `uninstall`, `purge`, `installer`, `remove`, and parts of `optimize` can perform destructive local operations.
80+
81+
Mole is designed with safety-first defaults for local system maintenance.
82+
83+
- Destructive operations are guarded by path validation, protected directory rules, conservative cleanup boundaries, and explicit confirmation where appropriate.
84+
- Mole prioritizes bounded cleanup over aggressive cleanup.
85+
- High-risk paths, sensitive data categories, system locations, and sudo flows have explicit protection boundaries.
86+
- When uncertainty exists, the tool should refuse, skip, or require stronger confirmation instead of widening deletion scope.
87+
- `mo analyze` is intentionally safer than cleanup flows for ad hoc deletion because it moves files to Trash through Finder instead of directly deleting them.
88+
- Release assets are published with SHA-256 checksums, curated safety notes, and GitHub artifact attestations.
89+
90+
Review these documents before using high-risk commands:
91+
92+
- [SECURITY.md](SECURITY.md)
93+
- [SECURITY_AUDIT.md](SECURITY_AUDIT.md)
94+
7795
## Tips
7896

7997
- Video tutorial: Watch the [Mole tutorial video](https://www.youtube.com/watch?v=UEe9-w4CcQ0), thanks to PAPAYA 電腦教室.
80-
- Safety and logs: Deletions are permanent. Review with `--dry-run` first, and add `--debug` when needed. File operations are logged to `~/.config/mole/operations.log`. Disable with `MO_NO_OPLOG=1`. See [Security Audit](SECURITY_AUDIT.md).
98+
- Safety and logs: `clean`, `uninstall`, `purge`, `installer`, and `remove` are destructive. Review with `--dry-run` first, and add `--debug` when needed. File operations are logged to `~/.config/mole/operations.log`. Disable with `MO_NO_OPLOG=1`. Review [SECURITY.md](SECURITY.md) and [SECURITY_AUDIT.md](SECURITY_AUDIT.md).
8199
- Navigation: Mole supports arrow keys and Vim bindings `h/j/k/l`.
82100

83101
## Features in Detail

SECURITY.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Security Policy
2+
3+
Mole is a local system maintenance tool. It includes high-risk operations such as cleanup, uninstall, optimization, and artifact removal. We treat safety boundaries, deletion logic, and release integrity as security-sensitive areas.
4+
5+
## Reporting a Vulnerability
6+
7+
Please report suspected security issues privately.
8+
9+
- Email: `hitw93@gmail.com`
10+
- Subject line: `Mole security report`
11+
12+
Do not open a public GitHub issue for an unpatched vulnerability.
13+
14+
If GitHub Security Advisories private reporting is enabled for the repository, you may use that channel instead of email.
15+
16+
Include as much of the following as possible:
17+
18+
- Mole version and install method
19+
- macOS version
20+
- Exact command or workflow involved
21+
- Reproduction steps or proof of concept
22+
- Whether the issue involves deletion boundaries, symlinks, sudo, path validation, or release/install integrity
23+
24+
## Response Expectations
25+
26+
- We aim to acknowledge new reports within 7 calendar days.
27+
- We aim to provide a status update within 30 days if a fix or mitigation is not yet available.
28+
- We will coordinate disclosure after a fix, mitigation, or clear user guidance is ready.
29+
30+
Response times are best-effort for a maintainer-led open source project, but security reports are prioritized over normal bug reports.
31+
32+
## Supported Versions
33+
34+
Security fixes are only guaranteed for:
35+
36+
- The latest published release
37+
- The current `main` branch
38+
39+
Older releases may not receive security fixes. Users running high-risk commands should stay current.
40+
41+
## What We Consider a Security Issue
42+
43+
Examples of security-relevant issues include:
44+
45+
- Path validation bypasses
46+
- Deletion outside intended cleanup boundaries
47+
- Unsafe handling of symlinks or path traversal
48+
- Unexpected privilege escalation or unsafe sudo behavior
49+
- Sensitive data removal that bypasses documented protections
50+
- Release, installation, update, or checksum integrity issues
51+
- Vulnerabilities in logic that can cause unintended destructive behavior
52+
53+
## What Usually Does Not Qualify
54+
55+
The following are usually normal bugs, feature requests, or documentation issues rather than security issues:
56+
57+
- Cleanup misses that leave recoverable junk behind
58+
- False negatives where Mole refuses to clean something
59+
- Cosmetic UI problems
60+
- Requests for broader or more aggressive cleanup behavior
61+
- Compatibility issues without a plausible security impact
62+
63+
If you are unsure whether something is security-relevant, report it privately first.
64+
65+
## Security-Focused Areas in Mole
66+
67+
The project pays particular attention to:
68+
69+
- Destructive command boundaries
70+
- Path validation and protected-directory rules
71+
- Sudo and privilege boundaries
72+
- Symlink and path traversal handling
73+
- Sensitive data exclusions
74+
- Packaging, release artifacts, checksums, and update/install flows
75+
76+
For the current technical design and known limitations, see [SECURITY_AUDIT.md](SECURITY_AUDIT.md).

0 commit comments

Comments
 (0)