@davoodmehraban89 / Factor-easy / commits / f41f1c5
Fork 0

سامانه صدور فاکتور و حسابداری

test(login): verify CORS preflight vs authenticated gateway GET on disposable free runner

davoodmehraban89 committed Oct 25, 2026 at 14:02 UTC f41f1c5adbfcbb6e3989d27df93e6c08edafc17d
1 file changed +67
.github/workflows/qa-login-cors-readonly.yml new
+67
@@ -0,0 +1,67 @@
1 +name: FINORA login Auth/REST CORS readonly network probe
2 +on:
3 + push:
4 + branches: [qa/finora-login-cors-header-preflight-20261025]
5 +permissions:
6 + contents: read
7 +
8 +# Forensic test only. Executes two preflights and two GETs against public
9 +# gateway health/root endpoints; no credentials, passwords, user rows, SQL or deploy.
10 +# Runs on free GitHub-hosted runner in this public repository.
11 +jobs:
12 + gateway-readonly:
13 + runs-on: ubuntu-latest
14 + timeout-minutes: 8
15 + steps:
16 + - uses: actions/checkout@v4
17 + with:
18 + persist-credentials: false
19 + - name: Assert exact public Supabase project without secret key
20 + shell: bash
21 + run: |
22 + set -euo pipefail
23 + grep -q "const SUPABASE_URL='https://hcsixhqbyuhpshfwqpjx.supabase.co'" js/core.js
24 + grep -q 'sb_publishable_' js/core.js
25 + - name: Inspect CORS preflight and real GET independently
26 + shell: bash
27 + run: |
28 + set -euo pipefail
29 + URL=https://hcsixhqbyuhpshfwqpjx.supabase.co
30 + ORIGIN=https://factoreasy.ir
31 + KEY="$(node -e 'const f=require("fs").readFileSync("js/core.js","utf8");const x=f.match(/const SUPABASE_KEY='\''(sb_publishable_[^'\'']+)'\''/);if(!x)process.exit(2);process.stdout.write(x[1]);')"
32 + for PATHNAME in /auth/v1/health /rest/v1/; do
33 + for METHOD in OPTIONS GET; do
34 + HEADERS="$(mktemp)"
35 + if [[ "$METHOD" == OPTIONS ]]; then
36 + CODE="$(curl --silent --show-error --location --max-time 18 --output /dev/null --dump-header "$HEADERS" --write-out '%{http_code}' --request OPTIONS \
37 + --header "Origin: $ORIGIN" \
38 + --header 'Access-Control-Request-Method: GET' \
39 + --header 'Access-Control-Request-Headers: apikey' \
40 + "$URL$PATHNAME")"
41 + else
42 + CODE="$(curl --silent --show-error --location --max-time 18 --output /dev/null --dump-header "$HEADERS" --write-out '%{http_code}' \
43 + --header "Origin: $ORIGIN" --header "apikey: $KEY" "$URL$PATHNAME")"
44 + fi
45 + echo "$METHOD $PATHNAME HTTP $CODE"
46 + grep -Ei '^access-control-allow-(origin|headers|methods):' "$HEADERS" | tr -d '\r' || true
47 + if [[ "$METHOD" == OPTIONS ]]; then
48 + grep -Eqi '^access-control-allow-origin: (https://factoreasy.ir|\*)' "$HEADERS" || { echo 'CORS_ORIGIN_MISSING'; exit 1; }
49 + grep -Ei '^access-control-allow-headers:' "$HEADERS" | grep -qi 'apikey' || { echo 'CORS_APIKEY_PREFLIGHT_REJECTED'; exit 1; }
50 + fi
51 + rm -f "$HEADERS"
52 + if [[ "$CODE" == 000 || "$CODE" -ge 500 ]]; then
53 + echo "GATEWAY_READONLY_UNHEALTHY $METHOD $PATHNAME"; exit 1
54 + fi
55 + done
56 + done
57 + echo 'CORS_GET_GATEWAY_PASS_FROM_GITHUB_RUNNER_NOT_IRAN'
58 + - name: State network-geography limitations
59 + if: always()
60 + run: |
61 + {
62 + echo "### Login network diagnostic (safe read-only)"
63 + echo "- This tests CORS OPTIONS and GET with public publishable key only."
64 + echo "- Test origin: https://factoreasy.ir; network egress: US/EU GitHub runner, NOT user's ISP."
65 + echo "- Never claims user login, browser connectivity or Production account success."
66 + echo "- No SQL/finance reads, password, paid resource, stored artifact or deployment."
67 + } >> "$GITHUB_STEP_SUMMARY"