From 95fad9c87b854208d37cd7f25871a35e325a28bb Mon Sep 17 00:00:00 2001 From: Ali Farrokhnejad Date: Sat, 8 Aug 2026 09:56:36 +0300 Subject: [PATCH 01/27] security: remove admin token query parameter flow --- static/shared.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/static/shared.js b/static/shared.js index 4ab060c..9f4777b 100644 --- a/static/shared.js +++ b/static/shared.js @@ -1,18 +1,29 @@ /** Shared helpers for EMU Regulation Assistant UI. */ (function (global) { const THEME_KEY = "emu_theme"; + const ADMIN_TOKEN_KEY = "emu_admin_token"; const THEMES = new Set(["light", "dark"]); - const queryToken = new URLSearchParams(window.location.search).get("admin_token"); - if (queryToken) { - window.sessionStorage.setItem("emu_admin_token", queryToken); - const url = new URL(window.location.href); - url.searchParams.delete("admin_token"); - window.history.replaceState({}, document.title, url.pathname + url.search); + function getAdminToken() { + return window.sessionStorage.getItem(ADMIN_TOKEN_KEY) || ""; + } + + function setAdminToken(token) { + const normalized = String(token || "").trim(); + if (normalized) { + window.sessionStorage.setItem(ADMIN_TOKEN_KEY, normalized); + } else { + window.sessionStorage.removeItem(ADMIN_TOKEN_KEY); + } + return normalized; + } + + function clearAdminToken() { + window.sessionStorage.removeItem(ADMIN_TOKEN_KEY); } function authedFetch(url, options = {}) { - const token = window.sessionStorage.getItem("emu_admin_token"); + const token = getAdminToken(); const headers = new Headers(options.headers || {}); if (token) { headers.set("Authorization", `Bearer ${token}`); @@ -147,6 +158,9 @@ escapeHtml, escapeAttr, formatPercent, + getAdminToken, + setAdminToken, + clearAdminToken, getTheme, getViewMode, setTheme, From 26ed575dcc8ea4c860710d9fde9397486fe0bb3a Mon Sep 17 00:00:00 2001 From: Ali Farrokhnejad Date: Sat, 8 Aug 2026 09:57:06 +0300 Subject: [PATCH 02/27] ci: make browser smoke a required publication gate --- .github/workflows/ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d53d916..a74eeb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,8 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.12" + cache: pip + cache-dependency-path: requirements-dev.txt - name: Install dependencies run: | python -m pip install --upgrade pip @@ -48,16 +50,17 @@ jobs: browser-smoke: runs-on: ubuntu-latest - continue-on-error: true steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.12" + cache: pip + cache-dependency-path: requirements-dev.txt - name: Install dependencies run: | python -m pip install --upgrade pip python -m pip install -r requirements-dev.txt - python -m playwright install chromium - - name: Optional browser smoke - run: python tools/browser_smoke.py --start-server --skip-if-unavailable + python -m playwright install --with-deps chromium + - name: Browser smoke + run: python tools/browser_smoke.py --start-server From 19982d92a6c32d26e42c258c5eb96bc942626008 Mon Sep 17 00:00:00 2001 From: Ali Farrokhnejad Date: Sat, 8 Aug 2026 09:57:18 +0300 Subject: [PATCH 03/27] docs: add security policy for publication --- SECURITY.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..f339fbf --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +# Security Policy + +EMUAdvisor is a local research/demo application and is not an official Eastern Mediterranean University service. + +## Supported use + +The repository is intended for local development, evaluation, and demonstration. It should not be exposed directly to the public Internet without an independent deployment/security review. + +## Admin authentication + +When `EMU_ADVISOR_PROFILE=production`, `EMU_ADVISOR_ADMIN_TOKEN` is required. Admin credentials must be supplied through request headers. Tokens must not be placed in URLs, query parameters, source files, screenshots, logs, or committed environment files. + +The browser diagnostics client stores an explicitly supplied token in `sessionStorage` for the current browser session only and sends it as an `Authorization: Bearer` header. + +## Secrets and local artifacts + +Do not commit: + +- `.env` files or service credentials; +- local Qdrant data; +- generated crawl/index artifacts; +- audit logs or chat histories; +- private university material not already publicly available from official sources. + +## Reporting + +If you find a security issue, report it privately to the repository owner rather than opening a public issue containing exploit details or secrets. From 712cb0666f0e02fa1c7ca9fad5921db8e61cf33a Mon Sep 17 00:00:00 2001 From: Ali Farrokhnejad Date: Sat, 8 Aug 2026 09:57:31 +0300 Subject: [PATCH 04/27] docs: document publication and evaluation provenance --- PUBLICATION.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 PUBLICATION.md diff --git a/PUBLICATION.md b/PUBLICATION.md new file mode 100644 index 0000000..30e64e4 --- /dev/null +++ b/PUBLICATION.md @@ -0,0 +1,21 @@ +# Publication Readiness + +EMUAdvisor was developed in a university/research context. Before changing repository visibility to public, confirm that the author has the right to publish the source code and that no institutional, collaborator, or project agreement restricts redistribution. + +## Release checklist + +- [ ] Confirm source-code ownership and choose an appropriate license. +- [ ] Confirm that only publicly accessible EMU regulations are referenced or retrieved. +- [ ] Confirm generated crawl, index, audit, review, and conversation artifacts remain ignored. +- [ ] Confirm no secrets or real administrative credentials exist in the current tree or Git history. +- [ ] Run the required GitHub Actions core and browser-smoke jobs successfully. +- [ ] Human-review evaluation cases before describing any set as a gold benchmark. +- [ ] Keep the README disclaimer that this is independent research software, not an official EMU administrative service. + +## Evaluation terminology + +Several historical filenames contain the word `gold`. Those names are retained temporarily for compatibility with scripts and CI. They must not be interpreted as human-reviewed gold data. Until review is complete, public-facing documentation should refer to these as candidate/regression evaluation sets. + +## Public-release principle + +The public repository should demonstrate the retrieval, citation, refusal, evaluation, and local-generation architecture without implying institutional endorsement, production readiness, or stronger evaluation evidence than the repository currently supports. From 1f79145d1ebd8a7ea54106d9d38d875596bcacf1 Mon Sep 17 00:00:00 2001 From: Ali Farrokhnejad Date: Sat, 8 Aug 2026 10:18:59 +0300 Subject: [PATCH 05/27] docs: add MIT license --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8b1c216 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Ali Farrokhnejad + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 5468c00a1c9dbc121591382e167a7dd90fa1ea44 Mon Sep 17 00:00:00 2001 From: Ali Farrokhnejad Date: Sat, 8 Aug 2026 10:19:11 +0300 Subject: [PATCH 06/27] docs: record publishing rights and verified gold status --- PUBLICATION.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/PUBLICATION.md b/PUBLICATION.md index 30e64e4..5b91b49 100644 --- a/PUBLICATION.md +++ b/PUBLICATION.md @@ -1,21 +1,27 @@ # Publication Readiness -EMUAdvisor was developed in a university/research context. Before changing repository visibility to public, confirm that the author has the right to publish the source code and that no institutional, collaborator, or project agreement restricts redistribution. +EMUAdvisor may be published by the repository owner. The source code is released under the MIT License. The project remains independent research/software work and is not an official Eastern Mediterranean University administrative service. ## Release checklist -- [ ] Confirm source-code ownership and choose an appropriate license. +- [x] Publishing rights confirmed by the repository owner. +- [x] MIT license added. +- [x] `eval_sets/v1_gold.jsonl` has been reviewed and verified by the project author and university staff. +- [ ] Keep `eval_sets/emu_gold_seed.jsonl` described as provisional unless it completes the same review process. - [ ] Confirm that only publicly accessible EMU regulations are referenced or retrieved. - [ ] Confirm generated crawl, index, audit, review, and conversation artifacts remain ignored. - [ ] Confirm no secrets or real administrative credentials exist in the current tree or Git history. -- [ ] Run the required GitHub Actions core and browser-smoke jobs successfully. -- [ ] Human-review evaluation cases before describing any set as a gold benchmark. -- [ ] Keep the README disclaimer that this is independent research software, not an official EMU administrative service. +- [ ] Run the required GitHub Actions core and browser-smoke jobs successfully on the final publication branch. +- [x] Keep the README disclaimer that this is independent research software, not an official EMU administrative service. ## Evaluation terminology -Several historical filenames contain the word `gold`. Those names are retained temporarily for compatibility with scripts and CI. They must not be interpreted as human-reviewed gold data. Until review is complete, public-facing documentation should refer to these as candidate/regression evaluation sets. +`eval_sets/v1_gold.jsonl` is the verified human-reviewed gold evaluation set. Its cases were reviewed by the project author and university staff. Public metrics reported for `v1_gold` should still be described as local evaluation results for this fixed corpus and implementation, not production-service guarantees or evidence of universal model quality. + +`eval_sets/v1_hard.jsonl` is a hard regression suite focused on difficult table, grouped-query, and refusal behavior. It is not presented as a second gold benchmark unless separately reviewed and documented as such. + +`eval_sets/emu_gold_seed.jsonl` remains a provisional seed set until its source bindings and labels complete the same review process. The historical filename is retained for compatibility; public documentation should call it a provisional evaluation seed rather than a verified gold benchmark. ## Public-release principle -The public repository should demonstrate the retrieval, citation, refusal, evaluation, and local-generation architecture without implying institutional endorsement, production readiness, or stronger evaluation evidence than the repository currently supports. +The public repository should demonstrate retrieval, citation, refusal, evaluation, local-generation, and operational safeguards without implying institutional endorsement or production deployment. Claims should distinguish verified benchmark results from regression results, provisional evaluation material, and runtime/deployment limitations. From f099d6ab3a30d35b43c834007287e537a6815238 Mon Sep 17 00:00:00 2001 From: Ali Farrokhnejad Date: Sat, 8 Aug 2026 10:19:50 +0300 Subject: [PATCH 07/27] feat: add safe browser admin token controls --- static/admin.html | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/static/admin.html b/static/admin.html index 2d1a420..a7b1ffb 100644 --- a/static/admin.html +++ b/static/admin.html @@ -34,17 +34,6 @@

EMU Regulation Assistant

Informational, not a final decision - -