Skip to content

Commit 90fa5f6

Browse files
author
Hamas
committed
Security: Implement Owner-Only protection, Code Owners, and CI Gatekeeper
1 parent a0fe516 commit 90fa5f6

File tree

5 files changed

+94
-0
lines changed

5 files changed

+94
-0
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Owner-Only Security
2+
# @Hamas owns the entire repository.
3+
# No PR can be merged without explicit approval.
4+
* @Hamas

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: dart_dlp CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: dart-lang/setup-dart@v1
17+
with:
18+
sdk: stable
19+
20+
- name: Install dependencies
21+
run: dart pub get
22+
23+
- name: Verify formatting
24+
run: dart format --output=none --set-exit-if-changed .
25+
26+
- name: Analyze project source
27+
run: dart analyze
28+
29+
- name: Run Health Checks
30+
run: dart run bin/check_health.dart
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Security Gatekeeper
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
jobs:
8+
gatekeeper:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: dart-lang/setup-dart@v1
13+
14+
- name: Install dependencies
15+
run: dart pub get
16+
17+
- name: Enforce Formatting
18+
run: dart format --output=none --set-exit-if-changed .
19+
20+
- name: Static Analysis
21+
run: dart analyze

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Contributing to dart_dlp
2+
3+
## 🔒 Security & Access
4+
- **Direct pushes to main are disabled.** All contributions must be made via sub-branches and Pull Requests.
5+
- **Only the repository owner (Hamas) has direct push access to the main branch.**
6+
7+
## Code Standards
8+
- All Pull Requests must pass the `Security Gatekeeper` check (Format & Analyze).
9+
- Code must be properly branded with `/// Developed by Hamas`.
10+
11+
## Workflow
12+
1. Fork the repository.
13+
2. Create a feature branch.
14+
3. Submit a Pull Request.
15+
4. Wait for approval from @Hamas.

GITHUB_SETUP.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# GitHub Branch Protection Setup
2+
3+
Follow these steps to secure the `main` branch.
4+
5+
1. **Go to Settings**:
6+
- Navigate to your repository on GitHub.
7+
- Click **Settings** > **Branches**.
8+
9+
2. **Add Rule**:
10+
- Click **Add branch protection rule**.
11+
- **Branch name pattern**: `main`
12+
13+
3. **Configure Rules**:
14+
- [x] **Require a pull request before merging**
15+
- [x] **Require approvals**: 1
16+
- [x] **Require review from Code Owners** (Crucial for `lib/src/core` protection)
17+
- [x] **Require status checks to pass before merging**
18+
- Search for "build" (or whatever your CI job name is once it runs once) and select it.
19+
- [x] **Do not allow bypassing the above settings**
20+
21+
4. **Save**:
22+
- Click **Create** or **Save changes**.
23+
24+
Your repository is now secured. Only approved PRs passing CI can land in `main`.

0 commit comments

Comments
 (0)