From c0944cfb13c67e8e1a2797f038acfa725b0dcc2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manus=20D=C3=A9ploiement=20Santinova?= Date: Fri, 21 Aug 2026 16:50:17 +0000 Subject: [PATCH] =?UTF-8?q?Corriger=20la=20pr=C3=A9paration=20de=20rotatio?= =?UTF-8?q?n=20Gitea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ops/gitea-token-rotation.sh | 22 ++++++++++++---------- src/backend/test/token-rotation.test.js | 1 + 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ops/gitea-token-rotation.sh b/ops/gitea-token-rotation.sh index d100925..55930fe 100644 --- a/ops/gitea-token-rotation.sh +++ b/ops/gitea-token-rotation.sh @@ -49,17 +49,19 @@ read_env_token() { validate_token() { local token="$1" - local response + local response status result=1 response="$(mktemp /tmp/gitea-token-validation.XXXXXX)" - trap 'rm -f "${response}"' RETURN - local status - status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/user")" - [[ "${status}" == "200" ]] || return 1 - grep -q '"login":"manus-admin"' "${response}" - status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/repos/${GITEA_USER}/manus-dashboard")" - [[ "${status}" == "200" ]] || return 1 - status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/repos/${GITEA_USER}/referentiel-ia")" - [[ "${status}" == "200" ]] + if status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/user")" \ + && [[ "${status}" == "200" ]] \ + && grep -q '"login":"manus-admin"' "${response}" \ + && status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/repos/${GITEA_USER}/manus-dashboard")" \ + && [[ "${status}" == "200" ]] \ + && status="$(curl -sS -o "${response}" -w '%{http_code}' -H "Authorization: token ${token}" "${GITEA_URL}/api/v1/repos/${GITEA_USER}/referentiel-ia")" \ + && [[ "${status}" == "200" ]]; then + result=0 + fi + rm -f "${response}" + return "${result}" } rotation_due() { diff --git a/src/backend/test/token-rotation.test.js b/src/backend/test/token-rotation.test.js index 3f99f32..3f01e51 100644 --- a/src/backend/test/token-rotation.test.js +++ b/src/backend/test/token-rotation.test.js @@ -13,6 +13,7 @@ assert.match(rotation, /GITEA_ROTATION_APPLIED/); assert.match(rotation, /chmod 0600/); assert.match(rotation, /rollback/); assert.doesNotMatch(rotation, /GITEA_PASSWORD/); +assert.doesNotMatch(rotation, /trap .*RETURN/); assert.match(timer, /OnCalendar=\*-01,04,07,10-01 07:00:00/); assert.match(timer, /Persistent=true/); assert.match(approvalPath, /PathExists=.*approval\.request/);