Skip to content

Commit 141ddf6

Browse files
Merge main into gsocmodule_C_week_2 after OWASP#922 merge
Resolve add/add conflicts keeping week_2 C.0 boundary changes. Co-authored-by: Cursor <cursoragent@cursor.com>
2 parents 86f434d + 3613fae commit 141ddf6

39 files changed

Lines changed: 10891 additions & 7094 deletions

.cursor/rules/git-workflow.mdc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
description: Signed commits and rebase-only git workflow for OpenCRE
3+
alwaysApply: true
4+
---
5+
6+
# Git Workflow (OpenCRE)
7+
8+
## Verified signed commits (required)
9+
10+
- **Every commit must be cryptographically signed** and show as **Verified** on GitHub.
11+
- Use `git commit -S` (or rely on `commit.gpgsign=true` / `commit.gpssign=true` when already configured).
12+
- **Never** pass `--no-gpg-sign`, `--no-gpgSign`, or skip signing hooks unless the user explicitly requests it.
13+
- Before handoff after a commit, confirm signatures: `git log -1 --show-signature` (or `git verify-commit HEAD`).
14+
- If signing fails (missing key, agent, or passphrase), **stop and report** — do not create unsigned commits.
15+
16+
## Rebase-only history (no squash, no merge commits)
17+
18+
OpenCRE keeps a **linear history**. All integrations use **rebase** — never squash, never merge commits.
19+
20+
| Do | Don't |
21+
|----|-------|
22+
| `git rebase <base>` to update a feature branch | `git merge <branch>` to integrate work |
23+
| `git pull --rebase` (or `fetch` + `rebase`) | `git pull` (default merge) on shared branches |
24+
| `gh pr merge --rebase` when merging PRs | `gh pr merge --squash` or `gh pr merge --merge` |
25+
| Rebase-merge on GitHub (Settings → rebase merging enabled) | Squash merge or merge-commit PRs |
26+
27+
- When the user asks to integrate branches, **rebase onto the target branch**.
28+
- When merging PRs, **always use rebase merge** (`gh pr merge <n> --rebase`). **Never squash.**
29+
- **Never** use `git merge --no-ff`, `gh pr merge --squash`, or `gh pr merge --merge` in this repo unless the user explicitly overrides for a one-off exception.

.env.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@ GEMINI_API_KEY=your-gemini-api-key
5959
VERTEX_CHAT_MODEL=gemini-2.5-flash
6060
VERTEX_EMBED_CONTENT_MODEL=gemini-embedding-001
6161

62+
# Noise / Relevance Filter (Module B)
63+
64+
CRE_NOISE_FILTER_LLM_MODEL=gemini/gemini-2.5-flash-lite
65+
CRE_NOISE_FILTER_BATCH_SIZE=10
66+
CRE_NOISE_FILTER_MAX_CHARS=1500
67+
CRE_NOISE_FILTER_CONFIDENCE_THRESHOLD=0.8
68+
6269
# Spreadsheet Auth
6370

6471
OpenCRE_gspread_Auth=path/to/credentials.json
72+
73+
# Module C — Librarian
74+
# Loaded by application/utils/librarian/config_loader.py. Nothing consumes these
75+
# yet; defaults match the OIE design doc. Constraints enforced at load time:
76+
# top_k_rerank <= top_k_retrieval; thresholds in [0.0, 1.0]; counts > 0.
77+
78+
CRE_LIBRARIAN_CROSSENCODER_MODEL=cross-encoder/ms-marco-MiniLM-L-6-v2
79+
CRE_LIBRARIAN_TOP_K_RETRIEVAL=20
80+
CRE_LIBRARIAN_TOP_K_RERANK=5
81+
CRE_LIBRARIAN_LINK_THRESHOLD=0.8
82+
CRE_LIBRARIAN_BATCH_SIZE=32
83+
CRE_LIBRARIAN_ECE_TARGET=0.10
84+
CRE_LIBRARIAN_CONFORMAL_ALPHA=0.10

.github/workflows/gsoc-reviews.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
# GSoC 2026 maintainer report — assigned students only.
3+
# Stops generating reports after 2026-10-31 and deletes this workflow in November 2026.
4+
name: GSoC Reviews
5+
6+
on:
7+
schedule:
8+
- cron: "0 9 * * 1"
9+
- cron: "0 0 1 11 *"
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: write
14+
pull-requests: read
15+
16+
env:
17+
GSOC_REVIEWS_EXPIRY: "2026-10-31T23:59:59Z"
18+
19+
jobs:
20+
gate:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
expired: ${{ steps.date.outputs.expired }}
24+
steps:
25+
- name: Check October 2026 expiry
26+
id: date
27+
run: |
28+
NOW=$(date -u +%s)
29+
EXPIRY=$(date -u -d "${GSOC_REVIEWS_EXPIRY}" +%s)
30+
if [ "$NOW" -gt "$EXPIRY" ]; then
31+
echo "expired=true" >> "$GITHUB_OUTPUT"
32+
else
33+
echo "expired=false" >> "$GITHUB_OUTPUT"
34+
fi
35+
36+
report:
37+
name: GSoC PR and RFC coverage report
38+
needs: gate
39+
if: needs.gate.outputs.expired == 'false'
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
45+
- name: Generate report
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: |
49+
python3 scripts/gsoc_pr_review_report.py --output /tmp/gsoc-review-report.md
50+
51+
- name: Publish job summary
52+
run: cat /tmp/gsoc-review-report.md >> "$GITHUB_STEP_SUMMARY"
53+
54+
- name: Upload report artifact
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: gsoc-review-report
58+
path: /tmp/gsoc-review-report.md
59+
retention-days: 90
60+
61+
cleanup:
62+
name: Remove expired GSoC Reviews workflow
63+
needs: gate
64+
if: needs.gate.outputs.expired == 'true'
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v4
69+
with:
70+
token: ${{ secrets.GITHUB_TOKEN }}
71+
72+
- name: Delete workflow and scripts
73+
run: |
74+
rm -f .github/workflows/gsoc-reviews.yml
75+
rm -f scripts/gsoc_pr_review_report.py
76+
rm -f scripts/gsoc_review_manifest.json
77+
if git diff --quiet; then
78+
echo "Workflow files already removed."
79+
exit 0
80+
fi
81+
git config user.name "github-actions[bot]"
82+
git config user.email "github-actions[bot]@users.noreply.github.com"
83+
git add -A
84+
git commit -m "chore: remove expired GSoC reviews workflow (October 2026)"
85+
git push

.github/workflows/linter.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ jobs:
3434
uses: actions/checkout@v4
3535
with:
3636
fetch-depth: 0
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.11'
41+
- name: Install Python dependencies
42+
run: |
43+
python -m venv venv
44+
. ./venv/bin/activate
45+
pip install --upgrade pip setuptools
46+
pip install -r requirements.txt
47+
- name: OpenAPI guardrail
48+
run: make openapi-guardrail
3749
- name: Lint Code Base
3850
uses: github/super-linter@v6
3951
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ standards_cache.sqlite
6767
### Docs
6868
*.md
6969
!AGENTS.md
70+
!docs/faq.md
7071

7172
### Dev DBDumps
7273
*.sql

.yarn/install-state.gz

2.84 MB
Binary file not shown.

.yarnrc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
approvedGitRepositories:
2+
- "**"
3+
4+
enableScripts: true
5+
6+
nodeLinker: node-modules
7+
8+
npmMinimalAgeGate: 0

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ docker-prod-run:
100100
docker run -it -p $(PORT):$(PORT) opencre:$(shell git rev-parse HEAD)
101101

102102
lint:
103-
[ -d "./venv" ] && . ./venv/bin/activate && black . && yarn lint
103+
[ -d "./venv" ] && . ./venv/bin/activate && black . && yarn lint && make openapi-guardrail
104104

105105
mypy:
106106
[ -d "./venv" ] && . ./venv/bin/activate && mypy --ignore-missing-imports --implicit-reexport --no-strict-optional --strict application
@@ -122,6 +122,14 @@ alembic-guardrail:
122122
[ -d "./venv" ] && . ./venv/bin/activate &&\
123123
python scripts/check_alembic_revision_guardrail.py
124124

125+
openapi-generate:
126+
[ -d "./venv" ] && . ./venv/bin/activate &&\
127+
python scripts/generate_openapi.py
128+
129+
openapi-guardrail:
130+
[ -d "./venv" ] && . ./venv/bin/activate &&\
131+
python scripts/check_openapi_guardrail.py
132+
125133
migrate-downgrade:
126134
[ -d "./venv" ] && . ./venv/bin/activate &&\
127135
export FLASK_APP="$(CURDIR)/cre.py"

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ OpenCRE consists of:
1515
To see how you can contribute to the application or to the data (catalog or standard mappings), see [Contributing](docs/CONTRIBUTING.md).
1616
We really welcome you!
1717

18+
# Documentation
19+
20+
- [In-app Docs](https://www.opencre.org/docs) — getting started, FAQ, and interactive API reference
21+
- [FAQ](docs/faq.md) — frequently asked questions (also rendered at [/docs#faq](https://www.opencre.org/docs#faq))
22+
- [OpenAPI spec](docs/api/openapi.yaml) — public REST API (`/rest/v1/openapi.yaml` when running)
23+
1824
# Roadmap
1925

2026
For a roadmap please see the [issues](https://github.com/OWASP/OpenCRE/issues).

application/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def create_app(mode: str = "production", conf: any = None) -> Any:
5151

5252
app.register_blueprint(app_blueprint)
5353

54+
from application.web.openapi_registry import init_openapi
55+
56+
init_openapi(app)
57+
5458
CORS(app)
5559
app.config["CORS_HEADERS"] = "Content-Type"
5660

0 commit comments

Comments
 (0)