Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6675f5d088 | ||
|
|
5524f8f2a4 | ||
|
|
ff087d8b40 | ||
|
|
aab3fd4a15 | ||
|
|
7f16e5e696 |
No files matched your search
@@ -19,9 +19,4 @@ updates:
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
open-pull-requests-limit: 2
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
@@ -55,7 +55,8 @@ branches:
|
||||
require_code_owner_reviews: false
|
||||
required_status_checks:
|
||||
strict: false
|
||||
contexts: []
|
||||
contexts:
|
||||
- continuous-integration/drone/pr
|
||||
enforce_admins: null
|
||||
restrictions:
|
||||
apps: []
|
||||
@@ -73,7 +74,8 @@ branches:
|
||||
require_code_owner_reviews: false
|
||||
required_status_checks:
|
||||
strict: false
|
||||
contexts: []
|
||||
contexts:
|
||||
- continuous-integration/drone/pr
|
||||
enforce_admins: null
|
||||
restrictions:
|
||||
apps: []
|
||||
|
||||
@@ -1,464 +0,0 @@
|
||||
name: Acceptance Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
coding-standard:
|
||||
name: coding-standard
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Install PHP 8.4
|
||||
run: |
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y php8.4 php8.4-curl php8.4-xml php8.4-mbstring php8.4-zip php8.4-ldap php8.4-gd
|
||||
sudo update-alternatives --set php /usr/bin/php8.4
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
- name: PHP code style
|
||||
run: |
|
||||
make vendor-bin-codestyle
|
||||
make vendor-bin-codesniffer
|
||||
make test-php-style
|
||||
- name: Check env var annotations
|
||||
run: make check-env-var-annotations
|
||||
|
||||
check-gherkin-standard:
|
||||
name: check-gherkin-standard
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
- name: Lint feature files
|
||||
run: |
|
||||
npm install -g @gherlint/gherlint@1.1.0
|
||||
make test-gherkin-lint
|
||||
|
||||
check-suites-in-expected-failures:
|
||||
name: check-suites-in-expected-failures
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Check suites
|
||||
run: bash tests/acceptance/check-deleted-suites-in-expected-failure.sh
|
||||
|
||||
build-and-test:
|
||||
name: build-and-test
|
||||
needs: [coding-standard, check-gherkin-standard, check-suites-in-expected-failures]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Enable pnpm
|
||||
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
|
||||
|
||||
- name: Generate nodejs
|
||||
run: make ci-node-generate
|
||||
|
||||
- name: Generate go
|
||||
run: make ci-go-generate
|
||||
|
||||
- name: Vulnerability scan
|
||||
run: make govulncheck
|
||||
|
||||
- name: Lint
|
||||
run: make ci-golangci-lint
|
||||
|
||||
- name: Build ocis
|
||||
run: make -C ocis build
|
||||
|
||||
- name: Build debug binary
|
||||
run: make -C ocis build-debug
|
||||
|
||||
- name: Unit tests
|
||||
run: make test
|
||||
|
||||
local-api-tests:
|
||||
name: ${{ matrix.suite }}
|
||||
needs: [build-and-test]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
suite:
|
||||
# contract & locks
|
||||
- apiContract
|
||||
- apiLocks
|
||||
# settings & notifications (needs email)
|
||||
- apiSettings
|
||||
- apiNotification
|
||||
- apiCors
|
||||
# graph
|
||||
- apiGraphUser
|
||||
- apiGraph
|
||||
- apiGraphGroup
|
||||
# spaces & dav
|
||||
- apiSpaces
|
||||
- apiSpacesShares
|
||||
- apiSpacesDavOperation
|
||||
- apiDownloads
|
||||
- apiAsyncUpload
|
||||
- apiDepthInfinity
|
||||
- apiArchiver
|
||||
- apiActivities
|
||||
# search
|
||||
- apiSearch1
|
||||
- apiSearch2
|
||||
- apiSearchContent # needs Tika
|
||||
# sharing
|
||||
- apiSharingNgShares
|
||||
- apiReshare
|
||||
- apiSharingNgPermissions
|
||||
- apiSharingNgAdditionalShareRole
|
||||
- apiSharingNgDriveInvitation
|
||||
- apiSharingNgItemInvitation
|
||||
- apiSharingNgDriveLinkShare
|
||||
- apiSharingNgItemLinkShare
|
||||
- apiSharingNgLinkShareManagement
|
||||
# auth
|
||||
- apiAuthApp
|
||||
# antivirus (needs ClamAV)
|
||||
- apiAntivirus
|
||||
# federation (needs email + federation ocis)
|
||||
- apiOcm
|
||||
# collaboration (needs WOPI)
|
||||
- apiCollaboration
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Enable pnpm
|
||||
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
|
||||
|
||||
- name: Install libcurl 8.12.0 from source
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
# NEEDRESTART_MODE=a: auto-restart services silently; without this, needrestart can fail with exit code 6
|
||||
sudo NEEDRESTART_MODE=a apt-get install -y libssl-dev libnghttp2-dev libpsl-dev libldap-dev libssh-dev zlib1g-dev libvips-dev
|
||||
cd /tmp
|
||||
curl -sLO https://curl.se/download/curl-8.12.0.tar.gz
|
||||
tar xzf curl-8.12.0.tar.gz
|
||||
cd curl-8.12.0
|
||||
./configure --with-ssl --with-zlib --with-nghttp2 --prefix=/usr/local --enable-versioned-symbols --silent
|
||||
make -j$(nproc) --silent
|
||||
sudo make install --silent
|
||||
sudo ldconfig
|
||||
curl --version | head -1
|
||||
php -r '
|
||||
$v = curl_version()["version"];
|
||||
echo "PHP curl: $v\n";
|
||||
if (version_compare($v, "8.12.0", "<")) {
|
||||
fwrite(STDERR, "FATAL: PHP sees libcurl $v, need >= 8.12.0\n");
|
||||
exit(1);
|
||||
}
|
||||
'
|
||||
|
||||
- name: Install PHP 8.4
|
||||
run: |
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y php8.4 php8.4-curl php8.4-xml php8.4-mbstring php8.4-zip php8.4-ldap php8.4-gd
|
||||
sudo update-alternatives --set php /usr/bin/php8.4
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
php -v
|
||||
composer --version
|
||||
|
||||
- name: Run ${{ matrix.suite }}
|
||||
run: BEHAT_SUITES=${{ matrix.suite }} python3 tests/acceptance/run-github.py
|
||||
|
||||
cli-tests:
|
||||
needs: [build-and-test]
|
||||
name: ${{ matrix.suite }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
suite:
|
||||
- cliCommands,apiServiceAvailability # grouped like drone; needs ClamAV + email
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Enable pnpm
|
||||
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
|
||||
|
||||
- name: Install PHP 8.4
|
||||
run: |
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y php8.4 php8.4-curl php8.4-xml php8.4-mbstring php8.4-zip php8.4-ldap php8.4-gd
|
||||
sudo update-alternatives --set php /usr/bin/php8.4
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
php -v
|
||||
composer --version
|
||||
|
||||
- name: Run ${{ matrix.suite }}
|
||||
run: BEHAT_SUITES="${{ matrix.suite }}" python3 tests/acceptance/run-github.py
|
||||
|
||||
core-api-tests:
|
||||
name: ${{ matrix.suite }}
|
||||
needs: [build-and-test]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
suite:
|
||||
- "coreApiAuth,coreApiCapabilities,coreApiFavorites,coreApiMain,coreApiVersions"
|
||||
- "coreApiShareManagementBasicToShares,coreApiShareManagementToShares"
|
||||
- "coreApiSharees"
|
||||
- "coreApiSharePublicLink2"
|
||||
- "coreApiShareOperationsToShares1,coreApiShareOperationsToShares2,coreApiSharePublicLink1,coreApiShareCreateSpecialToShares1,coreApiShareCreateSpecialToShares2,coreApiShareUpdateToShares"
|
||||
- "coreApiTrashbin,coreApiTrashbinRestore,coreApiWebdavEtagPropagation1,coreApiWebdavEtagPropagation2"
|
||||
- "coreApiWebdavDelete,coreApiWebdavOperations,coreApiWebdavMove2"
|
||||
- "coreApiWebdavProperties"
|
||||
- "coreApiWebdavMove1,coreApiWebdavPreviews,coreApiWebdavUpload,coreApiWebdavUploadTUS"
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Enable pnpm
|
||||
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
|
||||
|
||||
- name: Install libcurl 8.12.0 from source
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
# NEEDRESTART_MODE=a: auto-restart services silently; without this, needrestart can fail with exit code 6
|
||||
sudo NEEDRESTART_MODE=a apt-get install -y libssl-dev libnghttp2-dev libpsl-dev libldap-dev libssh-dev zlib1g-dev libvips-dev
|
||||
cd /tmp
|
||||
curl -sLO https://curl.se/download/curl-8.12.0.tar.gz
|
||||
tar xzf curl-8.12.0.tar.gz
|
||||
cd curl-8.12.0
|
||||
./configure --with-ssl --with-zlib --with-nghttp2 --prefix=/usr/local --enable-versioned-symbols --silent
|
||||
make -j$(nproc) --silent
|
||||
sudo make install --silent
|
||||
sudo ldconfig
|
||||
curl --version | head -1
|
||||
php -r '
|
||||
$v = curl_version()["version"];
|
||||
echo "PHP curl: $v\n";
|
||||
if (version_compare($v, "8.12.0", "<")) {
|
||||
fwrite(STDERR, "FATAL: PHP sees libcurl $v, need >= 8.12.0\n");
|
||||
exit(1);
|
||||
}
|
||||
'
|
||||
|
||||
- name: Install PHP 8.4
|
||||
run: |
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y php8.4 php8.4-curl php8.4-xml php8.4-mbstring php8.4-zip php8.4-ldap php8.4-gd
|
||||
sudo update-alternatives --set php /usr/bin/php8.4
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
- name: Run ${{ matrix.suite }}
|
||||
run: >
|
||||
BEHAT_SUITES="${{ matrix.suite }}"
|
||||
ACCEPTANCE_TEST_TYPE=core-api
|
||||
WITH_REMOTE_PHP=true
|
||||
python3 tests/acceptance/run-github.py
|
||||
|
||||
e2e-tests:
|
||||
name: e2e-${{ matrix.suite }}
|
||||
needs: [build-and-test]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- suite: part-1
|
||||
args: "--total-parts 4 --xsuites search,app-provider,ocm,keycloak --run-part 1"
|
||||
- suite: part-2
|
||||
args: "--total-parts 4 --xsuites search,app-provider,ocm,keycloak --run-part 2"
|
||||
- suite: part-3
|
||||
args: "--total-parts 4 --xsuites search,app-provider,ocm,keycloak --run-part 3"
|
||||
- suite: part-4
|
||||
args: "--total-parts 4 --xsuites search,app-provider,ocm,keycloak --run-part 4"
|
||||
- suite: search
|
||||
args: "--suites search"
|
||||
tika: true
|
||||
- suite: keycloak
|
||||
args: "--suites journeys,keycloak"
|
||||
keycloak: true
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
- name: Enable pnpm
|
||||
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
|
||||
- name: Generate code
|
||||
run: |
|
||||
pnpm config set store-dir ./.pnpm-store
|
||||
make ci-node-generate
|
||||
env:
|
||||
CHROMEDRIVER_SKIP_DOWNLOAD: "true"
|
||||
|
||||
- name: Cache Playwright Chromium
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-chromium-${{ hashFiles('.drone.env') }}
|
||||
|
||||
# --- Tika (search suite only) ---
|
||||
- name: Start Tika
|
||||
if: matrix.tika == true
|
||||
run: |
|
||||
docker run -d --name tika --network host apache/tika:3.2.2.0-full
|
||||
timeout 120 bash -c 'until curl -sf http://localhost:9998; do sleep 2; done'
|
||||
echo "tika ready."
|
||||
|
||||
# --- Keycloak (keycloak suite only) ---
|
||||
- name: Generate Keycloak certs
|
||||
if: matrix.keycloak == true
|
||||
run: |
|
||||
mkdir -p keycloak-certs
|
||||
openssl req -x509 -newkey rsa:2048 \
|
||||
-keyout keycloak-certs/keycloakkey.pem \
|
||||
-out keycloak-certs/keycloakcrt.pem \
|
||||
-nodes -days 365 -subj '/CN=keycloak'
|
||||
chmod -R 777 keycloak-certs
|
||||
|
||||
- name: Start Postgres
|
||||
if: matrix.keycloak == true
|
||||
run: |
|
||||
docker run -d --name postgres --network host \
|
||||
-e POSTGRES_DB=keycloak \
|
||||
-e POSTGRES_USER=keycloak \
|
||||
-e POSTGRES_PASSWORD=keycloak \
|
||||
postgres:alpine3.18
|
||||
timeout 30 bash -c 'until docker exec postgres pg_isready -U keycloak; do sleep 1; done'
|
||||
|
||||
- name: Start Keycloak
|
||||
if: matrix.keycloak == true
|
||||
run: |
|
||||
# Patch realm: replace Drone Docker hostname with localhost IP
|
||||
sed 's|https://ocis-server:9200|https://127.0.0.1:9200|g' \
|
||||
tests/config/drone/ocis-ci-realm.dist.json > /tmp/ocis-realm.json
|
||||
docker run -d --name keycloak --network host \
|
||||
-e OCIS_DOMAIN=https://127.0.0.1:9200 \
|
||||
-e KC_HOSTNAME=localhost \
|
||||
-e KC_PORT=8443 \
|
||||
-e KC_DB=postgres \
|
||||
-e "KC_DB_URL=jdbc:postgresql://localhost:5432/keycloak" \
|
||||
-e KC_DB_USERNAME=keycloak \
|
||||
-e KC_DB_PASSWORD=keycloak \
|
||||
-e KC_FEATURES=impersonation \
|
||||
-e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
|
||||
-e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \
|
||||
-e KC_HTTPS_CERTIFICATE_FILE=/keycloak-certs/keycloakcrt.pem \
|
||||
-e KC_HTTPS_CERTIFICATE_KEY_FILE=/keycloak-certs/keycloakkey.pem \
|
||||
-v "$(pwd)/keycloak-certs:/keycloak-certs:ro" \
|
||||
-v "/tmp/ocis-realm.json:/opt/keycloak/data/import/oCIS-realm.json:ro" \
|
||||
quay.io/keycloak/keycloak:26.2.5 \
|
||||
start-dev --proxy-headers xforwarded \
|
||||
--spi-connections-http-client-default-disable-trust-manager=true \
|
||||
--import-realm --health-enabled=true
|
||||
timeout 300 bash -c 'until curl -skf https://localhost:9000/health/ready; do sleep 3; done' \
|
||||
|| (echo "=== keycloak logs ===" && docker logs keycloak --tail 80 && exit 1)
|
||||
echo "keycloak ready."
|
||||
|
||||
- name: Run e2e-${{ matrix.suite }}
|
||||
run: E2E_ARGS="${{ matrix.args }}" python3 tests/acceptance/run-e2e.py
|
||||
env:
|
||||
TIKA_NEEDED: ${{ matrix.tika == true && 'true' || 'false' }}
|
||||
KEYCLOAK_NEEDED: ${{ matrix.keycloak == true && 'true' || 'false' }}
|
||||
|
||||
litmus:
|
||||
name: litmus
|
||||
needs: [build-and-test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Run litmus
|
||||
run: python3 tests/acceptance/run-litmus.py
|
||||
|
||||
cs3api:
|
||||
name: cs3api
|
||||
needs: [build-and-test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Run cs3api validator
|
||||
run: python3 tests/acceptance/run-cs3api.py
|
||||
|
||||
wopi-builtin:
|
||||
name: wopi-builtin
|
||||
needs: [build-and-test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Run WOPI validator (builtin)
|
||||
run: python3 tests/acceptance/run-wopi.py --type builtin
|
||||
|
||||
wopi-cs3:
|
||||
name: wopi-cs3
|
||||
needs: [build-and-test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Run WOPI validator (cs3)
|
||||
run: python3 tests/acceptance/run-wopi.py --type cs3
|
||||
|
||||
all-acceptance-tests:
|
||||
needs: [local-api-tests, cli-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests]
|
||||
runs-on: ubuntu-latest
|
||||
if: always()
|
||||
steps:
|
||||
- name: Check all jobs passed
|
||||
run: |
|
||||
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
name: Remove Stale Branches
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: fpicalausa/remove-stale-branches@v2.4.0
|
||||
- uses: fpicalausa/remove-stale-branches@v1.6.0
|
||||
with:
|
||||
ignore-unknown-authors: true
|
||||
default-recipient: "kobergj"
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
name: Translation Sync
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
uses: owncloud/reusable-workflows/.github/workflows/translation-sync.yml@main
|
||||
with:
|
||||
mode: make
|
||||
sub_path: .
|
||||
secrets:
|
||||
TX_TOKEN: ${{ secrets.TX_TOKEN }}
|
||||
TRANSLATION_APP_ID: ${{ secrets.TRANSLATION_APP_ID }}
|
||||
TRANSLATION_APP_PRIVATE_KEY: ${{ secrets.TRANSLATION_APP_PRIVATE_KEY }}
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
container: golang:1.25-alpine
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run CI Reporter
|
||||
working-directory: tools/ci-reporter
|
||||
|
||||
+1
-2
@@ -63,5 +63,4 @@ go.work.sum
|
||||
.env
|
||||
.envrc
|
||||
CLAUDE.md
|
||||
.claude/
|
||||
.agents/
|
||||
.claude/
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# the following grep will filter out every line containing an `env` annotation
|
||||
# and prints all entries found that are invalid. this is required to see where CI might fail
|
||||
# The following grep will filter out every line containing an `env` annotation.
|
||||
# It will ignore every line that already has a valid `introductionVersion` annotation.
|
||||
|
||||
RED=$(echo -e "\033[0;31m")
|
||||
GREEN=$(echo -e "\033[0;32m")
|
||||
@@ -14,64 +14,48 @@ print_introduction_version_examples() {
|
||||
${GREEN}Valid examples:${NORM}
|
||||
|
||||
introductionVersion:"pre5.0"
|
||||
introductionVersion:"5.0" deprecationVersion:"7.0.0"
|
||||
introductionVersion:"5.0"
|
||||
introductionVersion:"4.9.3-rc5"
|
||||
introductionVersion:"5.0.1-cheesecake"
|
||||
introductionVersion:"5.10.100.15"
|
||||
introductionVersion:"0.0"
|
||||
introductionVersion:"release" deprecationVersion:"7.0.0"
|
||||
introductionVersion:"releaseX" deprecationVersion:"7.0.0"
|
||||
introductionVersion:"Addams" deprecationVersion:"7.0.0"
|
||||
introductionVersion:"releaseX" # acceptable alphabetical version
|
||||
introductionVersion:"Addams" # another alphabetical example such as a release name
|
||||
|
||||
${RED}Invalid examples:${NORM}
|
||||
|
||||
introductionVersion:""
|
||||
introductionVersion:" "
|
||||
introductionVersion:"-"
|
||||
introductionVersion:"--"
|
||||
introductionVersion:"51.0cheesecake" deprecationVersion:"7.0.0"
|
||||
introductionVersion:"50..0.1-cheesecake"
|
||||
introductionVersion:"15"
|
||||
introductionVersion:"54blueberry"
|
||||
introductionVersion:"5.0cheesecake"
|
||||
introductionVersion:"5"
|
||||
introductionVersion:"5blueberry"
|
||||
introductionVersion:"5-lasagna"
|
||||
introductionVersion:"5.lasagna-rc1"
|
||||
introductionVersion:"4.9.3rc-5" deprecationVersion:"7.0.0"
|
||||
introductionVersion:"5B-rc1" deprecationVersion:"7.0.0"
|
||||
introductionVersion:"4.9.3rc5"
|
||||
|
||||
See the envvar life cycle in the dev docs for more details:
|
||||
https://owncloud.dev/services/general-info/envvars/envvar-naming-scopes/
|
||||
See the dev docs for more details: https://owncloud.dev/services/general-info/envvars/envvar-naming-scopes/
|
||||
EOL
|
||||
}
|
||||
|
||||
ERROR=0
|
||||
|
||||
# note that our semver is not fully compliant because we do not have a patch version for new envvars
|
||||
# if you want to test, use the examples above and take the blocks separated by `|` (or)
|
||||
SEMVER_REGEX='(?:introductionVersion:\")(?:(?:[^\dA-Za-z]*?)\"|(?:\d+[A-z]+).*?\"|(?:\d*?\")|(?:\d*?[-\.]+\D.*?\")|(?:\d*?[\.]{2,}.*?\")|(?:\d+\.\d+[A-z]+\")|(?:(?:\d+\.)+\d+[A-z]+.*?\"))'
|
||||
SEMVER_REGEX="([0-9]|[1-9][0-9]*)(\.([0-9]|[1-9][0-9]*)){1,2}(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?"
|
||||
ALPHA_REGEX="[A-Za-z]+[A-Za-z0-9-]*"
|
||||
|
||||
# filter out the the following paths
|
||||
EXCLUDE_PATHS='_test.go|vendor/'
|
||||
|
||||
# query the code
|
||||
QI=$(git grep -n "env:" -- '*.go' | grep -v -E "${EXCLUDE_PATHS}" | grep --color=always -P "${SEMVER_REGEX}")
|
||||
|
||||
# count the results found
|
||||
RESULTS_INTRO=$(echo "${QI}"|wc -l)
|
||||
QI=$(git grep -n "env:" -- '*.go' |grep -v -P "introductionVersion:\"($SEMVER_REGEX|(pre5\\.0)|($ALPHA_REGEX))\""|grep -v "_test.go"|grep -v "vendor/")
|
||||
|
||||
# add a new line after each hit, eol identified via "´ which only appears at the end of each envvar string definition
|
||||
QUERY_INTRO=$(echo "${QI}" | sed "s#\"\`#\"\`\n#g")
|
||||
|
||||
RESULTS_INTRO=$(echo "${QUERY_INTRO}"|wc -l)
|
||||
|
||||
echo "Checking introductionVersion annotations"
|
||||
|
||||
if [ "${QUERY_INTRO}" != "" ] && [ "${RESULTS_INTRO}" -gt 0 ]; then
|
||||
echo
|
||||
echo "==============================================================================================="
|
||||
echo ${RED}"The following item(s) contain invalid or missing introductionVersion annotation(s):"${NORM}
|
||||
echo ${RED}"The following ${RESULTS_INTRO} items contain invalid or missing introductionVersion annotation(s):"${NORM}
|
||||
echo "==============================================================================================="
|
||||
echo
|
||||
echo "$QUERY_INTRO"
|
||||
echo
|
||||
echo ${GREEN}"${RESULTS_INTRO} items found"${NORM}
|
||||
echo
|
||||
print_introduction_version_examples
|
||||
echo
|
||||
ERROR=1
|
||||
@@ -80,13 +64,11 @@ else
|
||||
echo
|
||||
fi
|
||||
|
||||
# the following grep will filter out every line containing an `env` annotation and
|
||||
# will print each line that has an invalid `desc` annotation.
|
||||
# The following grep will filter out every line containing an `env` annotation
|
||||
# it will ignore every line that has allready a valid `desc` annotation
|
||||
|
||||
# query the code
|
||||
QUERY_DESC=$(git grep -n "env:" -- '*.go' | grep -v -E "${EXCLUDE_PATHS}" | grep -v --color=always -P "desc:\".{10,}\"")
|
||||
QUERY_DESC=$(git grep -n "env:" -- '*.go' |grep -v -P "desc:\".{10,}\""|grep -v "_test.go"|grep -v "vendor/")
|
||||
|
||||
# count the results found
|
||||
RESULTS_DESC=$(echo "${QUERY_DESC}"|wc -l)
|
||||
|
||||
echo "Checking description annotations"
|
||||
@@ -94,11 +76,9 @@ echo "Checking description annotations"
|
||||
if [ "${QUERY_DESC}" != "" ] && [ "${RESULTS_DESC}" -gt 0 ]; then
|
||||
echo
|
||||
echo "==============================================================================================="
|
||||
echo ${RED}"The following item(s) contain invalid or missing description annotation:"${NORM}
|
||||
echo ${RED}"The following ${RESULTS_DESC} items contain invalid or missing description annotation:"${NORM}
|
||||
echo "==============================================================================================="
|
||||
echo "$QUERY_DESC"
|
||||
echo
|
||||
echo ${GREEN}"${RESULTS_DESC} items found"${NORM}
|
||||
ERROR=1
|
||||
else
|
||||
echo "All description annotations are valid"
|
||||
|
||||
@@ -333,7 +333,7 @@ changelog-csv: $(CALENS)
|
||||
|
||||
.PHONY: govulncheck
|
||||
govulncheck: $(GOVULNCHECK)
|
||||
scripts/govulncheck-wrapper.sh $(GOVULNCHECK)
|
||||
$(GOVULNCHECK) ./...
|
||||
|
||||
.PHONY: l10n-push
|
||||
l10n-push:
|
||||
|
||||
@@ -4,4 +4,4 @@ bumped reva version
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12051
|
||||
https://github.com/owncloud/ocis/pull/12087
|
||||
https://github.com/owncloud/ocis/pull/12137
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
Enhancement: Add Keycloak to the ocis_full deployment example
|
||||
|
||||
Added Keycloak to the ocis_full deployment example.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12139
|
||||
@@ -1,9 +0,0 @@
|
||||
Bugfix: Avoid superfluous GetPublicShare call when deleting space permissions
|
||||
|
||||
We fixed `DeletePermission` to recognise space permission IDs (prefixed with
|
||||
`u:` or `g:`) by their format before making any gateway calls. Previously,
|
||||
deleting a space member always triggered a `GetPublicShare` lookup that was
|
||||
guaranteed to fail, producing a confusing error log.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12122
|
||||
https://github.com/owncloud/ocis/issues/12012
|
||||
@@ -1,10 +0,0 @@
|
||||
Enhancement: Log effective data and config paths at startup
|
||||
|
||||
oCIS now logs the effective data path and config path at startup so
|
||||
operators can immediately verify that data is written to the expected
|
||||
location. This helps catch misconfigured Docker volume mounts where
|
||||
data silently falls back to an ephemeral container path instead of
|
||||
the intended persistent mount.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12117
|
||||
https://github.com/owncloud/ocis/issues/12044
|
||||
@@ -1,11 +0,0 @@
|
||||
Bugfix: Always descend into directories during space reindexing
|
||||
|
||||
The search indexer's `IndexSpace` walk previously used `filepath.SkipDir`
|
||||
to skip entire directory subtrees when the directory itself was already
|
||||
indexed. After a failed or interrupted indexing run (e.g. Tika crash),
|
||||
this caused thousands of unindexed files to be permanently skipped
|
||||
because the parent directory's mtime had not changed. The indexer now
|
||||
always descends into directories, relying on the O(1) per-file DocID
|
||||
lookup to skip already-indexed files efficiently.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12119
|
||||
@@ -167,26 +167,6 @@ COMPANION_ONEDRIVE_KEY=
|
||||
COMPANION_ONEDRIVE_SECRET=
|
||||
|
||||
|
||||
### Keycloak Settings ###
|
||||
# The recommended (and tested) version to pull. If no version is used, it pulls "latest"
|
||||
# release notes: https://github.com/keycloak/keycloak/releases
|
||||
KEYCLOAK_DOCKER_TAG=26.2.5
|
||||
# Domain of Keycloak, where you can find the management and authentication frontend. Defaults to "keycloak.owncloud.test"
|
||||
KEYCLOAK_DOMAIN=
|
||||
# Realm which to be used with oCIS. Defaults to "oCIS"
|
||||
KEYCLOAK_REALM=
|
||||
# Admin user login name. Defaults to "admin"
|
||||
KEYCLOAK_ADMIN_USER=
|
||||
# Admin user login password. Defaults to "admin"
|
||||
KEYCLOAK_ADMIN_PASSWORD=
|
||||
# Enable tracing in Keycloak. Traces will be sent to "http://jaeger:4317". Defaults to "false"
|
||||
KEYCLOAK_TRACING=
|
||||
|
||||
# Enable Keycloak manually if you want to use it
|
||||
# Note: the leading colon is required to enable the service.
|
||||
#KEYCLOAK=:keycloak.yml
|
||||
|
||||
|
||||
## Default Enabled Services ##
|
||||
|
||||
### Apache Tika Content Analysis Toolkit ###
|
||||
@@ -297,4 +277,4 @@ MAIL_SERVER_DOCKER_TAG=v1.29.3
|
||||
# This MUST be the last line as it assembles the supplemental compose files to be used.
|
||||
# ALL supplemental configs must be added here, whether commented or not.
|
||||
# Each var must either be empty or contain :path/file.yml
|
||||
COMPOSE_FILE=docker-compose.yml${OCIS:-}${TIKA:-}${S3NG:-}${S3NG_MINIO:-}${COLLABORA:-}${IMPORTER:-}${CLAMAV:-}${ONLYOFFICE:-}${EXTENSIONS:-}${UNZIP:-}${DRAWIO:-}${JSONVIEWER:-}${PROGRESSBARS:-}${EXTERNALSITES:-}${PHOTOADDON:-}${ADVANCEDSEARCH:-}${MAIL_SERVER:-}${MONITORING:-}${KEYCLOAK:-}
|
||||
COMPOSE_FILE=docker-compose.yml${OCIS:-}${TIKA:-}${S3NG:-}${S3NG_MINIO:-}${COLLABORA:-}${IMPORTER:-}${CLAMAV:-}${ONLYOFFICE:-}${EXTENSIONS:-}${UNZIP:-}${DRAWIO:-}${JSONVIEWER:-}${PROGRESSBARS:-}${EXTERNALSITES:-}${PHOTOADDON:-}${ADVANCEDSEARCH:-}${MAIL_SERVER:-}${MONITORING:-}
|
||||
@@ -15,11 +15,4 @@ This deployment example is documented in two locations for different audiences:
|
||||
Providing details which are more developer focused. This description can also be used when deviating from the default.\
|
||||
Note that this examples uses self signed certificates and is intended for testing purposes.
|
||||
|
||||
## Optional Services
|
||||
|
||||
### Keycloak
|
||||
|
||||
Keycloak can be optionally enabled by uncommenting the corresponding variables in the `.env` file:
|
||||
- `KEYCLOAK=:keycloak.yml`
|
||||
|
||||
Note that Keycloak requires the default `ocis` Identity Provider to be disabled, which is automatically handled when the `keycloak.yml` configuration is used.
|
||||
@@ -1,64 +0,0 @@
|
||||
{
|
||||
"clientId": "e4rAsNUSIUs0lF4nbv9FmCeUkTlV9GdgTLDH1b5uie7syb90SzEVrbN7HIpmWJeD",
|
||||
"name": "ownCloud Android app",
|
||||
"surrogateAuthRequired": false,
|
||||
"enabled": true,
|
||||
"alwaysDisplayInConsole": false,
|
||||
"clientAuthenticatorType": "client-secret",
|
||||
"secret": "dInFYGV33xKzhbRmpqQltYNdfLdJIfJ9L5ISoKhNoT9qZftpdWSP71VrpGR9pmoD",
|
||||
"redirectUris": [
|
||||
"oc://android.owncloud.com"
|
||||
],
|
||||
"webOrigins": [],
|
||||
"notBefore": 0,
|
||||
"bearerOnly": false,
|
||||
"consentRequired": false,
|
||||
"standardFlowEnabled": true,
|
||||
"implicitFlowEnabled": false,
|
||||
"directAccessGrantsEnabled": true,
|
||||
"serviceAccountsEnabled": false,
|
||||
"publicClient": false,
|
||||
"frontchannelLogout": false,
|
||||
"protocol": "openid-connect",
|
||||
"attributes": {
|
||||
"saml.assertion.signature": "false",
|
||||
"saml.force.post.binding": "false",
|
||||
"saml.multivalued.roles": "false",
|
||||
"saml.encrypt": "false",
|
||||
"post.logout.redirect.uris": "+",
|
||||
"backchannel.logout.revoke.offline.tokens": "false",
|
||||
"saml.server.signature": "false",
|
||||
"saml.server.signature.keyinfo.ext": "false",
|
||||
"exclude.session.state.from.auth.response": "false",
|
||||
"backchannel.logout.session.required": "true",
|
||||
"client_credentials.use_refresh_token": "false",
|
||||
"saml_force_name_id_format": "false",
|
||||
"saml.client.signature": "false",
|
||||
"tls.client.certificate.bound.access.tokens": "false",
|
||||
"saml.authnstatement": "false",
|
||||
"display.on.consent.screen": "false",
|
||||
"saml.onetimeuse.condition": "false"
|
||||
},
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": true,
|
||||
"nodeReRegistrationTimeout": -1,
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"profile",
|
||||
"roles",
|
||||
"groups",
|
||||
"basic",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
],
|
||||
"access": {
|
||||
"view": true,
|
||||
"configure": true,
|
||||
"manage": true
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
{
|
||||
"clientId": "3keLfua0olYvW1zKXTDB3OjAMPEYWEQNuiscli395GKJOiPnPURNQWGvGCJZf4Hw",
|
||||
"name": "Cyberduck",
|
||||
"description": "",
|
||||
"surrogateAuthRequired": false,
|
||||
"enabled": true,
|
||||
"alwaysDisplayInConsole": false,
|
||||
"clientAuthenticatorType": "client-secret",
|
||||
"secret": "yoqICbLIeYbpZPqDH4D8k4NKb04HqnrWBntEeVZEQ5gO1RmaUlln0Aqu1dj2UoF4",
|
||||
"redirectUris": [
|
||||
"x-cyberduck-action:oauth",
|
||||
"x-mountainduck-action:oauth"
|
||||
],
|
||||
"webOrigins": [],
|
||||
"notBefore": 0,
|
||||
"bearerOnly": false,
|
||||
"consentRequired": false,
|
||||
"standardFlowEnabled": true,
|
||||
"implicitFlowEnabled": false,
|
||||
"directAccessGrantsEnabled": true,
|
||||
"serviceAccountsEnabled": false,
|
||||
"publicClient": false,
|
||||
"frontchannelLogout": false,
|
||||
"protocol": "openid-connect",
|
||||
"attributes": {
|
||||
"saml.assertion.signature": "false",
|
||||
"saml.force.post.binding": "false",
|
||||
"saml.multivalued.roles": "false",
|
||||
"saml.encrypt": "false",
|
||||
"oauth2.device.authorization.grant.enabled": "false",
|
||||
"backchannel.logout.revoke.offline.tokens": "false",
|
||||
"saml.server.signature": "false",
|
||||
"saml.server.signature.keyinfo.ext": "false",
|
||||
"exclude.session.state.from.auth.response": "false",
|
||||
"oidc.ciba.grant.enabled": "false",
|
||||
"backchannel.logout.session.required": "true",
|
||||
"client_credentials.use_refresh_token": "false",
|
||||
"saml_force_name_id_format": "false",
|
||||
"saml.client.signature": "false",
|
||||
"tls.client.certificate.bound.access.tokens": "false",
|
||||
"saml.authnstatement": "false",
|
||||
"display.on.consent.screen": "false",
|
||||
"saml.onetimeuse.condition": "false"
|
||||
},
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": true,
|
||||
"nodeReRegistrationTimeout": -1,
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"profile",
|
||||
"roles",
|
||||
"groups",
|
||||
"basic",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
],
|
||||
"access": {
|
||||
"view": true,
|
||||
"configure": true,
|
||||
"manage": true
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
{
|
||||
"clientId": "xdXOt13JKxym1B1QcEncf2XDkLAexMBFwiT9j6EfhhHFJhs2KM9jbjTmf8JBXE69",
|
||||
"name": "ownCloud Desktop Client",
|
||||
"surrogateAuthRequired": false,
|
||||
"enabled": true,
|
||||
"alwaysDisplayInConsole": false,
|
||||
"clientAuthenticatorType": "client-secret",
|
||||
"secret": "UBntmLjC2yYCeHwsyj73Uwo9TAaecAetRwMw0xYcvNL9yRdLSUi0hUAHfvCHFeFh",
|
||||
"redirectUris": [
|
||||
"http://127.0.0.1:*",
|
||||
"http://localhost:*"
|
||||
],
|
||||
"webOrigins": [],
|
||||
"notBefore": 0,
|
||||
"bearerOnly": false,
|
||||
"consentRequired": false,
|
||||
"standardFlowEnabled": true,
|
||||
"implicitFlowEnabled": false,
|
||||
"directAccessGrantsEnabled": true,
|
||||
"serviceAccountsEnabled": false,
|
||||
"publicClient": false,
|
||||
"frontchannelLogout": false,
|
||||
"protocol": "openid-connect",
|
||||
"attributes": {
|
||||
"saml.assertion.signature": "false",
|
||||
"saml.force.post.binding": "false",
|
||||
"saml.multivalued.roles": "false",
|
||||
"saml.encrypt": "false",
|
||||
"post.logout.redirect.uris": "+",
|
||||
"backchannel.logout.revoke.offline.tokens": "false",
|
||||
"saml.server.signature": "false",
|
||||
"saml.server.signature.keyinfo.ext": "false",
|
||||
"exclude.session.state.from.auth.response": "false",
|
||||
"backchannel.logout.session.required": "true",
|
||||
"client_credentials.use_refresh_token": "false",
|
||||
"saml_force_name_id_format": "false",
|
||||
"saml.client.signature": "false",
|
||||
"tls.client.certificate.bound.access.tokens": "false",
|
||||
"saml.authnstatement": "false",
|
||||
"display.on.consent.screen": "false",
|
||||
"saml.onetimeuse.condition": "false"
|
||||
},
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": true,
|
||||
"nodeReRegistrationTimeout": -1,
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"profile",
|
||||
"roles",
|
||||
"groups",
|
||||
"basic",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
],
|
||||
"access": {
|
||||
"view": true,
|
||||
"configure": true,
|
||||
"manage": true
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
{
|
||||
"clientId": "mxd5OQDk6es5LzOzRvidJNfXLUZS2oN3oUFeXPP8LpPrhx3UroJFduGEYIBOxkY1",
|
||||
"name": "ownCloud iOS app",
|
||||
"surrogateAuthRequired": false,
|
||||
"enabled": true,
|
||||
"alwaysDisplayInConsole": false,
|
||||
"clientAuthenticatorType": "client-secret",
|
||||
"secret": "KFeFWWEZO9TkisIQzR3fo7hfiMXlOpaqP8CFuTbSHzV1TUuGECglPxpiVKJfOXIx",
|
||||
"redirectUris": [
|
||||
"oc://ios.owncloud.com"
|
||||
],
|
||||
"webOrigins": [],
|
||||
"notBefore": 0,
|
||||
"bearerOnly": false,
|
||||
"consentRequired": false,
|
||||
"standardFlowEnabled": true,
|
||||
"implicitFlowEnabled": false,
|
||||
"directAccessGrantsEnabled": true,
|
||||
"serviceAccountsEnabled": false,
|
||||
"publicClient": false,
|
||||
"frontchannelLogout": false,
|
||||
"protocol": "openid-connect",
|
||||
"attributes": {
|
||||
"saml.assertion.signature": "false",
|
||||
"saml.force.post.binding": "false",
|
||||
"saml.multivalued.roles": "false",
|
||||
"saml.encrypt": "false",
|
||||
"post.logout.redirect.uris": "+",
|
||||
"backchannel.logout.revoke.offline.tokens": "false",
|
||||
"saml.server.signature": "false",
|
||||
"saml.server.signature.keyinfo.ext": "false",
|
||||
"exclude.session.state.from.auth.response": "false",
|
||||
"backchannel.logout.session.required": "true",
|
||||
"client_credentials.use_refresh_token": "false",
|
||||
"saml_force_name_id_format": "false",
|
||||
"saml.client.signature": "false",
|
||||
"tls.client.certificate.bound.access.tokens": "false",
|
||||
"saml.authnstatement": "false",
|
||||
"display.on.consent.screen": "false",
|
||||
"saml.onetimeuse.condition": "false"
|
||||
},
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": true,
|
||||
"nodeReRegistrationTimeout": -1,
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"profile",
|
||||
"roles",
|
||||
"groups",
|
||||
"basic",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
],
|
||||
"access": {
|
||||
"view": true,
|
||||
"configure": true,
|
||||
"manage": true
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
{
|
||||
"clientId": "web",
|
||||
"name": "",
|
||||
"description": "",
|
||||
"rootUrl": "https://ocis.owncloud.test",
|
||||
"adminUrl": "https://ocis.owncloud.test",
|
||||
"baseUrl": "",
|
||||
"surrogateAuthRequired": false,
|
||||
"enabled": true,
|
||||
"alwaysDisplayInConsole": false,
|
||||
"clientAuthenticatorType": "client-secret",
|
||||
"redirectUris": [
|
||||
"https://ocis.owncloud.test/*"
|
||||
],
|
||||
"webOrigins": [
|
||||
"https://ocis.owncloud.test"
|
||||
],
|
||||
"notBefore": 0,
|
||||
"bearerOnly": false,
|
||||
"consentRequired": false,
|
||||
"standardFlowEnabled": true,
|
||||
"implicitFlowEnabled": false,
|
||||
"directAccessGrantsEnabled": true,
|
||||
"serviceAccountsEnabled": false,
|
||||
"publicClient": true,
|
||||
"frontchannelLogout": false,
|
||||
"protocol": "openid-connect",
|
||||
"attributes": {
|
||||
"saml.assertion.signature": "false",
|
||||
"saml.force.post.binding": "false",
|
||||
"saml.multivalued.roles": "false",
|
||||
"saml.encrypt": "false",
|
||||
"post.logout.redirect.uris": "+",
|
||||
"oauth2.device.authorization.grant.enabled": "false",
|
||||
"backchannel.logout.revoke.offline.tokens": "false",
|
||||
"saml.server.signature": "false",
|
||||
"saml.server.signature.keyinfo.ext": "false",
|
||||
"exclude.session.state.from.auth.response": "false",
|
||||
"oidc.ciba.grant.enabled": "false",
|
||||
"backchannel.logout.url": "https://ocis.owncloud.test/backchannel_logout",
|
||||
"backchannel.logout.session.required": "true",
|
||||
"client_credentials.use_refresh_token": "false",
|
||||
"saml_force_name_id_format": "false",
|
||||
"saml.client.signature": "false",
|
||||
"tls.client.certificate.bound.access.tokens": "false",
|
||||
"saml.authnstatement": "false",
|
||||
"display.on.consent.screen": "false",
|
||||
"saml.onetimeuse.condition": "false"
|
||||
},
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": true,
|
||||
"nodeReRegistrationTimeout": -1,
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"profile",
|
||||
"roles",
|
||||
"groups",
|
||||
"basic",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
],
|
||||
"access": {
|
||||
"view": true,
|
||||
"configure": true,
|
||||
"manage": true
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
printenv
|
||||
# replace oCIS domain in keycloak realm import
|
||||
mkdir /opt/keycloak/data/import
|
||||
sed -e "s/ocis.owncloud.test/${OCIS_DOMAIN}/g" /opt/keycloak/data/import-dist/ocis-realm.json > /opt/keycloak/data/import/oCIS-realm.json
|
||||
|
||||
# run original docker-entrypoint
|
||||
/opt/keycloak/bin/kc.sh "$@"
|
||||
File diff suppressed because it is too large.
Load diff
@@ -7,8 +7,6 @@ directives:
|
||||
- 'https://${COMPANION_DOMAIN|companion.owncloud.test}/'
|
||||
- 'wss://${COMPANION_DOMAIN|companion.owncloud.test}/'
|
||||
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
|
||||
# In contrary to bash and docker the default is given after the | character
|
||||
- 'https://${KEYCLOAK_DOMAIN|keycloak.owncloud.test}/'
|
||||
# Photo-addon: OpenStreetMap tile requests
|
||||
- 'https://*.tile.openstreetmap.org'
|
||||
default-src:
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
---
|
||||
services:
|
||||
traefik:
|
||||
networks:
|
||||
ocis-net:
|
||||
aliases:
|
||||
- ${KEYCLOAK_DOMAIN:-keycloak.owncloud.test}
|
||||
|
||||
ocis:
|
||||
environment:
|
||||
# Keycloak IDP specific configuration
|
||||
PROXY_AUTOPROVISION_ACCOUNTS: "true"
|
||||
PROXY_ROLE_ASSIGNMENT_DRIVER: "oidc"
|
||||
OCIS_OIDC_ISSUER: https://${KEYCLOAK_DOMAIN:-keycloak.owncloud.test}/realms/${KEYCLOAK_REALM:-oCIS}
|
||||
PROXY_OIDC_REWRITE_WELLKNOWN: "true"
|
||||
WEB_OIDC_CLIENT_ID: ${OCIS_OIDC_CLIENT_ID:-web}
|
||||
PROXY_USER_OIDC_CLAIM: "preferred_username"
|
||||
PROXY_USER_CS3_CLAIM: "username"
|
||||
OCIS_EXCLUDE_RUN_SERVICES: "idp"
|
||||
GRAPH_ASSIGN_DEFAULT_USER_ROLE: "false"
|
||||
GRAPH_USERNAME_MATCH: "none"
|
||||
KEYCLOAK_DOMAIN: ${KEYCLOAK_DOMAIN:-keycloak.owncloud.test}
|
||||
WEB_OIDC_SCOPE: "openid profile email acr"
|
||||
|
||||
postgres:
|
||||
image: postgres:alpine
|
||||
networks:
|
||||
ocis-net:
|
||||
volumes:
|
||||
- keycloak_postgres_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_DB: keycloak
|
||||
POSTGRES_USER: keycloak
|
||||
POSTGRES_PASSWORD: keycloak
|
||||
logging:
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
keycloak:
|
||||
image: quay.io/keycloak/keycloak:${KEYCLOAK_DOCKER_TAG}
|
||||
networks:
|
||||
ocis-net:
|
||||
command: ["start", "--spi-connections-http-client-default-disable-trust-manager=${INSECURE:-false}", "--import-realm"]
|
||||
entrypoint: ["/bin/sh", "/opt/keycloak/bin/docker-entrypoint-override.sh"]
|
||||
volumes:
|
||||
- "./config/keycloak/docker-entrypoint-override.sh:/opt/keycloak/bin/docker-entrypoint-override.sh"
|
||||
- "./config/keycloak/ocis-realm.dist.json:/opt/keycloak/data/import-dist/ocis-realm.json"
|
||||
environment:
|
||||
OCIS_DOMAIN: ${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
KC_HOSTNAME: ${KEYCLOAK_DOMAIN:-keycloak.owncloud.test}
|
||||
KC_DB: postgres
|
||||
KC_DB_URL: "jdbc:postgresql://postgres:5432/keycloak"
|
||||
KC_DB_USERNAME: keycloak
|
||||
KC_DB_PASSWORD: keycloak
|
||||
KC_FEATURES: impersonation,opentelemetry
|
||||
KC_BOOTSTRAP_ADMIN_USERNAME: ${KEYCLOAK_ADMIN_USER:-admin}
|
||||
KC_BOOTSTRAP_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:-admin}
|
||||
# as replacement of --proxy=edge
|
||||
KC_PROXY_HEADERS: xforwarded
|
||||
KC_HTTP_ENABLED: true
|
||||
# tracing
|
||||
KC_TRACING_ENABLED: ${KEYCLOAK_TRACING:-false}
|
||||
KC_TRACING_ENDPOINT: http://jaeger:4317
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.keycloak.entrypoints=https"
|
||||
- "traefik.http.routers.keycloak.rule=Host(`${KEYCLOAK_DOMAIN:-keycloak.owncloud.test}`)"
|
||||
- "traefik.http.routers.keycloak.tls.certresolver=http"
|
||||
- "traefik.http.routers.keycloak.service=keycloak"
|
||||
- "traefik.http.services.keycloak.loadbalancer.server.port=8080"
|
||||
depends_on:
|
||||
- postgres
|
||||
logging:
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
keycloak_postgres_data:
|
||||
+156
-155
@@ -6038,10 +6038,10 @@ IDM_ADMIN_USER_ID:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
IDM_CREATE_DEMO_USERS:
|
||||
name: SETTINGS_SETUP_DEFAULT_ASSIGNMENTS;IDM_CREATE_DEMO_USERS
|
||||
name: IDM_CREATE_DEMO_USERS
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: The default role assignments the demo users should be setup.
|
||||
description: Flag to enable or disable the creation of the demo users.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
@@ -7882,12 +7882,12 @@ OCDAV_WEBDAV_NAMESPACE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_ADMIN_USER_ID:
|
||||
name: OCIS_ADMIN_USER_ID;SETTINGS_ADMIN_USER_ID
|
||||
name: OCIS_ADMIN_USER_ID;STORAGE_USERS_PURGE_TRASH_BIN_USER_ID
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: ID of the user that should receive admin privileges. Consider that
|
||||
the UUID can be encoded in some LDAP deployment configurations like in .ldif files.
|
||||
These need to be decoded beforehand.
|
||||
description: ID of the user who collects all necessary information for deletion.
|
||||
Consider that the UUID can be encoded in some LDAP deployment configurations like
|
||||
in .ldif files. These need to be decoded beforehand.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
@@ -7912,28 +7912,28 @@ OCIS_ASYNC_UPLOADS:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CACHE_AUTH_PASSWORD:
|
||||
name: OCIS_CACHE_AUTH_PASSWORD;GRAPH_CACHE_AUTH_PASSWORD
|
||||
name: OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_ID_CACHE_AUTH_PASSWORD
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The password to authenticate with the cache. Only applies when store
|
||||
type 'nats-js-kv' is configured.
|
||||
description: The password to authenticate with the cache store. Only applies when
|
||||
store type 'nats-js-kv' is configured.
|
||||
introductionVersion: "5.0"
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CACHE_AUTH_USERNAME:
|
||||
name: OCIS_CACHE_AUTH_USERNAME;GRAPH_CACHE_AUTH_USERNAME
|
||||
name: OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_ID_CACHE_AUTH_USERNAME
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The username to authenticate with the cache. Only applies when store
|
||||
type 'nats-js-kv' is configured.
|
||||
description: The username to authenticate with the cache store. Only applies when
|
||||
store type 'nats-js-kv' is configured.
|
||||
introductionVersion: "5.0"
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CACHE_DATABASE:
|
||||
name: OCIS_CACHE_DATABASE
|
||||
defaultValue: cache-userinfo
|
||||
defaultValue: ids-storage-users
|
||||
type: string
|
||||
description: The database name the configured store should use.
|
||||
introductionVersion: pre5.0
|
||||
@@ -7941,7 +7941,7 @@ OCIS_CACHE_DATABASE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CACHE_DISABLE_PERSISTENCE:
|
||||
name: OCIS_CACHE_DISABLE_PERSISTENCE;GRAPH_CACHE_DISABLE_PERSISTENCE
|
||||
name: OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_ID_CACHE_DISABLE_PERSISTENCE
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Disables persistence of the cache. Only applies when store type 'nats-js-kv'
|
||||
@@ -7951,7 +7951,7 @@ OCIS_CACHE_DISABLE_PERSISTENCE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CACHE_STORE:
|
||||
name: OCIS_CACHE_STORE;GRAPH_CACHE_STORE
|
||||
name: OCIS_CACHE_STORE;STORAGE_USERS_ID_CACHE_STORE
|
||||
defaultValue: memory
|
||||
type: string
|
||||
description: 'The type of the cache store. Supported values are: ''memory'', ''redis-sentinel'',
|
||||
@@ -7961,11 +7961,11 @@ OCIS_CACHE_STORE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CACHE_STORE_NODES:
|
||||
name: OCIS_CACHE_STORE_NODES;GRAPH_CACHE_STORE_NODES
|
||||
name: OCIS_CACHE_STORE_NODES;STORAGE_USERS_ID_CACHE_STORE_NODES
|
||||
defaultValue: '[127.0.0.1:9233]'
|
||||
type: '[]string'
|
||||
description: A list of nodes to access the configured store. This has no effect
|
||||
when 'memory' store are configured. Note that the behaviour how nodes are used
|
||||
when 'memory' store is configured. Note that the behaviour how nodes are used
|
||||
is dependent on the library of the configured store. See the Environment Variable
|
||||
Types description for more details.
|
||||
introductionVersion: pre5.0
|
||||
@@ -7973,11 +7973,13 @@ OCIS_CACHE_STORE_NODES:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CACHE_TTL:
|
||||
name: OCIS_CACHE_TTL;GRAPH_CACHE_TTL
|
||||
defaultValue: 336h0m0s
|
||||
name: OCIS_CACHE_TTL;STORAGE_USERS_ID_CACHE_TTL
|
||||
defaultValue: 24m0s
|
||||
type: Duration
|
||||
description: Time to live for cache records in the graph. Defaults to '336h' (2
|
||||
weeks). See the Environment Variable Types description for more details.
|
||||
description: Default time to live for user info in the user info cache. Only applied
|
||||
when access tokens have no expiration. Defaults to 300s which is derived from
|
||||
the underlaying package though not explicitly set as default. See the Environment
|
||||
Variable Types description for more details.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
@@ -8020,46 +8022,46 @@ OCIS_CLAIM_MANAGED_SPACES_REGEXP:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CORS_ALLOW_CREDENTIALS:
|
||||
name: OCIS_CORS_ALLOW_CREDENTIALS;THUMBNAILS_CORS_ALLOW_CREDENTIALS
|
||||
name: OCIS_CORS_ALLOW_CREDENTIALS;AUTH_APP_CORS_ALLOW_CREDENTIALS
|
||||
defaultValue: "true"
|
||||
type: bool
|
||||
description: 'Allow credentials for CORS.See following chapter for more details:
|
||||
*Access-Control-Allow-Credentials* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials.'
|
||||
introductionVersion: "6.0"
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CORS_ALLOW_HEADERS:
|
||||
name: OCIS_CORS_ALLOW_HEADERS;THUMBNAILS_CORS_ALLOW_HEADERS
|
||||
name: OCIS_CORS_ALLOW_HEADERS;AUTH_APP_CORS_ALLOW_HEADERS
|
||||
defaultValue: '[Authorization Origin Content-Type Accept X-Requested-With X-Request-Id
|
||||
Cache-Control]'
|
||||
Ocs-Apirequest]'
|
||||
type: '[]string'
|
||||
description: 'A list of allowed CORS headers. See following chapter for more details:
|
||||
*Access-Control-Request-Headers* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Headers.
|
||||
See the Environment Variable Types description for more details.'
|
||||
introductionVersion: "6.0"
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CORS_ALLOW_METHODS:
|
||||
name: OCIS_CORS_ALLOW_METHODS;THUMBNAILS_CORS_ALLOW_METHODS
|
||||
defaultValue: '[GET POST PUT PATCH DELETE OPTIONS]'
|
||||
name: OCIS_CORS_ALLOW_METHODS;AUTH_APP_CORS_ALLOW_METHODS
|
||||
defaultValue: '[GET POST DELETE]'
|
||||
type: '[]string'
|
||||
description: 'A list of allowed CORS methods. See following chapter for more details:
|
||||
*Access-Control-Request-Method* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Method.
|
||||
See the Environment Variable Types description for more details.'
|
||||
introductionVersion: "6.0"
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_CORS_ALLOW_ORIGINS:
|
||||
name: OCIS_CORS_ALLOW_ORIGINS;THUMBNAILS_CORS_ALLOW_ORIGINS
|
||||
name: OCIS_CORS_ALLOW_ORIGINS;AUTH_APP_CORS_ALLOW_ORIGINS
|
||||
defaultValue: '[*]'
|
||||
type: '[]string'
|
||||
description: 'A list of allowed CORS origins. See following chapter for more details:
|
||||
*Access-Control-Allow-Origin* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin.
|
||||
See the Environment Variable Types description for more details.'
|
||||
introductionVersion: "6.0"
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
@@ -8176,25 +8178,27 @@ OCIS_ENABLE_OCM:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_EVENTS_AUTH_PASSWORD:
|
||||
name: OCIS_EVENTS_AUTH_PASSWORD;SHARING_EVENTS_AUTH_PASSWORD
|
||||
name: OCIS_EVENTS_AUTH_PASSWORD;OCM_EVENTS_AUTH_PASSWORD
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: Password for the events broker.
|
||||
description: The password to authenticate with the events broker. The events broker
|
||||
is the ocis service which receives and delivers events between the services.
|
||||
introductionVersion: "5.0"
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_EVENTS_AUTH_USERNAME:
|
||||
name: OCIS_EVENTS_AUTH_USERNAME;SHARING_EVENTS_AUTH_USERNAME
|
||||
name: OCIS_EVENTS_AUTH_USERNAME;OCM_EVENTS_AUTH_USERNAME
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: Username for the events broker.
|
||||
description: The username to authenticate with the events broker. The events broker
|
||||
is the ocis service which receives and delivers events between the services.
|
||||
introductionVersion: "5.0"
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_EVENTS_CLUSTER:
|
||||
name: OCIS_EVENTS_CLUSTER;SHARING_EVENTS_CLUSTER
|
||||
name: OCIS_EVENTS_CLUSTER;OCM_EVENTS_CLUSTER
|
||||
defaultValue: ocis-cluster
|
||||
type: string
|
||||
description: The clusterID of the event system. The event system is the message
|
||||
@@ -8205,7 +8209,7 @@ OCIS_EVENTS_CLUSTER:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_EVENTS_ENABLE_TLS:
|
||||
name: OCIS_EVENTS_ENABLE_TLS;SHARING_EVENTS_ENABLE_TLS
|
||||
name: OCIS_EVENTS_ENABLE_TLS;OCM_EVENTS_ENABLE_TLS
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Enable TLS for the connection to the events broker. The events broker
|
||||
@@ -8215,7 +8219,7 @@ OCIS_EVENTS_ENABLE_TLS:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_EVENTS_ENDPOINT:
|
||||
name: OCIS_EVENTS_ENDPOINT;SHARING_EVENTS_ENDPOINT
|
||||
name: OCIS_EVENTS_ENDPOINT;OCM_EVENTS_ENDPOINT
|
||||
defaultValue: 127.0.0.1:9233
|
||||
type: string
|
||||
description: The address of the event system. The event system is the message queuing
|
||||
@@ -8225,21 +8229,21 @@ OCIS_EVENTS_ENDPOINT:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_EVENTS_TLS_ROOT_CA_CERTIFICATE:
|
||||
name: OCIS_EVENTS_TLS_ROOT_CA_CERTIFICATE;SHARING_EVENTS_TLS_ROOT_CA_CERTIFICATE
|
||||
name: OCIS_EVENTS_TLS_ROOT_CA_CERTIFICATE;OCM_EVENTS_TLS_ROOT_CA_CERTIFICATE
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The root CA certificate used to validate the server's TLS certificate.
|
||||
If provided SHARING_EVENTS_TLS_INSECURE will be seen as false.
|
||||
If provided OCM_EVENTS_TLS_INSECURE will be seen as false.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_GATEWAY_GRPC_ADDR:
|
||||
name: OCIS_GATEWAY_GRPC_ADDR;GATEWAY_GRPC_ADDR
|
||||
name: OCIS_GATEWAY_GRPC_ADDR;STORAGE_USERS_GATEWAY_GRPC_ADDR
|
||||
defaultValue: 127.0.0.1:9142
|
||||
type: string
|
||||
description: The bind address of the GRPC service.
|
||||
introductionVersion: pre5.0
|
||||
description: The bind address of the gateway GRPC address.
|
||||
introductionVersion: "5.0"
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
@@ -8267,11 +8271,11 @@ OCIS_GRPC_CLIENT_TLS_MODE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_GRPC_PROTOCOL:
|
||||
name: OCIS_GRPC_PROTOCOL;SHARING_GRPC_PROTOCOL
|
||||
name: OCIS_GRPC_PROTOCOL;AUTH_APP_GRPC_PROTOCOL
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The transport protocol of the GRPC service.
|
||||
introductionVersion: pre5.0
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
@@ -8307,7 +8311,7 @@ OCIS_HTTP_TLS_KEY:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_INSECURE:
|
||||
name: OCIS_INSECURE;SHARING_EVENTS_TLS_INSECURE
|
||||
name: OCIS_INSECURE;OCM_EVENTS_TLS_INSECURE
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Whether to verify the server TLS certificates.
|
||||
@@ -8316,11 +8320,11 @@ OCIS_INSECURE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_JWT_SECRET:
|
||||
name: OCIS_JWT_SECRET;SHARING_JWT_SECRET
|
||||
name: OCIS_JWT_SECRET;AUTH_APP_JWT_SECRET
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The secret to mint and validate jwt tokens.
|
||||
introductionVersion: pre5.0
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
@@ -8380,8 +8384,8 @@ OCIS_KEYCLOAK_USER_REALM:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_BIND_DN:
|
||||
name: OCIS_LDAP_BIND_DN;AUTH_BASIC_LDAP_BIND_DN
|
||||
defaultValue: uid=reva,ou=sysusers,o=libregraph-idm
|
||||
name: OCIS_LDAP_BIND_DN;GRAPH_LDAP_BIND_DN
|
||||
defaultValue: uid=libregraph,ou=sysusers,o=libregraph-idm
|
||||
type: string
|
||||
description: LDAP DN to use for simple bind authentication with the target LDAP
|
||||
server.
|
||||
@@ -8390,7 +8394,7 @@ OCIS_LDAP_BIND_DN:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_BIND_PASSWORD:
|
||||
name: OCIS_LDAP_BIND_PASSWORD;AUTH_BASIC_LDAP_BIND_PASSWORD
|
||||
name: OCIS_LDAP_BIND_PASSWORD;GRAPH_LDAP_BIND_PASSWORD
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: Password to use for authenticating the 'bind_dn'.
|
||||
@@ -8399,7 +8403,7 @@ OCIS_LDAP_BIND_PASSWORD:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_CACERT:
|
||||
name: OCIS_LDAP_CACERT;AUTH_BASIC_LDAP_CACERT
|
||||
name: OCIS_LDAP_CACERT;GRAPH_LDAP_CACERT
|
||||
defaultValue: /var/lib/ocis/idm/ldap.crt
|
||||
type: string
|
||||
description: Path/File name for the root CA certificate (in PEM format) used to
|
||||
@@ -8420,20 +8424,20 @@ OCIS_LDAP_CROSS_INSTANCE_REFERENCE_TEMPLATE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_DISABLE_USER_MECHANISM:
|
||||
name: OCIS_LDAP_DISABLE_USER_MECHANISM;AUTH_BASIC_DISABLE_USER_MECHANISM
|
||||
name: OCIS_LDAP_DISABLE_USER_MECHANISM;GRAPH_DISABLE_USER_MECHANISM
|
||||
defaultValue: attribute
|
||||
type: string
|
||||
description: An option to control the behavior for disabling users. Valid options
|
||||
description: An option to control the behavior for disabling users. Supported options
|
||||
are 'none', 'attribute' and 'group'. If set to 'group', disabling a user via API
|
||||
will add the user to the configured group for disabled users, if set to 'attribute'
|
||||
this will be done in the ldap user entry, if set to 'none' the disable request
|
||||
is not processed.
|
||||
is not processed. Default is 'attribute'.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_DISABLED_USERS_GROUP_DN:
|
||||
name: OCIS_LDAP_DISABLED_USERS_GROUP_DN;AUTH_BASIC_DISABLED_USERS_GROUP_DN
|
||||
name: OCIS_LDAP_DISABLED_USERS_GROUP_DN;GRAPH_DISABLED_USERS_GROUP_DN
|
||||
defaultValue: cn=DisabledUsersGroup,ou=groups,o=libregraph-idm
|
||||
type: string
|
||||
description: The distinguished name of the group to which added users will be classified
|
||||
@@ -8453,7 +8457,7 @@ OCIS_LDAP_GROUP_AFFILIATION_ATTRIBUTE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_GROUP_BASE_DN:
|
||||
name: OCIS_LDAP_GROUP_BASE_DN;AUTH_BASIC_LDAP_GROUP_BASE_DN
|
||||
name: OCIS_LDAP_GROUP_BASE_DN;GRAPH_LDAP_GROUP_BASE_DN
|
||||
defaultValue: ou=groups,o=libregraph-idm
|
||||
type: string
|
||||
description: Search base DN for looking up LDAP groups.
|
||||
@@ -8462,7 +8466,7 @@ OCIS_LDAP_GROUP_BASE_DN:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_GROUP_FILTER:
|
||||
name: OCIS_LDAP_GROUP_FILTER;AUTH_BASIC_LDAP_GROUP_FILTER
|
||||
name: OCIS_LDAP_GROUP_FILTER;GRAPH_LDAP_GROUP_FILTER
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: LDAP filter to add to the default filters for group searches.
|
||||
@@ -8471,7 +8475,7 @@ OCIS_LDAP_GROUP_FILTER:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_GROUP_OBJECTCLASS:
|
||||
name: OCIS_LDAP_GROUP_OBJECTCLASS;AUTH_BASIC_LDAP_GROUP_OBJECTCLASS
|
||||
name: OCIS_LDAP_GROUP_OBJECTCLASS;GRAPH_LDAP_GROUP_OBJECTCLASS
|
||||
defaultValue: groupOfNames
|
||||
type: string
|
||||
description: The object class to use for groups in the default group search filter
|
||||
@@ -8481,7 +8485,7 @@ OCIS_LDAP_GROUP_OBJECTCLASS:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_GROUP_SCHEMA_DISPLAYNAME:
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_DISPLAYNAME;AUTH_BASIC_LDAP_GROUP_SCHEMA_DISPLAYNAME
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_DISPLAYNAME;USERS_LDAP_GROUP_SCHEMA_DISPLAYNAME
|
||||
defaultValue: cn
|
||||
type: string
|
||||
description: LDAP Attribute to use for the displayname of groups (often the same
|
||||
@@ -8491,7 +8495,7 @@ OCIS_LDAP_GROUP_SCHEMA_DISPLAYNAME:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_GROUP_SCHEMA_GROUPNAME:
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_GROUPNAME;AUTH_BASIC_LDAP_GROUP_SCHEMA_GROUPNAME
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_GROUPNAME;GRAPH_LDAP_GROUP_NAME_ATTRIBUTE
|
||||
defaultValue: cn
|
||||
type: string
|
||||
description: LDAP Attribute to use for the name of groups.
|
||||
@@ -8500,28 +8504,28 @@ OCIS_LDAP_GROUP_SCHEMA_GROUPNAME:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_GROUP_SCHEMA_ID:
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_ID;AUTH_BASIC_LDAP_GROUP_SCHEMA_ID
|
||||
defaultValue: ownclouduuid
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_ID;GRAPH_LDAP_GROUP_ID_ATTRIBUTE
|
||||
defaultValue: owncloudUUID
|
||||
type: string
|
||||
description: LDAP Attribute to use as the unique id for groups. This should be a
|
||||
stable globally unique id (e.g. a UUID).
|
||||
stable globally unique ID like a UUID.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_GROUP_SCHEMA_ID_IS_OCTETSTRING:
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_ID_IS_OCTETSTRING;AUTH_BASIC_LDAP_GROUP_SCHEMA_ID_IS_OCTETSTRING
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_ID_IS_OCTETSTRING;GRAPH_LDAP_GROUP_SCHEMA_ID_IS_OCTETSTRING
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Set this to true if the defined 'id' attribute for groups is of the
|
||||
'OCTETSTRING' syntax. This is e.g. required when using the 'objectGUID' attribute
|
||||
of Active Directory for the group IDs.
|
||||
description: Set this to true if the defined 'ID' attribute for groups is of the
|
||||
'OCTETSTRING' syntax. This is required when using the 'objectGUID' attribute of
|
||||
Active Directory for the group ID's.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_GROUP_SCHEMA_MAIL:
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_MAIL;AUTH_BASIC_LDAP_GROUP_SCHEMA_MAIL
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_MAIL;USERS_LDAP_GROUP_SCHEMA_MAIL
|
||||
defaultValue: mail
|
||||
type: string
|
||||
description: LDAP Attribute to use for the email address of groups (can be empty).
|
||||
@@ -8530,7 +8534,7 @@ OCIS_LDAP_GROUP_SCHEMA_MAIL:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_GROUP_SCHEMA_MEMBER:
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_MEMBER;AUTH_BASIC_LDAP_GROUP_SCHEMA_MEMBER
|
||||
name: OCIS_LDAP_GROUP_SCHEMA_MEMBER;GRAPH_LDAP_GROUP_MEMBER_ATTRIBUTE
|
||||
defaultValue: member
|
||||
type: string
|
||||
description: LDAP Attribute that is used for group members.
|
||||
@@ -8539,17 +8543,17 @@ OCIS_LDAP_GROUP_SCHEMA_MEMBER:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_GROUP_SCOPE:
|
||||
name: OCIS_LDAP_GROUP_SCOPE;AUTH_BASIC_LDAP_GROUP_SCOPE
|
||||
name: OCIS_LDAP_GROUP_SCOPE;GRAPH_LDAP_GROUP_SEARCH_SCOPE
|
||||
defaultValue: sub
|
||||
type: string
|
||||
description: LDAP search scope to use when looking up groups. Supported values are
|
||||
description: LDAP search scope to use when looking up groups. Supported scopes are
|
||||
'base', 'one' and 'sub'.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_INSECURE:
|
||||
name: OCIS_LDAP_INSECURE;AUTH_BASIC_LDAP_INSECURE
|
||||
name: OCIS_LDAP_INSECURE;GRAPH_LDAP_INSECURE
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Disable TLS certificate validation for the LDAP connections. Do not
|
||||
@@ -8629,7 +8633,7 @@ OCIS_LDAP_SERVER_WRITE_ENABLED:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_URI:
|
||||
name: OCIS_LDAP_URI;AUTH_BASIC_LDAP_URI
|
||||
name: OCIS_LDAP_URI;GRAPH_LDAP_URI
|
||||
defaultValue: ldaps://localhost:9235
|
||||
type: string
|
||||
description: URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://'
|
||||
@@ -8639,7 +8643,7 @@ OCIS_LDAP_URI:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_USER_BASE_DN:
|
||||
name: OCIS_LDAP_USER_BASE_DN;AUTH_BASIC_LDAP_USER_BASE_DN
|
||||
name: OCIS_LDAP_USER_BASE_DN;GRAPH_LDAP_USER_BASE_DN
|
||||
defaultValue: ou=users,o=libregraph-idm
|
||||
type: string
|
||||
description: Search base DN for looking up LDAP users.
|
||||
@@ -8648,16 +8652,16 @@ OCIS_LDAP_USER_BASE_DN:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_USER_ENABLED_ATTRIBUTE:
|
||||
name: OCIS_LDAP_USER_ENABLED_ATTRIBUTE;AUTH_BASIC_LDAP_USER_ENABLED_ATTRIBUTE
|
||||
name: OCIS_LDAP_USER_ENABLED_ATTRIBUTE;GRAPH_USER_ENABLED_ATTRIBUTE
|
||||
defaultValue: ownCloudUserEnabled
|
||||
type: string
|
||||
description: LDAP attribute to use as a flag telling if the user is enabled or disabled.
|
||||
description: LDAP Attribute to use as a flag telling if the user is enabled or disabled.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_USER_FILTER:
|
||||
name: OCIS_LDAP_USER_FILTER;AUTH_BASIC_LDAP_USER_FILTER
|
||||
name: OCIS_LDAP_USER_FILTER;GRAPH_LDAP_USER_FILTER
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: LDAP filter to add to the default filters for user search like '(objectclass=ownCloud)'.
|
||||
@@ -8686,7 +8690,7 @@ OCIS_LDAP_USER_MEMBER_ATTRIBUTE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_USER_OBJECTCLASS:
|
||||
name: OCIS_LDAP_USER_OBJECTCLASS;AUTH_BASIC_LDAP_USER_OBJECTCLASS
|
||||
name: OCIS_LDAP_USER_OBJECTCLASS;GRAPH_LDAP_USER_OBJECTCLASS
|
||||
defaultValue: inetOrgPerson
|
||||
type: string
|
||||
description: The object class to use for users in the default user search filter
|
||||
@@ -8696,14 +8700,14 @@ OCIS_LDAP_USER_OBJECTCLASS:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_USER_SCHEMA_DISPLAYNAME:
|
||||
name: OCIS_LDAP_USER_SCHEMA_DISPLAYNAME;AUTH_BASIC_LDAP_USER_SCHEMA_DISPLAYNAME
|
||||
defaultValue: displayname
|
||||
name: OCIS_LDAP_USER_SCHEMA_DISPLAYNAME;GRAPH_LDAP_USER_DISPLAYNAME_ATTRIBUTE
|
||||
defaultValue: displayName
|
||||
type: string
|
||||
description: LDAP Attribute to use for the displayname of users.
|
||||
description: LDAP Attribute to use for the display name of users.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: 'LDAP_USER_SCHEMA_DISPLAY_NAME changing name for consistency | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '
|
||||
deprecationInfo: 'LDAP_USER_SCHEMA_DISPLAY_NAME changing name for consistency | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '
|
||||
OCIS_LDAP_USER_SCHEMA_EXTERNAL_ID:
|
||||
name: OCIS_LDAP_USER_SCHEMA_EXTERNAL_ID;GRAPH_LDAP_EXTERNAL_ID_ATTRIBUTE
|
||||
defaultValue: owncloudExternalID
|
||||
@@ -8716,8 +8720,8 @@ OCIS_LDAP_USER_SCHEMA_EXTERNAL_ID:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_USER_SCHEMA_ID:
|
||||
name: OCIS_LDAP_USER_SCHEMA_ID;AUTH_BASIC_LDAP_USER_SCHEMA_ID
|
||||
defaultValue: ownclouduuid
|
||||
name: OCIS_LDAP_USER_SCHEMA_ID;GRAPH_LDAP_USER_UID_ATTRIBUTE
|
||||
defaultValue: owncloudUUID
|
||||
type: string
|
||||
description: LDAP Attribute to use as the unique ID for users. This should be a
|
||||
stable globally unique ID like a UUID.
|
||||
@@ -8726,18 +8730,18 @@ OCIS_LDAP_USER_SCHEMA_ID:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_USER_SCHEMA_ID_IS_OCTETSTRING:
|
||||
name: OCIS_LDAP_USER_SCHEMA_ID_IS_OCTETSTRING;AUTH_BASIC_LDAP_USER_SCHEMA_ID_IS_OCTETSTRING
|
||||
name: OCIS_LDAP_USER_SCHEMA_ID_IS_OCTETSTRING;GRAPH_LDAP_USER_SCHEMA_ID_IS_OCTETSTRING
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Set this to true if the defined 'ID' attribute for users is of the
|
||||
'OCTETSTRING' syntax. This is e.g. required when using the 'objectGUID' attribute
|
||||
of Active Directory for the user IDs.
|
||||
'OCTETSTRING' syntax. This is required when using the 'objectGUID' attribute of
|
||||
Active Directory for the user ID's.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_USER_SCHEMA_MAIL:
|
||||
name: OCIS_LDAP_USER_SCHEMA_MAIL;AUTH_BASIC_LDAP_USER_SCHEMA_MAIL
|
||||
name: OCIS_LDAP_USER_SCHEMA_MAIL;GRAPH_LDAP_USER_EMAIL_ATTRIBUTE
|
||||
defaultValue: mail
|
||||
type: string
|
||||
description: LDAP Attribute to use for the email address of users.
|
||||
@@ -8756,7 +8760,7 @@ OCIS_LDAP_USER_SCHEMA_USER_TYPE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_USER_SCHEMA_USERNAME:
|
||||
name: OCIS_LDAP_USER_SCHEMA_USERNAME;AUTH_BASIC_LDAP_USER_SCHEMA_USERNAME
|
||||
name: OCIS_LDAP_USER_SCHEMA_USERNAME;GRAPH_LDAP_USER_NAME_ATTRIBUTE
|
||||
defaultValue: uid
|
||||
type: string
|
||||
description: LDAP Attribute to use for username of users.
|
||||
@@ -8765,70 +8769,70 @@ OCIS_LDAP_USER_SCHEMA_USERNAME:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LDAP_USER_SCOPE:
|
||||
name: OCIS_LDAP_USER_SCOPE;AUTH_BASIC_LDAP_USER_SCOPE
|
||||
name: OCIS_LDAP_USER_SCOPE;GRAPH_LDAP_USER_SCOPE
|
||||
defaultValue: sub
|
||||
type: string
|
||||
description: LDAP search scope to use when looking up users. Supported values are
|
||||
description: LDAP search scope to use when looking up users. Supported scopes are
|
||||
'base', 'one' and 'sub'.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LOG_COLOR:
|
||||
name: OCIS_LOG_COLOR;SHARING_LOG_COLOR
|
||||
name: OCIS_LOG_COLOR;AUTH_APP_LOG_COLOR
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Activates colorized log output.
|
||||
introductionVersion: pre5.0
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LOG_FILE:
|
||||
name: OCIS_LOG_FILE;SHARING_LOG_FILE
|
||||
name: OCIS_LOG_FILE;AUTH_APP_LOG_FILE
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The path to the log file. Activates logging to this file if set.
|
||||
introductionVersion: pre5.0
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LOG_LEVEL:
|
||||
name: OCIS_LOG_LEVEL;SHARING_LOG_LEVEL
|
||||
name: OCIS_LOG_LEVEL;AUTH_APP_LOG_LEVEL
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: 'The log level. Valid values are: ''panic'', ''fatal'', ''error'',
|
||||
''warn'', ''info'', ''debug'', ''trace''.'
|
||||
introductionVersion: pre5.0
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_LOG_PRETTY:
|
||||
name: OCIS_LOG_PRETTY;SHARING_LOG_PRETTY
|
||||
name: OCIS_LOG_PRETTY;AUTH_APP_LOG_PRETTY
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Activates pretty log output.
|
||||
introductionVersion: pre5.0
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_MACHINE_AUTH_API_KEY:
|
||||
name: OCIS_MACHINE_AUTH_API_KEY;IDP_MACHINE_AUTH_API_KEY
|
||||
name: OCIS_MACHINE_AUTH_API_KEY;AUTH_APP_MACHINE_AUTH_API_KEY
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: Machine auth API key used to validate internal requests necessary for
|
||||
the access to resources from other services.
|
||||
introductionVersion: pre5.0
|
||||
description: The machine auth API key used to validate internal requests necessary
|
||||
to access resources from other services.
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_MAX_CONCURRENCY:
|
||||
name: OCIS_MAX_CONCURRENCY;SHARING_USER_JSONCS3_MAX_CONCURRENCY
|
||||
defaultValue: "1"
|
||||
name: OCIS_MAX_CONCURRENCY;STORAGE_USERS_S3NG_MAX_CONCURRENCY
|
||||
defaultValue: "5"
|
||||
type: int
|
||||
description: Maximum number of concurrent go-routines. Higher values can potentially
|
||||
get work done faster but will also cause more load on the system. Values of 0
|
||||
or below will be ignored and the default value will be used.
|
||||
introductionVersion: 7.0.0
|
||||
or below will be ignored and the default value of 100 will be used.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
@@ -8932,17 +8936,16 @@ OCIS_OIDC_CLIENT_ID:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_OIDC_ISSUER:
|
||||
name: OCIS_URL;OCIS_OIDC_ISSUER;AUTH_BASIC_IDP_URL
|
||||
name: OCIS_URL;OCIS_OIDC_ISSUER;AUTH_BEARER_OIDC_ISSUER
|
||||
defaultValue: https://localhost:9200
|
||||
type: string
|
||||
description: The identity provider value to set in the userids of the CS3 user objects
|
||||
for users returned by this user provider.
|
||||
description: URL of the OIDC issuer. It defaults to URL of the builtin IDP.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST:
|
||||
name: OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST;SHARING_PASSWORD_POLICY_BANNED_PASSWORDS_LIST
|
||||
name: OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST;FRONTEND_PASSWORD_POLICY_BANNED_PASSWORDS_LIST
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: Path to the 'banned passwords list' file. This only impacts public
|
||||
@@ -8952,7 +8955,7 @@ OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PASSWORD_POLICY_DISABLED:
|
||||
name: OCIS_PASSWORD_POLICY_DISABLED;SHARING_PASSWORD_POLICY_DISABLED
|
||||
name: OCIS_PASSWORD_POLICY_DISABLED;FRONTEND_PASSWORD_POLICY_DISABLED
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Disable the password policy. Defaults to false if not set.
|
||||
@@ -8961,7 +8964,7 @@ OCIS_PASSWORD_POLICY_DISABLED:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PASSWORD_POLICY_MIN_CHARACTERS:
|
||||
name: OCIS_PASSWORD_POLICY_MIN_CHARACTERS;SHARING_PASSWORD_POLICY_MIN_CHARACTERS
|
||||
name: OCIS_PASSWORD_POLICY_MIN_CHARACTERS;FRONTEND_PASSWORD_POLICY_MIN_CHARACTERS
|
||||
defaultValue: "8"
|
||||
type: int
|
||||
description: Define the minimum password length. Defaults to 8 if not set.
|
||||
@@ -8970,7 +8973,7 @@ OCIS_PASSWORD_POLICY_MIN_CHARACTERS:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PASSWORD_POLICY_MIN_DIGITS:
|
||||
name: OCIS_PASSWORD_POLICY_MIN_DIGITS;SHARING_PASSWORD_POLICY_MIN_DIGITS
|
||||
name: OCIS_PASSWORD_POLICY_MIN_DIGITS;FRONTEND_PASSWORD_POLICY_MIN_DIGITS
|
||||
defaultValue: "1"
|
||||
type: int
|
||||
description: Define the minimum number of digits. Defaults to 1 if not set.
|
||||
@@ -8979,7 +8982,7 @@ OCIS_PASSWORD_POLICY_MIN_DIGITS:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS:
|
||||
name: OCIS_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS;SHARING_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS
|
||||
name: OCIS_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS;FRONTEND_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS
|
||||
defaultValue: "1"
|
||||
type: int
|
||||
description: Define the minimum number of uppercase letters. Defaults to 1 if not
|
||||
@@ -8989,7 +8992,7 @@ OCIS_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS:
|
||||
name: OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS;SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS
|
||||
name: OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS;FRONTEND_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS
|
||||
defaultValue: "1"
|
||||
type: int
|
||||
description: Define the minimum number of characters from the special characters
|
||||
@@ -8999,7 +9002,7 @@ OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS:
|
||||
name: OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS;SHARING_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS
|
||||
name: OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS;FRONTEND_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS
|
||||
defaultValue: "1"
|
||||
type: int
|
||||
description: Define the minimum number of lowercase letters. Defaults to 1 if not
|
||||
@@ -9009,54 +9012,54 @@ OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PERSISTENT_STORE:
|
||||
name: OCIS_PERSISTENT_STORE;COLLABORATION_STORE
|
||||
name: OCIS_PERSISTENT_STORE;NOTIFICATIONS_STORE
|
||||
defaultValue: nats-js-kv
|
||||
type: string
|
||||
description: 'The type of the store. Supported values are: ''memory'', ''nats-js-kv'',
|
||||
''redis-sentinel'', ''noop''. See the text description for details.'
|
||||
introductionVersion: 7.0.0
|
||||
introductionVersion: 7.1.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PERSISTENT_STORE_AUTH_PASSWORD:
|
||||
name: OCIS_PERSISTENT_STORE_AUTH_PASSWORD;COLLABORATION_STORE_AUTH_PASSWORD
|
||||
name: OCIS_PERSISTENT_STORE_AUTH_PASSWORD;NOTIFICATIONS_STORE_AUTH_PASSWORD
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The password to authenticate with the store. Only applies when store
|
||||
type 'nats-js-kv' is configured.
|
||||
introductionVersion: 7.0.0
|
||||
introductionVersion: 7.1.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PERSISTENT_STORE_AUTH_USERNAME:
|
||||
name: OCIS_PERSISTENT_STORE_AUTH_USERNAME;COLLABORATION_STORE_AUTH_USERNAME
|
||||
name: OCIS_PERSISTENT_STORE_AUTH_USERNAME;NOTIFICATIONS_STORE_AUTH_USERNAME
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The username to authenticate with the store. Only applies when store
|
||||
type 'nats-js-kv' is configured.
|
||||
introductionVersion: 7.0.0
|
||||
introductionVersion: 7.1.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PERSISTENT_STORE_NODES:
|
||||
name: OCIS_PERSISTENT_STORE_NODES;COLLABORATION_STORE_NODES
|
||||
name: OCIS_PERSISTENT_STORE_NODES;NOTIFICATIONS_STORE_NODES
|
||||
defaultValue: '[127.0.0.1:9233]'
|
||||
type: '[]string'
|
||||
description: A list of nodes to access the configured store. This has no effect
|
||||
when 'memory' store is configured. Note that the behaviour how nodes are used
|
||||
is dependent on the library of the configured store. See the Environment Variable
|
||||
Types description for more details.
|
||||
introductionVersion: 7.0.0
|
||||
introductionVersion: 7.1.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_PERSISTENT_STORE_TTL:
|
||||
name: OCIS_PERSISTENT_STORE_TTL;COLLABORATION_STORE_TTL
|
||||
defaultValue: 30m0s
|
||||
name: OCIS_PERSISTENT_STORE_TTL;NOTIFICATIONS_STORE_TTL
|
||||
defaultValue: 336h0m0s
|
||||
type: Duration
|
||||
description: Time to live for events in the store. Defaults to '30m' (30 minutes).
|
||||
See the Environment Variable Types description for more details.
|
||||
introductionVersion: 7.0.0
|
||||
description: Time to live for notifications in the store. Defaults to '336h' (2
|
||||
weeks). See the Environment Variable Types description for more details.
|
||||
introductionVersion: 7.1.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
@@ -9101,7 +9104,7 @@ OCIS_REVA_GATEWAY_TLS_MODE:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_SERVICE_ACCOUNT_ID:
|
||||
name: OCIS_SERVICE_ACCOUNT_ID;GRAPH_SERVICE_ACCOUNT_ID
|
||||
name: OCIS_SERVICE_ACCOUNT_ID;OCM_SERVICE_ACCOUNT_ID
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The ID of the service account the service should use. See the 'auth-service'
|
||||
@@ -9111,7 +9114,7 @@ OCIS_SERVICE_ACCOUNT_ID:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_SERVICE_ACCOUNT_SECRET:
|
||||
name: OCIS_SERVICE_ACCOUNT_SECRET;GRAPH_SERVICE_ACCOUNT_SECRET
|
||||
name: OCIS_SERVICE_ACCOUNT_SECRET;OCM_SERVICE_ACCOUNT_SECRET
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The service account secret.
|
||||
@@ -9120,7 +9123,7 @@ OCIS_SERVICE_ACCOUNT_SECRET:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD:
|
||||
name: OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD;SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD
|
||||
name: OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD
|
||||
defaultValue: "true"
|
||||
type: bool
|
||||
description: Set this to true if you want to enforce passwords on all public shares.
|
||||
@@ -9129,11 +9132,11 @@ OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD:
|
||||
name: OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD;SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD
|
||||
name: OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Set this to true if you want to enforce passwords on Uploader, Editor
|
||||
or Contributor shares.
|
||||
description: Set this to true if you want to enforce passwords for writable shares.
|
||||
Only effective if the setting for 'passwords on all public shares' is set to false.
|
||||
introductionVersion: "5.0"
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
@@ -9150,7 +9153,7 @@ OCIS_SPACES_MAX_QUOTA:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_SYSTEM_USER_API_KEY:
|
||||
name: OCIS_SYSTEM_USER_API_KEY;SHARING_PUBLIC_CS3_SYSTEM_USER_API_KEY
|
||||
name: OCIS_SYSTEM_USER_API_KEY
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: API key for the STORAGE-SYSTEM system user.
|
||||
@@ -9159,10 +9162,10 @@ OCIS_SYSTEM_USER_API_KEY:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_SYSTEM_USER_ID:
|
||||
name: OCIS_SYSTEM_USER_ID;SHARING_PUBLIC_CS3_SYSTEM_USER_ID
|
||||
name: OCIS_SYSTEM_USER_ID
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: ID of the oCIS STORAGE-SYSTEM system user. Admins need to set the ID
|
||||
description: ID of the oCIS storage-system system user. Admins need to set the ID
|
||||
for the STORAGE-SYSTEM system user in this config option which is then used to
|
||||
reference the user. Any reasonable long string is possible, preferably this would
|
||||
be an UUIDv4 format.
|
||||
@@ -9180,40 +9183,40 @@ OCIS_SYSTEM_USER_IDP:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_TRACING_COLLECTOR:
|
||||
name: OCIS_TRACING_COLLECTOR;SHARING_TRACING_COLLECTOR
|
||||
name: OCIS_TRACING_COLLECTOR;AUTH_APP_TRACING_COLLECTOR
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The HTTP endpoint for sending spans directly to a collector, i.e. http://jaeger-collector:14268/api/traces.
|
||||
Only used if the tracing endpoint is unset.
|
||||
introductionVersion: pre5.0
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_TRACING_ENABLED:
|
||||
name: OCIS_TRACING_ENABLED;SHARING_TRACING_ENABLED
|
||||
name: OCIS_TRACING_ENABLED;AUTH_APP_TRACING_ENABLED
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Activates tracing.
|
||||
introductionVersion: pre5.0
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_TRACING_ENDPOINT:
|
||||
name: OCIS_TRACING_ENDPOINT;SHARING_TRACING_ENDPOINT
|
||||
name: OCIS_TRACING_ENDPOINT;AUTH_APP_TRACING_ENDPOINT
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The endpoint of the tracing agent.
|
||||
introductionVersion: pre5.0
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_TRACING_TYPE:
|
||||
name: OCIS_TRACING_TYPE;SHARING_TRACING_TYPE
|
||||
name: OCIS_TRACING_TYPE;AUTH_APP_TRACING_TYPE
|
||||
defaultValue: ""
|
||||
type: string
|
||||
description: The type of tracing. Defaults to '', which is the same as 'jaeger'.
|
||||
Allowed tracing types are 'jaeger', 'otlp' and '' as of now.
|
||||
introductionVersion: pre5.0
|
||||
introductionVersion: 7.0.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
@@ -9238,11 +9241,10 @@ OCIS_TRANSLATION_PATH:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_URL:
|
||||
name: OCIS_URL;OCIS_OIDC_ISSUER;AUTH_BASIC_IDP_URL
|
||||
name: OCIS_URL;OCIS_OIDC_ISSUER;AUTH_BEARER_OIDC_ISSUER
|
||||
defaultValue: https://localhost:9200
|
||||
type: string
|
||||
description: The identity provider value to set in the userids of the CS3 user objects
|
||||
for users returned by this user provider.
|
||||
description: URL of the OIDC issuer. It defaults to URL of the builtin IDP.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
@@ -9257,12 +9259,11 @@ OCIS_USER_SEARCH_DISPLAYED_ATTRIBUTES:
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
OCIS_WOPI_DISABLE_CHAT:
|
||||
name: COLLABORATION_WOPI_DISABLE_CHAT;OCIS_WOPI_DISABLE_CHAT
|
||||
name: APP_PROVIDER_WOPI_DISABLE_CHAT;OCIS_WOPI_DISABLE_CHAT
|
||||
defaultValue: "false"
|
||||
type: bool
|
||||
description: Disable chat in the office web frontend. This feature applies to OnlyOffice
|
||||
and Microsoft.
|
||||
introductionVersion: 7.0.0
|
||||
description: Disable the chat functionality of the office app.
|
||||
introductionVersion: pre5.0
|
||||
deprecationVersion: ""
|
||||
removalVersion: ""
|
||||
deprecationInfo: ""
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# this script can run from everywhere in the ocis repo because it uses git grep
|
||||
|
||||
# The following grep will filter out every line containing an `env` annotation AND
|
||||
# containing a non semver `introductionVersion` annotation that is used as placeholder.
|
||||
# note that invalid `introductionVersion` annotations are already covered via:
|
||||
# /.make/check-env-var-annotations.sh as part of the CI
|
||||
|
||||
RED=$(echo -e "\033[0;31m")
|
||||
GREEN=$(echo -e "\033[0;32m")
|
||||
NORM=$(echo -e "\033[0m")
|
||||
|
||||
|
||||
# build the correct regex
|
||||
IV_REGEX='(?:introductionVersion:\")(?!pre5\.0)(?:[^\d].*?\")'
|
||||
IV_NAME=introductionVersion
|
||||
|
||||
RV_REGEX='(?:removalVersion:\")(?!pre5\.0)(?:[^\d].*?\")'
|
||||
RV_NAME=removalVersion
|
||||
|
||||
EXCLUDE_PATHS='_test.go|vendor/'
|
||||
|
||||
# create a here doc function to be printed when the option is selected
|
||||
# note that tabs are used intentionally. they are removed by cat but are required to make the code readable.
|
||||
print_version_examples() {
|
||||
cat <<-EOL
|
||||
${GREEN}Valid $1 examples:${NORM}
|
||||
|
||||
$1:"releaseX" # acceptable alphabetical version
|
||||
$1:"Addams" # another alphabetical example such as a release name
|
||||
$1:"Addams.8" # another alphabetical example such as a release name plus a version
|
||||
$1:"%%NEXT%%" # a dummy placeholder as release name
|
||||
|
||||
See the dev docs for more details: https://owncloud.dev/services/general-info/envvars/envvar-naming-scopes/
|
||||
EOL
|
||||
}
|
||||
|
||||
# ask what the script should search for
|
||||
echo "Select one of the following keys to search for:"
|
||||
echo
|
||||
echo " 1) introductionVersion"
|
||||
echo " 2) removalVersion"
|
||||
echo " 3) Print valid matching search pattern examples"
|
||||
echo
|
||||
read -s -n 1 n
|
||||
case $n in
|
||||
1) USEREGEX="${IV_REGEX}"
|
||||
NAME="${IV_NAME}"
|
||||
;;
|
||||
2) USEREGEX="${RV_REGEX}"
|
||||
NAME="${RV_NAME}"
|
||||
;;
|
||||
3) echo
|
||||
print_version_examples "${IV_NAME}"
|
||||
echo
|
||||
print_version_examples "${RV_NAME}"
|
||||
echo
|
||||
exit
|
||||
;;
|
||||
*) echo "Invalid option"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
# query the code
|
||||
QS=$(git grep -n "env:" -- '*.go' | grep -v -E "${EXCLUDE_PATHS}" | grep --color=always -P "${USEREGEX}")
|
||||
|
||||
# count the results found
|
||||
RESULTS_COUNT=$(echo "${QS}"|wc -l)
|
||||
|
||||
# add a new line after each hit, eol identified via "´ which only appears at the end of each envvar string definition
|
||||
QUERY_RESULT=$(echo "${QS}" | sed "s#\"\`#\"\`\n#g")
|
||||
|
||||
echo "Checking ${NAME} annotations"
|
||||
|
||||
if [ "${QUERY_RESULT}" != "" ] && [ "${RESULTS_COUNT}" -gt 0 ]; then
|
||||
echo
|
||||
echo "==============================================================================================="
|
||||
echo ${GREEN}"The following items contain placeholder ${NAME} annotation(s):"${NORM}
|
||||
echo "==============================================================================================="
|
||||
echo
|
||||
echo "$QUERY_RESULT"
|
||||
echo
|
||||
echo ${GREEN}"${RESULTS_COUNT} items found"${NORM}
|
||||
echo
|
||||
else
|
||||
echo ${GREEN}"No matching placeholders for ${NAME} annotations found."${NORM}
|
||||
echo
|
||||
fi
|
||||
@@ -549,7 +549,7 @@ From the `Run and Debug` panel of VSCode, select `Fed oCIS Server` and start the
|
||||
source tests/config/local/.env-federation && ocis/bin/ocis init
|
||||
|
||||
# run oCIS
|
||||
source tests/config/local/.env-federation && ocis/bin/ocis server
|
||||
ocis/bin/ocis server
|
||||
```
|
||||
|
||||
The second oCIS instance should be available at: <https://localhost:10200/>
|
||||
@@ -567,7 +567,7 @@ Run the acceptance test with the following command:
|
||||
```bash
|
||||
TEST_SERVER_URL="https://localhost:9200" \
|
||||
TEST_SERVER_FED_URL="https://localhost:10200" \
|
||||
BEHAT_SUITE=apiOcm \
|
||||
BEHAT_FEATURE="tests/acceptance/features/apiOcm/ocm.feature" \
|
||||
make test-acceptance-api
|
||||
```
|
||||
|
||||
|
||||
@@ -52,25 +52,24 @@ The envvar struct tag contains at maximum the following key/value pairs to docum
|
||||
|
||||
### Introduce new Envvars
|
||||
|
||||
* If a **new** envvar is introduced, the entire structure must be added, including the `introductionVersion` field. Note that 'introduced' means, that the new envvar was not present in any of the services.
|
||||
If a new envvar is introduced, the complete struct needs to be added, but only the `introductionVersion` requires data.
|
||||
|
||||
{{< hint info >}}
|
||||
* During development, set the `introductionVersion` to a short, **alphabetic code name** that represents the upcoming release such as `releaseX` or the project name for that release such as `Daledda`.
|
||||
* This identifier stays constant until the release receives its final production semantic-version number.
|
||||
* Although the pipeline checks the semver string when a PR is created, you can perform this check upfront manually by entering the following command from the ocis root:
|
||||
{{< hint info >}}
|
||||
* During development, set `introductionVersion` to a short, **alphabetic code name** that represents the upcoming release (e.g. `releaseX`).
|
||||
* This identifier stays constant until the release receives its final production semantic-version number.
|
||||
{{< /hint >}}
|
||||
|
||||
```bash
|
||||
.make/check-env-var-annotations.sh
|
||||
```
|
||||
{{< /hint >}}
|
||||
The docs helper scripts render these alphabetic identifiers verbatim. They appear in the next (master) branch of the admin docs as rendered here.
|
||||
|
||||
The doc helper scripts render these alphabetic identifiers verbatim. They appear in the next (master) branch of the admin documentation exactly as they are entered.
|
||||
Once the release is cut, before tagging, replace them with the actual semantic version (e.g. `releaseX` → `7.2.0`).
|
||||
|
||||
* See the [Set the Correct IntroductionVersion]({{< ref "./new-release-process/" >}}) documentation before starting a new release candidate.
|
||||
{{< hint info >}}
|
||||
A new production version **MUST NOT** contain any alphabetic identifyers but the semantic version only.
|
||||
{{< /hint >}}
|
||||
|
||||
### Adding Envvars to Existing Ones
|
||||
|
||||
If an envvar has been introduced with a particular release, the `introductionVersion` got a semver value accordingly. If an additional envvar is added to this existing one such as a global envvar, the introduction version **must not** be changed.
|
||||
If an envvar has been introduced with a particular version, the `introductionVersion` gets a value accordingly. If an additional envvar like a global one is added to this existing envvar later on, the introduction version will *not* be changed.
|
||||
|
||||
### Deprecate Existing Envvars
|
||||
|
||||
|
||||
@@ -23,26 +23,13 @@ Ask the developers if envvars of this type have been changed (added or removed).
|
||||
* From the ocis root run:\
|
||||
`sudo make docs-clean`\
|
||||
`make docs-generate`\
|
||||
Discard any changes in `env_vars.yaml`!
|
||||
Drop any changes in `env_vars.yaml`!
|
||||
* Check if there is a change in the `extended-envars.yaml` output.\
|
||||
If so, process [Extended Envvars - Fixing Changed Items]({{< ref "./special-envvars.md#fixing-changed-items" >}}).
|
||||
If so, process [Extended Envvars - Fixing Changed Item]({{< ref "./special-envvars.md#fixing-changed-items" >}}).
|
||||
* When done, re-run `make docs-generate` and check if the output matches the expectations in `./docs/services/_includes/adoc/extended_configvars.adoc`.
|
||||
|
||||
## Ordinary Envvars
|
||||
|
||||
### Set the Correct IntroductionVersion
|
||||
|
||||
* Once the release is cut, **before** creating the first release candidate, replace them with the actual semantic version (e.g. `releaseX` → `8.1.0`). To find these placeholders in `introductionVersion` keys, you can run a helper script by issuing the following command:
|
||||
```bash
|
||||
docs/ocis/helpers/identify_envvar_placeholder_names.sh
|
||||
```
|
||||
|
||||
{{< hint info >}}
|
||||
A new production version **MUST NOT** contain any alphabetic identifyers but the semantic version only, using **major, minor and a patch version, which is always 0!**.
|
||||
{{< /hint >}}
|
||||
|
||||
* Create a PR and merge it **before** taking the next step maintaining the `env_vars.yaml` file! Do not forget to rebase your local git repo.
|
||||
|
||||
### Maintain the 'env_vars.yaml' File
|
||||
|
||||
This is **mandatory for a new release** !
|
||||
@@ -51,13 +38,17 @@ This is **mandatory for a new release** !
|
||||
`sudo make docs-clean`\
|
||||
`make docs-generate`\
|
||||
Any changes in `env_vars.yaml` are now considered.
|
||||
* This file will most likely show changes and merging them is **essential** as base for **added/removed or deprecated envvars** (envvar deltas). Note that this file will get additions/updates only, but items never get deleted automatically !!\
|
||||
* This file will most likely show changes and merging them is **essential** as base for **added/removed or deprecated envvars**. Note that this file will get additions/updates only, but items never get deleted automatically !!\
|
||||
{{< hint info >}}
|
||||
Note that due to how the code is currently designed, **things may get shifted** around though no real changes have been introduced.
|
||||
{{< /hint >}}
|
||||
* With a new branch, remove all envvars from the `env_vars.yaml` file manually that have formerly been deprecated **and removed** from the code.
|
||||
* First, check if any **alphabetic code names** are present in the changes. See [Introduce new Envvars]({{< ref "./envvar-naming-scopes.md/#introduce-new-envvars" >}}).
|
||||
* If so, create a new branch and replace them in the **service containing the source** with the actual semantic version (e.g. `releaseX` → `7.2.0`) first. Note that ALL of major, minor and patch numbers must be present, including patch versions == `0`.
|
||||
* If all changes are applied, rerun `make docs-generate` and check if all changes are incorporated in the yaml file.
|
||||
* Create a PR and merge these changes, dont forget to do a local pull of master afterwards...
|
||||
* With a new branch, remove all envvars from the `env_vars.yaml` file manually that have formerly been deprecated and removed from the code.
|
||||
* Commit the changes and merge it.\
|
||||
Now, `env_vars.yaml` is up to date in the repo in master. Next steps depend on this updated file!
|
||||
Now `env_vars.yaml` is up to date on the repo in master, next steps are based on this state!
|
||||
|
||||
### Create Envvar Delta Files
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ require (
|
||||
github.com/mitchellh/mapstructure v1.5.0
|
||||
github.com/mna/pigeon v1.3.0
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
|
||||
github.com/nats-io/nats-server/v2 v2.12.6
|
||||
github.com/nats-io/nats.go v1.49.0
|
||||
github.com/nats-io/nats-server/v2 v2.12.4
|
||||
github.com/nats-io/nats.go v1.48.0
|
||||
github.com/olekukonko/tablewriter v1.1.0
|
||||
github.com/onsi/ginkgo v1.16.5
|
||||
github.com/onsi/ginkgo/v2 v2.28.1
|
||||
@@ -64,7 +64,7 @@ require (
|
||||
github.com/open-policy-agent/opa v1.12.3
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260324082555-823c2f1c2593
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260313004602-2207600dc2eb
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/xattr v0.4.12
|
||||
github.com/prometheus/client_golang v1.23.2
|
||||
@@ -94,16 +94,16 @@ require (
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0
|
||||
go.opentelemetry.io/otel/sdk v1.40.0
|
||||
go.opentelemetry.io/otel/trace v1.40.0
|
||||
golang.org/x/crypto v0.49.0
|
||||
golang.org/x/crypto v0.48.0
|
||||
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b
|
||||
golang.org/x/image v0.38.0
|
||||
golang.org/x/net v0.51.0
|
||||
golang.org/x/image v0.36.0
|
||||
golang.org/x/net v0.49.0
|
||||
golang.org/x/oauth2 v0.35.0
|
||||
golang.org/x/sync v0.20.0
|
||||
golang.org/x/term v0.41.0
|
||||
golang.org/x/text v0.35.0
|
||||
golang.org/x/sync v0.19.0
|
||||
golang.org/x/term v0.40.0
|
||||
golang.org/x/text v0.34.0
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409
|
||||
google.golang.org/grpc v1.79.3
|
||||
google.golang.org/grpc v1.79.1
|
||||
google.golang.org/protobuf v1.36.11
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gotest.tools/v3 v3.5.2
|
||||
@@ -125,7 +125,7 @@ require (
|
||||
github.com/ajg/form v1.5.1 // indirect
|
||||
github.com/alexedwards/argon2id v1.0.0 // indirect
|
||||
github.com/amoghe/go-crypt v0.0.0-20220222110647-20eada5f5964 // indirect
|
||||
github.com/antithesishq/antithesis-sdk-go v0.6.0-default-no-op // indirect
|
||||
github.com/antithesishq/antithesis-sdk-go v0.5.0-default-no-op // indirect
|
||||
github.com/armon/go-radix v1.0.0 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/aws/aws-sdk-go v1.55.8 // indirect
|
||||
@@ -155,7 +155,7 @@ require (
|
||||
github.com/ceph/go-ceph v0.38.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/cevaris/ordered_map v0.0.0-20190319150403-3adeae072e73 // indirect
|
||||
github.com/cloudflare/circl v1.6.3 // indirect
|
||||
github.com/cloudflare/circl v1.6.1 // indirect
|
||||
github.com/coreos/go-semver v0.3.1 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.6.0 // indirect
|
||||
github.com/cornelk/hashmap v1.0.8 // indirect
|
||||
@@ -183,8 +183,8 @@ require (
|
||||
github.com/go-acme/lego/v4 v4.25.2 // indirect
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.8.0 // indirect
|
||||
github.com/go-git/go-git/v5 v5.17.1 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.6.2 // indirect
|
||||
github.com/go-git/go-git/v5 v5.16.5 // indirect
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
|
||||
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
|
||||
@@ -237,7 +237,7 @@ require (
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/juliangruber/go-intersect v1.1.0 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.18.4 // indirect
|
||||
github.com/klauspost/compress v1.18.3 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.11 // indirect
|
||||
github.com/klauspost/crc32 v1.3.0 // indirect
|
||||
github.com/kovidgoyal/go-parallel v1.1.1 // indirect
|
||||
@@ -273,8 +273,8 @@ require (
|
||||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
|
||||
github.com/mschoch/smat v0.2.0 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/nats-io/jwt/v2 v2.8.1 // indirect
|
||||
github.com/nats-io/nkeys v0.4.15 // indirect
|
||||
github.com/nats-io/jwt/v2 v2.8.0 // indirect
|
||||
github.com/nats-io/nkeys v0.4.12 // indirect
|
||||
github.com/nats-io/nuid v1.0.1 // indirect
|
||||
github.com/nxadm/tail v1.4.8 // indirect
|
||||
github.com/oklog/run v1.2.0 // indirect
|
||||
@@ -298,7 +298,7 @@ require (
|
||||
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/rs/xid v1.6.0 // indirect
|
||||
github.com/russellhaering/goxmldsig v1.6.0 // indirect
|
||||
github.com/russellhaering/goxmldsig v1.5.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd // indirect
|
||||
github.com/segmentio/asm v1.2.1 // indirect
|
||||
@@ -340,10 +340,10 @@ require (
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/mod v0.33.0 // indirect
|
||||
golang.org/x/sys v0.42.0 // indirect
|
||||
golang.org/x/time v0.15.0 // indirect
|
||||
golang.org/x/tools v0.42.0 // indirect
|
||||
golang.org/x/mod v0.32.0 // indirect
|
||||
golang.org/x/sys v0.41.0 // indirect
|
||||
golang.org/x/time v0.14.0 // indirect
|
||||
golang.org/x/tools v0.41.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
|
||||
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
|
||||
|
||||
@@ -92,8 +92,8 @@ github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNg
|
||||
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.6.0-default-no-op h1:kpBdlEPbRvff0mDD1gk7o9BhI16b9p5yYAXRlidpqJE=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.6.0-default-no-op/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl3v2yvUZjmKncl7U91fup7E=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.5.0-default-no-op h1:Ucf+QxEKMbPogRO5guBNe5cgd9uZgfoJLOYs8WWhtjM=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.5.0-default-no-op/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl3v2yvUZjmKncl7U91fup7E=
|
||||
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
|
||||
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
|
||||
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
|
||||
@@ -182,8 +182,8 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8=
|
||||
github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
|
||||
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
|
||||
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/coreos/go-oidc/v3 v3.17.0 h1:hWBGaQfbi0iVviX4ibC7bk8OKT5qNr4klBaCHVNvehc=
|
||||
github.com/coreos/go-oidc/v3 v3.17.0/go.mod h1:wqPbKFrVnE90vty060SB40FCJ8fTHTxSwyXJqZH+sI8=
|
||||
@@ -292,12 +292,12 @@ github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4=
|
||||
github.com/go-chi/render v1.0.3/go.mod h1:/gr3hVkmYR0YlEy3LxCuVRFzEu9Ruok+gFqbIofjao0=
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
|
||||
github.com/go-git/go-billy/v5 v5.8.0 h1:I8hjc3LbBlXTtVuFNJuwYuMiHvQJDq1AT6u4DwDzZG0=
|
||||
github.com/go-git/go-billy/v5 v5.8.0/go.mod h1:RpvI/rw4Vr5QA+Z60c6d6LXH0rYJo0uD5SqfmrrheCY=
|
||||
github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM=
|
||||
github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
|
||||
github.com/go-git/go-git/v5 v5.17.1 h1:WnljyxIzSj9BRRUlnmAU35ohDsjRK0EKmL0evDqi5Jk=
|
||||
github.com/go-git/go-git/v5 v5.17.1/go.mod h1:pW/VmeqkanRFqR6AljLcs7EA7FbZaN5MQqO7oZADXpo=
|
||||
github.com/go-git/go-git/v5 v5.16.5 h1:mdkuqblwr57kVfXri5TTH+nMFLNUxIj9Z7F5ykFbw5s=
|
||||
github.com/go-git/go-git/v5 v5.16.5/go.mod h1:QOMLpNf1qxuSY4StA/ArOdfFR2TrKEjJiye2kel2m+M=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
@@ -575,8 +575,8 @@ github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4
|
||||
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c=
|
||||
github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
|
||||
github.com/klauspost/compress v1.18.3 h1:9PJRvfbmTabkOX8moIpXPbMMbYN60bWImDDU7L+/6zw=
|
||||
github.com/klauspost/compress v1.18.3/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
|
||||
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU=
|
||||
github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
@@ -701,14 +701,14 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nats-io/jwt/v2 v2.8.1 h1:V0xpGuD/N8Mi+fQNDynXohVvp7ZztevW5io8CUWlPmU=
|
||||
github.com/nats-io/jwt/v2 v2.8.1/go.mod h1:nWnOEEiVMiKHQpnAy4eXlizVEtSfzacZ1Q43LIRavZg=
|
||||
github.com/nats-io/nats-server/v2 v2.12.6 h1:Egbx9Vl7Ch8wTtpXPGqbehkZ+IncKqShUxvrt1+Enc8=
|
||||
github.com/nats-io/nats-server/v2 v2.12.6/go.mod h1:4HPlrvtmSO3yd7KcElDNMx9kv5EBJBnJJzQPptXlheo=
|
||||
github.com/nats-io/nats.go v1.49.0 h1:yh/WvY59gXqYpgl33ZI+XoVPKyut/IcEaqtsiuTJpoE=
|
||||
github.com/nats-io/nats.go v1.49.0/go.mod h1:fDCn3mN5cY8HooHwE2ukiLb4p4G4ImmzvXyJt+tGwdw=
|
||||
github.com/nats-io/nkeys v0.4.15 h1:JACV5jRVO9V856KOapQ7x+EY8Jo3qw1vJt/9Jpwzkk4=
|
||||
github.com/nats-io/nkeys v0.4.15/go.mod h1:CpMchTXC9fxA5zrMo4KpySxNjiDVvr8ANOSZdiNfUrs=
|
||||
github.com/nats-io/jwt/v2 v2.8.0 h1:K7uzyz50+yGZDO5o772eRE7atlcSEENpL7P+b74JV1g=
|
||||
github.com/nats-io/jwt/v2 v2.8.0/go.mod h1:me11pOkwObtcBNR8AiMrUbtVOUGkqYjMQZ6jnSdVUIA=
|
||||
github.com/nats-io/nats-server/v2 v2.12.4 h1:ZnT10v2LU2Xcoiy8ek9X6Se4YG8EuMfIfvAEuFVx1Ts=
|
||||
github.com/nats-io/nats-server/v2 v2.12.4/go.mod h1:5MCp/pqm5SEfsvVZ31ll1088ZTwEUdvRX1Hmh/mTTDg=
|
||||
github.com/nats-io/nats.go v1.48.0 h1:pSFyXApG+yWU/TgbKCjmm5K4wrHu86231/w84qRVR+U=
|
||||
github.com/nats-io/nats.go v1.48.0/go.mod h1:iRWIPokVIFbVijxuMQq4y9ttaBTMe0SFdlZfMDd+33g=
|
||||
github.com/nats-io/nkeys v0.4.12 h1:nssm7JKOG9/x4J8II47VWCL1Ds29avyiQDRn0ckMvDc=
|
||||
github.com/nats-io/nkeys v0.4.12/go.mod h1:MT59A1HYcjIcyQDJStTfaOY6vhy9XTUjOFo+SVsvpBg=
|
||||
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
@@ -742,8 +742,8 @@ github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HD
|
||||
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245 h1:JRidLTAKhnvyLMRtVtSF4lhBa0NSAOs6fof+d6JnKII=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260324082555-823c2f1c2593 h1:RNHAod2gNBEac0KQJfJ6+PCX1t7g9hFmONTGrXFvFII=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260324082555-823c2f1c2593/go.mod h1:+rCy6oGYb2/qs5gmQa8y/pHARw634vB73MZGDY2SBIQ=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260313004602-2207600dc2eb h1:BNEjpASeo8TwtvRKfbeB5xlL88XtoFUiWLjY4hKY44M=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260313004602-2207600dc2eb/go.mod h1:+rCy6oGYb2/qs5gmQa8y/pHARw634vB73MZGDY2SBIQ=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||
github.com/pablodz/inotifywaitgo v0.0.9 h1:njquRbBU7fuwIe5rEvtaniVBjwWzcpdUVptSgzFqZsw=
|
||||
@@ -827,8 +827,8 @@ github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
|
||||
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
|
||||
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
|
||||
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
|
||||
github.com/russellhaering/goxmldsig v1.6.0 h1:8fdWXEPh2k/NZNQBPFNoVfS3JmzS4ZprY/sAOpKQLks=
|
||||
github.com/russellhaering/goxmldsig v1.6.0/go.mod h1:TrnaquDcYxWXfJrOjeMBTX4mLBeYAqaHEyUeWPxZlBM=
|
||||
github.com/russellhaering/goxmldsig v1.5.0 h1:AU2UkkYIUOTyZRbe08XMThaOCelArgvNfYapcmSjBNw=
|
||||
github.com/russellhaering/goxmldsig v1.5.0/go.mod h1:x98CjQNFJcWfMxeOrMnMKg70lvDP6tE0nTaeUnjXDmk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd h1:CmH9+J6ZSsIjUK3dcGsnCnO41eRBOnY12zwkn5qVwgc=
|
||||
@@ -1022,8 +1022,8 @@ golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
|
||||
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
|
||||
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
|
||||
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
@@ -1039,8 +1039,8 @@ golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAf
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
|
||||
golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE=
|
||||
golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY=
|
||||
golang.org/x/image v0.36.0 h1:Iknbfm1afbgtwPTmHnS2gTM/6PPZfH+z2EFuOkSbqwc=
|
||||
golang.org/x/image v0.36.0/go.mod h1:YsWD2TyyGKiIX1kZlu9QfKIsQ4nAAK9bdgdrIsE7xy4=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
@@ -1065,8 +1065,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
|
||||
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
|
||||
golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c=
|
||||
golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -1112,8 +1112,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo=
|
||||
golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y=
|
||||
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
|
||||
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@@ -1140,8 +1140,8 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -1207,8 +1207,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
|
||||
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
|
||||
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
@@ -1219,8 +1219,8 @@ golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU=
|
||||
golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A=
|
||||
golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg=
|
||||
golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -1234,13 +1234,13 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
|
||||
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
|
||||
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
|
||||
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
|
||||
golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
|
||||
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
|
||||
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
@@ -1290,8 +1290,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k=
|
||||
golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0=
|
||||
golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc=
|
||||
golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg=
|
||||
golang.org/x/tools/godoc v0.1.0-deprecated h1:o+aZ1BOj6Hsx/GBdJO/s815sqftjSnrZZwyYTHODvtk=
|
||||
golang.org/x/tools/godoc v0.1.0-deprecated/go.mod h1:qM63CriJ961IHWmnWa9CjZnBndniPt4a3CK0PVB9bIg=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -1371,8 +1371,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE=
|
||||
google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
|
||||
google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY=
|
||||
google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
|
||||
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e h1:m7aQHHqd0q89mRwhwS9Bx2rjyl/hsFAeta+uGrHsQaU=
|
||||
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e/go.mod h1:gID3PKrg7pWKntu9Ss6zTLJ0ttC0X9IHgREOCZwbCVU=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
|
||||
@@ -27,7 +27,6 @@ import (
|
||||
"github.com/thejerf/suture/v4"
|
||||
|
||||
ociscfg "github.com/owncloud/ocis/v2/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/config/defaults"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
ogrpc "github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
@@ -371,13 +370,6 @@ func Start(ctx context.Context, o ...Option) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Log the effective data and config paths at startup so operators can
|
||||
// verify that data is written to the expected location.
|
||||
s.Log.Info().
|
||||
Str("data_path", defaults.BaseDataPath()).
|
||||
Str("config_path", defaults.BaseConfigPath()).
|
||||
Msg("effective data and config paths")
|
||||
|
||||
// cancel the context when a signal is received.
|
||||
var cancel context.CancelFunc = func() {}
|
||||
if ctx == nil {
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Wrapper around govulncheck that only fails on fixable, called vulnerabilities.
|
||||
#
|
||||
# - CALLED + fixable (non-stdlib) → FAIL (you should bump the dep)
|
||||
# - CALLED + stdlib fix only → WARN (needs Go toolchain upgrade)
|
||||
# - CALLED + no fix available → WARN (nothing to do yet)
|
||||
# - imported/required only → WARN (code doesn't call it)
|
||||
#
|
||||
# Usage: scripts/govulncheck-wrapper.sh [govulncheck-binary]
|
||||
# If no binary is provided, uses 'govulncheck' from PATH.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
GOVULNCHECK="${1:-govulncheck}"
|
||||
TMPFILE=$(mktemp)
|
||||
trap 'rm -f "$TMPFILE"' EXIT
|
||||
|
||||
echo "Running govulncheck..."
|
||||
"$GOVULNCHECK" -format json ./... > "$TMPFILE" 2>&1 || true
|
||||
|
||||
python3 - "$TMPFILE" <<'PYEOF'
|
||||
import json
|
||||
import sys
|
||||
|
||||
def parse_json_stream(path):
|
||||
with open(path) as f:
|
||||
content = f.read()
|
||||
decoder = json.JSONDecoder()
|
||||
idx = 0
|
||||
objects = []
|
||||
while idx < len(content):
|
||||
while idx < len(content) and content[idx] in ' \t\n\r':
|
||||
idx += 1
|
||||
if idx >= len(content):
|
||||
break
|
||||
obj, end_idx = decoder.raw_decode(content, idx)
|
||||
idx = end_idx
|
||||
objects.append(obj)
|
||||
return objects
|
||||
|
||||
objects = parse_json_stream(sys.argv[1])
|
||||
|
||||
# Collect OSV details
|
||||
osvs = {}
|
||||
for obj in objects:
|
||||
if 'osv' in obj:
|
||||
osv = obj['osv']
|
||||
osvs[osv['id']] = osv
|
||||
|
||||
# Collect findings
|
||||
findings = [obj['finding'] for obj in objects if 'finding' in obj]
|
||||
|
||||
# Group by vuln ID
|
||||
from collections import defaultdict
|
||||
by_vuln = defaultdict(list)
|
||||
for f in findings:
|
||||
by_vuln[f['osv']].append(f)
|
||||
|
||||
fail_vulns = []
|
||||
warn_vulns = []
|
||||
|
||||
for vid, entries in sorted(by_vuln.items()):
|
||||
# Check if any trace reaches symbol level (has 'function' in trace frames)
|
||||
is_called = any(
|
||||
any('function' in frame for frame in entry.get('trace', []))
|
||||
for entry in entries
|
||||
)
|
||||
fixed_version = entries[0].get('fixed_version', '')
|
||||
trace = entries[0].get('trace', [])
|
||||
module = trace[0].get('module', '') if trace else ''
|
||||
|
||||
# Determine category
|
||||
if not is_called:
|
||||
category = "IMPORTED"
|
||||
elif not fixed_version:
|
||||
category = "NO_FIX"
|
||||
elif module == "stdlib":
|
||||
category = "STDLIB"
|
||||
else:
|
||||
category = "FIXABLE"
|
||||
|
||||
osv = osvs.get(vid, {})
|
||||
summary = osv.get('summary', vid)
|
||||
|
||||
info = {
|
||||
'id': vid,
|
||||
'category': category,
|
||||
'module': module,
|
||||
'fixed_version': fixed_version,
|
||||
'summary': summary,
|
||||
}
|
||||
|
||||
if category == "FIXABLE":
|
||||
fail_vulns.append(info)
|
||||
else:
|
||||
warn_vulns.append(info)
|
||||
|
||||
# Print warnings
|
||||
if warn_vulns:
|
||||
print("\n⚠ Vulnerabilities acknowledged (not blocking):")
|
||||
for v in warn_vulns:
|
||||
reason = {
|
||||
'NO_FIX': 'no upstream fix available',
|
||||
'STDLIB': f'needs Go toolchain upgrade to {v["fixed_version"]}',
|
||||
'IMPORTED': 'code does not call vulnerable function',
|
||||
}.get(v['category'], v['category'])
|
||||
print(f" {v['id']}: {v['summary']}")
|
||||
print(f" module={v['module']} ({reason})")
|
||||
|
||||
# Print failures
|
||||
if fail_vulns:
|
||||
print(f"\n✗ {len(fail_vulns)} fixable vulnerability(ies) found:")
|
||||
for v in fail_vulns:
|
||||
print(f" {v['id']}: {v['summary']}")
|
||||
print(f" module={v['module']}, fix: bump to {v['fixed_version']}")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print(f"\n✓ No fixable vulnerabilities found ({len(warn_vulns)} acknowledged warnings)")
|
||||
sys.exit(0)
|
||||
PYEOF
|
||||
@@ -1,109 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
# Translators:
|
||||
# Martin <github@diemattels.at>, 2026
|
||||
# Miha Podobnik, 2026
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-03-24 00:06+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Miha Podobnik, 2026\n"
|
||||
"Language-Team: Slovenian (https://app.transifex.com/owncloud-org/teams/6149/sl/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: sl\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
|
||||
|
||||
#: pkg/service/response.go:44
|
||||
msgid "description"
|
||||
msgstr "opis"
|
||||
|
||||
#: pkg/service/response.go:43
|
||||
msgid "display name"
|
||||
msgstr "prikazno ime"
|
||||
|
||||
#: pkg/service/response.go:42
|
||||
msgid "expiration date"
|
||||
msgstr "datum poteka"
|
||||
|
||||
#: pkg/service/response.go:41
|
||||
msgid "password"
|
||||
msgstr "geslo"
|
||||
|
||||
#: pkg/service/response.go:40
|
||||
msgid "permission"
|
||||
msgstr "dovoljenje"
|
||||
|
||||
#: pkg/service/response.go:45
|
||||
msgid "shared-with-me"
|
||||
msgstr "deljeno-z-mano"
|
||||
|
||||
#: pkg/service/response.go:39
|
||||
msgid "some field"
|
||||
msgstr "neko polje"
|
||||
|
||||
#: pkg/service/response.go:26
|
||||
msgid "{resource} was downloaded via public link {token}"
|
||||
msgstr "{resource} je bil prenesen prek javne povezave {token}"
|
||||
|
||||
#: pkg/service/response.go:24
|
||||
msgid "{user} added {resource} to {folder}"
|
||||
msgstr "{user} je dodal {resource} v {folder}"
|
||||
|
||||
#: pkg/service/response.go:36
|
||||
msgid "{user} added {sharee} as member of {space}"
|
||||
msgstr "{user} je dodal {sharee} kot član {space}"
|
||||
|
||||
#: pkg/service/response.go:27
|
||||
msgid "{user} deleted {resource} from {folder}"
|
||||
msgstr "{user} je izbrisal {resource} iz {folder}"
|
||||
|
||||
#: pkg/service/response.go:28
|
||||
msgid "{user} moved {resource} to {folder}"
|
||||
msgstr "{user} je premaknil {resource} v {folder}"
|
||||
|
||||
#: pkg/service/response.go:35
|
||||
msgid "{user} removed link to {resource}"
|
||||
msgstr "{user} je odstranil povezavo do {resource}"
|
||||
|
||||
#: pkg/service/response.go:32
|
||||
msgid "{user} removed {sharee} from {resource}"
|
||||
msgstr "{user} je odstranil uporabnika {sharee} iz {resource}"
|
||||
|
||||
#: pkg/service/response.go:37
|
||||
msgid "{user} removed {sharee} from {space}"
|
||||
msgstr "{user} je odstranil uporabnika {sharee} iz {space}"
|
||||
|
||||
#: pkg/service/response.go:29
|
||||
msgid "{user} renamed {oldResource} to {resource}"
|
||||
msgstr "{user} je preimenoval/a {oldResource} v {resource}"
|
||||
|
||||
#: pkg/service/response.go:33
|
||||
msgid "{user} shared {resource} via link"
|
||||
msgstr "{user} je omogočil souporabo {resource} prek povezave"
|
||||
|
||||
#: pkg/service/response.go:30
|
||||
msgid "{user} shared {resource} with {sharee}"
|
||||
msgstr "Uporabnik {user} je omogočil souporabo {resource} z {sharee}"
|
||||
|
||||
#: pkg/service/response.go:34
|
||||
msgid "{user} updated {field} for a link {token} on {resource}"
|
||||
msgstr ""
|
||||
"Uporabnik {user} je posodobil polje {field} za povezavo {token} na viru "
|
||||
"{resource}"
|
||||
|
||||
#: pkg/service/response.go:31
|
||||
msgid "{user} updated {field} for the {resource}"
|
||||
msgstr "{user} je preimenoval/a {oldResource} v {resource}"
|
||||
|
||||
#: pkg/service/response.go:25
|
||||
msgid "{user} updated {resource} in {folder}"
|
||||
msgstr "Uporabnik {user} je posodobil {resource} v {folder}"
|
||||
@@ -556,13 +556,40 @@ func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemI
|
||||
ctx, span := s.tp.Tracer("graph").Start(ctx, "DeletePermission")
|
||||
defer span.End()
|
||||
|
||||
permType, sharedResourceID, err := s.resolveDeletePermission(ctx, itemID, permissionID)
|
||||
var permissionType permissionType
|
||||
|
||||
sharedResourceID, err := s.getLinkPermissionResourceID(ctx, permissionID)
|
||||
switch {
|
||||
// Check if the ID is referring to a public share
|
||||
case err == nil:
|
||||
permissionType = Public
|
||||
// If the item id is referring to a space root and this is not a public share
|
||||
// we have to deal with space permissions
|
||||
case IsSpaceRoot(itemID):
|
||||
permissionType = Space
|
||||
sharedResourceID = itemID
|
||||
err = nil
|
||||
// If this is neither a public share nor a space permission, check if this is a
|
||||
// user share
|
||||
default:
|
||||
sharedResourceID, err = s.getUserPermissionResourceID(ctx, permissionID)
|
||||
if err == nil {
|
||||
permissionType = User
|
||||
}
|
||||
}
|
||||
|
||||
if sharedResourceID == nil && s.config.IncludeOCMSharees {
|
||||
sharedResourceID, err = s.getOCMPermissionResourceID(ctx, permissionID)
|
||||
if err == nil {
|
||||
permissionType = OCM
|
||||
}
|
||||
}
|
||||
|
||||
switch {
|
||||
case err != nil:
|
||||
s.logger.Error().Err(err).Msg("permission error")
|
||||
return err
|
||||
case permType == Unknown:
|
||||
case permissionType == Unknown:
|
||||
s.logger.Error().Err(err).Msg("permission not found")
|
||||
return errorcode.New(errorcode.ItemNotFound, "permission not found")
|
||||
case sharedResourceID == nil:
|
||||
@@ -578,7 +605,7 @@ func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemI
|
||||
return err
|
||||
}
|
||||
|
||||
switch permType {
|
||||
switch permissionType {
|
||||
case User:
|
||||
return s.removeUserShare(ctx, permissionID)
|
||||
case Public:
|
||||
@@ -595,54 +622,6 @@ func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemI
|
||||
}
|
||||
}
|
||||
|
||||
// resolveDeletePermission determines the type and shared resource ID for a permission
|
||||
// that is about to be deleted.
|
||||
func (s DriveItemPermissionsService) resolveDeletePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string) (permissionType, *storageprovider.ResourceId, error) {
|
||||
if IsSpaceRoot(itemID) {
|
||||
return s.resolveSpaceRootPermission(ctx, itemID, permissionID)
|
||||
}
|
||||
return s.resolveItemPermission(ctx, permissionID)
|
||||
}
|
||||
|
||||
// resolveSpaceRootPermission resolves permissions on a space root. Space roots
|
||||
// carry space permissions (member/group grants with "u:"/"g:" prefixed IDs) and
|
||||
// public links. Space permissions are recognised by their ID format to avoid a
|
||||
// superfluous gateway call to GetPublicShare.
|
||||
func (s DriveItemPermissionsService) resolveSpaceRootPermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string) (permissionType, *storageprovider.ResourceId, error) {
|
||||
if _, parseErr := spacePermissionIdToCS3Grantee(permissionID); parseErr == nil {
|
||||
return Space, itemID, nil
|
||||
}
|
||||
|
||||
sharedResourceID, err := s.getLinkPermissionResourceID(ctx, permissionID)
|
||||
if err == nil {
|
||||
return Public, sharedResourceID, nil
|
||||
}
|
||||
return Unknown, nil, err
|
||||
}
|
||||
|
||||
// resolveItemPermission resolves permissions on a non-space-root item by trying
|
||||
// public link, user share, then OCM share lookups in order.
|
||||
func (s DriveItemPermissionsService) resolveItemPermission(ctx context.Context, permissionID string) (permissionType, *storageprovider.ResourceId, error) {
|
||||
sharedResourceID, err := s.getLinkPermissionResourceID(ctx, permissionID)
|
||||
if err == nil {
|
||||
return Public, sharedResourceID, nil
|
||||
}
|
||||
|
||||
sharedResourceID, err = s.getUserPermissionResourceID(ctx, permissionID)
|
||||
if err == nil {
|
||||
return User, sharedResourceID, nil
|
||||
}
|
||||
|
||||
if s.config.IncludeOCMSharees {
|
||||
sharedResourceID, err = s.getOCMPermissionResourceID(ctx, permissionID)
|
||||
if err == nil {
|
||||
return OCM, sharedResourceID, nil
|
||||
}
|
||||
}
|
||||
|
||||
return Unknown, nil, err
|
||||
}
|
||||
|
||||
// DeleteSpaceRootPermission deletes a permission on the root item of a project space
|
||||
func (s DriveItemPermissionsService) DeleteSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string) error {
|
||||
|
||||
|
||||
@@ -822,8 +822,9 @@ var _ = Describe("DriveItemPermissionsService", func() {
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
It("deletes a space permission as expected", func() {
|
||||
// No GetPublicShare mock needed — space permissions (u:/g: prefixed IDs)
|
||||
// are recognised by their format and skip the public share lookup.
|
||||
getPublicShareResponse.Status = status.NewNotFound(context.Background(), "")
|
||||
gatewayClient.On("GetPublicShare", mock.Anything, mock.Anything).Return(&getPublicShareResponse, nil)
|
||||
|
||||
gatewayClient.On("RemoveShare",
|
||||
mock.Anything,
|
||||
mock.Anything,
|
||||
|
||||
@@ -469,11 +469,8 @@ func (s *Service) IndexSpace(spaceID *provider.StorageSpaceId) error {
|
||||
docMtime, parseErr := time.Parse(time.RFC3339Nano, r.Mtime)
|
||||
if parseErr == nil && !docMtime.Before(fileMtime) {
|
||||
if info.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER {
|
||||
// Always descend into directories — a directory's
|
||||
// mtime only reflects direct child add/remove, not
|
||||
// whether all children were successfully indexed.
|
||||
// With O(1) DocID lookups the cost is negligible.
|
||||
return nil
|
||||
s.logger.Debug().Str("path", ref.Path).Msg("subtree hasn't changed. Skipping.")
|
||||
return filepath.SkipDir
|
||||
}
|
||||
s.logger.Debug().Str("path", ref.Path).Msg("element hasn't changed. Skipping.")
|
||||
return nil
|
||||
|
||||
@@ -3,9 +3,6 @@ package search_test
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
|
||||
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
@@ -203,139 +200,6 @@ var _ = Describe("Searchprovider", func() {
|
||||
err := s.IndexSpace(&sprovider.StorageSpaceId{OpaqueId: "storageid$spaceid!spaceid"})
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("descends into already-indexed directories to index unvisited children", func() {
|
||||
// Simulate a large tree where all directories are already indexed
|
||||
// (mtime matches) but each contains one unindexed file — e.g. after
|
||||
// a Tika crash interrupted a previous reindex run. The fix ensures
|
||||
// we never SkipDir for directories, so children are always visited.
|
||||
//
|
||||
// 10,000 directories: pessimistic-case benchmark confirming the walker
|
||||
// scales linearly even when every directory is already indexed.
|
||||
const numDirs = 10000
|
||||
|
||||
gatewayClient.On("GetUserByClaim", mock.Anything, mock.Anything).Return(&userv1beta1.GetUserByClaimResponse{
|
||||
Status: status.NewOK(context.Background()),
|
||||
User: user,
|
||||
}, nil)
|
||||
extractor.On("Extract", mock.Anything, mock.Anything, mock.Anything).Return(content.Document{}, nil)
|
||||
|
||||
// The indexed mtime that the engine returns for directories.
|
||||
indexedMtime := time.Unix(5000, 0).UTC().Format(time.RFC3339Nano)
|
||||
|
||||
// Build root: a container that lists numDirs child directories.
|
||||
rootInfo := &sprovider.ResourceInfo{
|
||||
Id: &sprovider.ResourceId{StorageId: "storageid", SpaceId: "spaceid", OpaqueId: "spaceid"},
|
||||
Type: sprovider.ResourceType_RESOURCE_TYPE_CONTAINER,
|
||||
Path: ".",
|
||||
Mtime: &typesv1beta1.Timestamp{Seconds: 5000},
|
||||
}
|
||||
dirInfos := make([]*sprovider.ResourceInfo, numDirs)
|
||||
for i := 0; i < numDirs; i++ {
|
||||
dirInfos[i] = &sprovider.ResourceInfo{
|
||||
Id: &sprovider.ResourceId{StorageId: "storageid", SpaceId: "spaceid", OpaqueId: fmt.Sprintf("dir-%d", i)},
|
||||
Type: sprovider.ResourceType_RESOURCE_TYPE_CONTAINER,
|
||||
Path: fmt.Sprintf("dir-%d", i),
|
||||
Mtime: &typesv1beta1.Timestamp{Seconds: 5000},
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-build file infos for each directory (map for O(1) dispatch).
|
||||
fileInfoByDir := make(map[string]*sprovider.ResourceInfo, numDirs)
|
||||
for i := 0; i < numDirs; i++ {
|
||||
dirID := fmt.Sprintf("dir-%d", i)
|
||||
fileInfoByDir[dirID] = &sprovider.ResourceInfo{
|
||||
Id: &sprovider.ResourceId{StorageId: "storageid", SpaceId: "spaceid", OpaqueId: fmt.Sprintf("file-%d", i)},
|
||||
ParentId: &sprovider.ResourceId{StorageId: "storageid", SpaceId: "spaceid", OpaqueId: dirID},
|
||||
Type: sprovider.ResourceType_RESOURCE_TYPE_FILE,
|
||||
Path: fmt.Sprintf("file-%d.pdf", i),
|
||||
Size: 1024,
|
||||
Mtime: &typesv1beta1.Timestamp{Seconds: 5000},
|
||||
}
|
||||
}
|
||||
|
||||
// Build path-to-fileInfo map for O(1) Stat dispatch.
|
||||
fileInfoByPath := make(map[string]*sprovider.ResourceInfo, numDirs)
|
||||
for dirID, fi := range fileInfoByDir {
|
||||
fileInfoByPath["./"+dirID+"/"+fi.Path] = fi
|
||||
}
|
||||
|
||||
// Single Stat mock dispatching via map — avoids 10k separate matchers.
|
||||
gatewayClient.On("Stat", mock.Anything, mock.Anything).Return(
|
||||
func(_ context.Context, sreq *sprovider.StatRequest, _ ...grpc.CallOption) *sprovider.StatResponse {
|
||||
if sreq.Ref.ResourceId != nil && sreq.Ref.ResourceId.OpaqueId == "spaceid" {
|
||||
return &sprovider.StatResponse{
|
||||
Status: status.NewOK(context.Background()),
|
||||
Info: rootInfo,
|
||||
}
|
||||
}
|
||||
if fi, ok := fileInfoByPath[sreq.Ref.Path]; ok {
|
||||
return &sprovider.StatResponse{
|
||||
Status: status.NewOK(context.Background()),
|
||||
Info: fi,
|
||||
}
|
||||
}
|
||||
return &sprovider.StatResponse{Status: status.NewOK(context.Background()), Info: rootInfo}
|
||||
},
|
||||
func(_ context.Context, _ *sprovider.StatRequest, _ ...grpc.CallOption) error {
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
// Single ListContainer mock dispatching via map.
|
||||
gatewayClient.On("ListContainer", mock.Anything, mock.Anything).Return(
|
||||
func(_ context.Context, req *sprovider.ListContainerRequest, _ ...grpc.CallOption) *sprovider.ListContainerResponse {
|
||||
opaqueID := req.Ref.ResourceId.OpaqueId
|
||||
if opaqueID == "spaceid" {
|
||||
return &sprovider.ListContainerResponse{
|
||||
Status: status.NewOK(context.Background()),
|
||||
Infos: dirInfos,
|
||||
}
|
||||
}
|
||||
if fi, ok := fileInfoByDir[opaqueID]; ok {
|
||||
return &sprovider.ListContainerResponse{
|
||||
Status: status.NewOK(context.Background()),
|
||||
Infos: []*sprovider.ResourceInfo{fi},
|
||||
}
|
||||
}
|
||||
return &sprovider.ListContainerResponse{
|
||||
Status: status.NewOK(context.Background()),
|
||||
Infos: nil,
|
||||
}
|
||||
},
|
||||
func(_ context.Context, _ *sprovider.ListContainerRequest, _ ...grpc.CallOption) error {
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
// Lookup: root and directories are already indexed with matching mtime.
|
||||
// Use a map for O(1) lookup instead of linear scan (matters at 10k dirs).
|
||||
indexedIDs := make(map[string]bool, numDirs+1)
|
||||
indexedIDs["storageid$spaceid!spaceid"] = true
|
||||
for i := 0; i < numDirs; i++ {
|
||||
indexedIDs[fmt.Sprintf("storageid$spaceid!dir-%d", i)] = true
|
||||
}
|
||||
indexedResource := &engine.Resource{Document: content.Document{Mtime: indexedMtime}, Extracted: true}
|
||||
indexClient.On("Lookup", mock.MatchedBy(func(id string) bool {
|
||||
return indexedIDs[id] || len(id) > 18 // dir-N or file-N IDs
|
||||
})).Return(func(id string) (*engine.Resource, error) {
|
||||
if indexedIDs[id] {
|
||||
return indexedResource, nil
|
||||
}
|
||||
// Files are not indexed.
|
||||
return nil, engine.ErrResourceNotFound
|
||||
})
|
||||
|
||||
// Track Upsert calls — each unindexed file should trigger one.
|
||||
var upsertCount atomic.Int32
|
||||
indexClient.On("Upsert", mock.Anything, mock.Anything).Run(func(_ mock.Arguments) {
|
||||
upsertCount.Add(1)
|
||||
}).Return(nil)
|
||||
|
||||
err := s.IndexSpace(&sprovider.StorageSpaceId{OpaqueId: "storageid$spaceid!spaceid"})
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
Expect(int(upsertCount.Load())).To(Equal(numDirs), "every unindexed file inside an already-indexed directory must be visited")
|
||||
})
|
||||
})
|
||||
|
||||
Describe("UpdateTags", func() {
|
||||
|
||||
@@ -38,46 +38,6 @@ require_once 'bootstrap.php';
|
||||
class SearchContext implements Context {
|
||||
private FeatureContext $featureContext;
|
||||
|
||||
/**
|
||||
* Retry search until results are non-empty or timeout is reached.
|
||||
* Indexing of newly uploaded files in ocis is async, so a single
|
||||
* fixed sleep is not reliable — poll instead.
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $pattern
|
||||
* @param string|null $limit
|
||||
* @param string|null $scopeType
|
||||
* @param string|null $scope
|
||||
* @param string|null $spaceName
|
||||
* @param TableNode|null $properties
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
private function searchWithRetry(
|
||||
string $user,
|
||||
string $pattern,
|
||||
?string $limit = null,
|
||||
?string $scopeType = null,
|
||||
?string $scope = null,
|
||||
?string $spaceName = null,
|
||||
?TableNode $properties = null,
|
||||
): ResponseInterface {
|
||||
// Indexing is async — poll until results appear.
|
||||
// Initial wait 3s, then retry every 2s, up to ~13s total.
|
||||
$maxAttempts = STANDARD_RETRY_COUNT;
|
||||
$response = null;
|
||||
for ($attempt = 0; $attempt < $maxAttempts; $attempt++) {
|
||||
\sleep($attempt === 0 ? 3 : 2);
|
||||
$response = $this->searchFiles($user, $pattern, $limit, $scopeType, $scope, $spaceName, $properties);
|
||||
$parsed = HttpRequestHelper::parseResponseAsXml($response);
|
||||
if (\is_array($parsed) && isset($parsed["value"]) && !empty($parsed["value"])) {
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
// return last response even if empty — let the assertion step produce the failure message
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $user
|
||||
* @param string $pattern
|
||||
@@ -186,7 +146,10 @@ class SearchContext implements Context {
|
||||
?string $limit = null,
|
||||
?TableNode $properties = null,
|
||||
): void {
|
||||
$response = $this->searchWithRetry($user, $pattern, $limit, null, null, null, $properties);
|
||||
// NOTE: because indexing of newly uploaded files or directories with ocis is decoupled and occurs asynchronously
|
||||
// short wait is necessary before searching
|
||||
sleep(5);
|
||||
$response = $this->searchFiles($user, $pattern, $limit, null, null, null, $properties);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
@@ -306,7 +269,10 @@ class SearchContext implements Context {
|
||||
string $scope,
|
||||
?string $spaceName = null,
|
||||
): void {
|
||||
$response = $this->searchWithRetry($user, $pattern, null, $scopeType, $scope, $spaceName);
|
||||
// NOTE: since indexing of newly uploaded files or directories with ocis is decoupled and occurs asynchronously,
|
||||
// a short wait is necessary before searching
|
||||
sleep(5);
|
||||
$response = $this-> searchFiles($user, $pattern, null, $scopeType, $scope, $spaceName);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
}
|
||||
@@ -4063,46 +4063,10 @@ trait WebDav {
|
||||
* @throws Exception
|
||||
*/
|
||||
public function theDownloadedPreviewContentShouldMatchWithFixturesPreviewContentFor(string $filename): void {
|
||||
$fixturePath = __DIR__ . "/../fixtures/" . $filename;
|
||||
$fixtureImg = \imagecreatefromstring(\file_get_contents($fixturePath));
|
||||
Assert::assertNotFalse($fixtureImg, "Could not decode fixture image $filename");
|
||||
|
||||
$expectedPreview = \file_get_contents(__DIR__ . "/../fixtures/" . $filename);
|
||||
$this->getResponse()->getBody()->rewind();
|
||||
$responseBodyContent = $this->getResponse()->getBody()->getContents();
|
||||
$responseImg = \imagecreatefromstring($responseBodyContent);
|
||||
Assert::assertNotFalse($responseImg, "Downloaded preview is not a valid image");
|
||||
|
||||
$w = \imagesx($fixtureImg);
|
||||
$h = \imagesy($fixtureImg);
|
||||
Assert::assertEquals($w, \imagesx($responseImg), "Image width mismatch for fixture $filename");
|
||||
Assert::assertEquals($h, \imagesy($responseImg), "Image height mismatch for fixture $filename");
|
||||
|
||||
$tolerance = 12; // per-channel tolerance for libvips version differences
|
||||
$maxDiff = 0;
|
||||
for ($x = 0; $x < $w; $x++) {
|
||||
for ($y = 0; $y < $h; $y++) {
|
||||
$fc = \imagecolorat($fixtureImg, $x, $y);
|
||||
$rc = \imagecolorat($responseImg, $x, $y);
|
||||
$maxDiff = \max(
|
||||
$maxDiff,
|
||||
\abs(($fc >> 16 & 0xFF) - ($rc >> 16 & 0xFF)),
|
||||
\abs(($fc >> 8 & 0xFF) - ($rc >> 8 & 0xFF)),
|
||||
\abs(($fc & 0xFF) - ($rc & 0xFF)),
|
||||
);
|
||||
}
|
||||
}
|
||||
$rw = \imagesx($responseImg);
|
||||
$rh = \imagesy($responseImg);
|
||||
echo " [preview-fixture] $filename: fixture={$w}x{$h} response={$rw}x{$rh} maxPixelDiff=$maxDiff\n";
|
||||
|
||||
Assert::assertLessThanOrEqual(
|
||||
$tolerance,
|
||||
$maxDiff,
|
||||
"Preview pixel values differ by more than $tolerance from fixture $filename (max diff: $maxDiff)",
|
||||
);
|
||||
|
||||
\imagedestroy($fixtureImg);
|
||||
\imagedestroy($responseImg);
|
||||
Assert::assertEquals($expectedPreview, $responseBodyContent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,8 +59,8 @@ Feature: List upload sessions via CLI command
|
||||
|
||||
Scenario: list and cleanup the expired upload sessions
|
||||
Given a file "large.zip" with the size of "2GB" has been created locally
|
||||
And user "Alice" has uploaded a file from "filesForUpload/textfile.txt" to "file.txt" via TUS inside of the space "Personal" using the WebDAV API
|
||||
And the config "STORAGE_USERS_UPLOAD_EXPIRATION" has been set to "1" for "storageuser" service
|
||||
And user "Alice" has uploaded a file from "filesForUpload/textfile.txt" to "file.txt" via TUS inside of the space "Personal" using the WebDAV API
|
||||
And user "Alice" has tried to upload file "filesForUpload/large.zip" to "large.zip" inside space "Personal" via TUS
|
||||
When the administrator lists all the upload sessions with flag "expired"
|
||||
Then the command should be successful
|
||||
@@ -203,8 +203,8 @@ Feature: List upload sessions via CLI command
|
||||
|
||||
Scenario: restart expired upload sessions
|
||||
Given a file "large.zip" with the size of "2GB" has been created locally
|
||||
And user "Alice" has uploaded a file from "filesForUpload/textfile.txt" to "file.txt" via TUS inside of the space "Personal" using the WebDAV API
|
||||
And the config "STORAGE_USERS_UPLOAD_EXPIRATION" has been set to "1" for "storageuser" service
|
||||
And user "Alice" has uploaded a file from "filesForUpload/textfile.txt" to "file.txt" via TUS inside of the space "Personal" using the WebDAV API
|
||||
And user "Alice" has tried to upload file "filesForUpload/large.zip" to "large.zip" inside space "Personal" via TUS
|
||||
When the administrator restarts the expired upload sessions using the CLI
|
||||
Then the command should be successful
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Run CS3 API validator tests locally and in GitHub Actions CI.
|
||||
|
||||
Config sourced from .drone.star cs3ApiTests() — single source of truth.
|
||||
Usage: python3 tests/acceptance/run-cs3api.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Constants (mirroring .drone.star)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# HTTPS — matching drone: ocis init generates a self-signed cert; proxy uses TLS by default.
|
||||
# Host-side curl calls use -k (insecure) to skip cert verification.
|
||||
OCIS_URL = "https://127.0.0.1:9200"
|
||||
CS3API_IMAGE = "owncloud/cs3api-validator:0.2.1"
|
||||
|
||||
|
||||
def get_docker_bridge_ip() -> str:
|
||||
"""Return the Docker bridge gateway IP, reachable from host and Docker containers."""
|
||||
r = subprocess.run(
|
||||
["docker", "network", "inspect", "bridge",
|
||||
"--format", "{{range .IPAM.Config}}{{.Gateway}}{{end}}"],
|
||||
capture_output=True, text=True, check=True,
|
||||
)
|
||||
return r.stdout.strip()
|
||||
|
||||
|
||||
def base_server_env(repo_root: Path, ocis_config_dir: str, ocis_public_url: str) -> dict:
|
||||
"""OCIS server environment matching drone ocisServer(deploy_type='cs3api_validator')."""
|
||||
return {
|
||||
"OCIS_URL": ocis_public_url,
|
||||
"OCIS_CONFIG_DIR": ocis_config_dir,
|
||||
"STORAGE_USERS_DRIVER": "ocis",
|
||||
"PROXY_ENABLE_BASIC_AUTH": "true",
|
||||
# No PROXY_TLS override — drone lets ocis use its default TLS (self-signed cert from init)
|
||||
# IDP excluded: its static assets are absent when running as a host process
|
||||
"OCIS_EXCLUDE_RUN_SERVICES": "idp",
|
||||
"OCIS_LOG_LEVEL": "error",
|
||||
"IDM_CREATE_DEMO_USERS": "true",
|
||||
"IDM_ADMIN_PASSWORD": "admin",
|
||||
"FRONTEND_SEARCH_MIN_LENGTH": "2",
|
||||
"OCIS_ASYNC_UPLOADS": "true",
|
||||
"OCIS_EVENTS_ENABLE_TLS": "false",
|
||||
"NATS_NATS_HOST": "0.0.0.0",
|
||||
"NATS_NATS_PORT": "9233",
|
||||
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
|
||||
"EVENTHISTORY_STORE": "memory",
|
||||
"WEB_UI_CONFIG_FILE": str(repo_root / "tests/config/drone/ocis-config.json"),
|
||||
# cs3api_validator extras (drone ocisServer deploy_type="cs3api_validator")
|
||||
"GATEWAY_GRPC_ADDR": "0.0.0.0:9142",
|
||||
"OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD": "false",
|
||||
}
|
||||
|
||||
|
||||
def wait_for(condition_fn, timeout: int, label: str) -> None:
|
||||
deadline = time.time() + timeout
|
||||
while not condition_fn():
|
||||
if time.time() > deadline:
|
||||
print(f"Timeout waiting for {label}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def ocis_healthy(ocis_url: str) -> bool:
|
||||
r = subprocess.run(
|
||||
["curl", "-sk", "-uadmin:admin",
|
||||
f"{ocis_url}/graph/v1.0/users/admin",
|
||||
"-w", "%{http_code}", "-o", "/dev/null"],
|
||||
capture_output=True, text=True,
|
||||
)
|
||||
return r.stdout.strip() == "200"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
repo_root = Path(__file__).resolve().parents[2]
|
||||
ocis_bin = repo_root / "ocis/bin/ocis"
|
||||
ocis_config_dir = Path.home() / ".ocis/config"
|
||||
|
||||
subprocess.run(["make", "-C", str(repo_root / "ocis"), "build"], check=True)
|
||||
|
||||
# Docker bridge gateway IP: reachable from both the host and Docker containers.
|
||||
# cs3api-validator connects to the GRPC gateway at {bridge_ip}:9142.
|
||||
bridge_ip = get_docker_bridge_ip()
|
||||
print(f"Docker bridge IP: {bridge_ip}", flush=True)
|
||||
|
||||
server_env = {**os.environ}
|
||||
server_env.update(base_server_env(repo_root, str(ocis_config_dir),
|
||||
f"https://{bridge_ip}:9200"))
|
||||
|
||||
subprocess.run(
|
||||
[str(ocis_bin), "init", "--insecure", "true"],
|
||||
env=server_env,
|
||||
check=True,
|
||||
)
|
||||
shutil.copy(
|
||||
repo_root / "tests/config/drone/app-registry.yaml",
|
||||
ocis_config_dir / "app-registry.yaml",
|
||||
)
|
||||
|
||||
print("Starting ocis...", flush=True)
|
||||
ocis_proc = subprocess.Popen(
|
||||
[str(ocis_bin), "server"],
|
||||
env=server_env,
|
||||
)
|
||||
|
||||
def cleanup(*_):
|
||||
try:
|
||||
ocis_proc.terminate()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
signal.signal(signal.SIGTERM, cleanup)
|
||||
signal.signal(signal.SIGINT, cleanup)
|
||||
|
||||
try:
|
||||
wait_for(lambda: ocis_healthy(OCIS_URL), 300, "ocis")
|
||||
print("ocis ready.", flush=True)
|
||||
|
||||
print(f"\nRunning cs3api-validator against {bridge_ip}:9142", flush=True)
|
||||
result = subprocess.run(
|
||||
["docker", "run", "--rm",
|
||||
"--entrypoint", "/usr/bin/cs3api-validator",
|
||||
CS3API_IMAGE,
|
||||
"/var/lib/cs3api-validator",
|
||||
f"--endpoint={bridge_ip}:9142"],
|
||||
)
|
||||
return result.returncode
|
||||
|
||||
finally:
|
||||
cleanup()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -1,287 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Run Playwright e2e tests against a local OCIS instance.
|
||||
|
||||
Usage: E2E_ARGS='--run-part 1' python3 tests/acceptance/run-e2e.py
|
||||
Optional: TIKA_NEEDED=true, KEYCLOAK_NEEDED=true
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import shlex
|
||||
import subprocess
|
||||
import signal
|
||||
import time
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
WEB_REPO = "https://github.com/owncloud/web.git"
|
||||
|
||||
|
||||
def wait_for(condition_fn, timeout: int, label: str) -> None:
|
||||
deadline = time.time() + timeout
|
||||
while not condition_fn():
|
||||
if time.time() > deadline:
|
||||
print(f"Timeout waiting for {label}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def ocis_healthy(ocis_url: str, use_basic_auth: bool = True) -> bool:
|
||||
if use_basic_auth:
|
||||
cmd = ["curl", "-sk", "-uadmin:admin",
|
||||
f"{ocis_url}/graph/v1.0/users/admin",
|
||||
"-w", "%{http_code}", "-o", "/dev/null"]
|
||||
else:
|
||||
# Keycloak mode: no local admin user, check unauthenticated endpoint
|
||||
cmd = ["curl", "-sk",
|
||||
f"{ocis_url}/.well-known/openid-configuration",
|
||||
"-w", "%{http_code}", "-o", "/dev/null"]
|
||||
r = subprocess.run(cmd, capture_output=True, text=True)
|
||||
return r.stdout.strip() == "200"
|
||||
|
||||
|
||||
def run(cmd: list, env: dict = None, check: bool = True, cwd=None):
|
||||
e = {**os.environ, **(env or {})}
|
||||
return subprocess.run(cmd, env=e, check=check, cwd=cwd)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
e2e_args = os.environ.get("E2E_ARGS", "").strip()
|
||||
if not e2e_args:
|
||||
print("E2E_ARGS is required, e.g. E2E_ARGS='--run-part 1' python3 run-e2e.py",
|
||||
file=sys.stderr)
|
||||
return 1
|
||||
|
||||
tika_needed = os.environ.get("TIKA_NEEDED", "").lower() == "true"
|
||||
keycloak_needed = os.environ.get("KEYCLOAK_NEEDED", "").lower() == "true"
|
||||
|
||||
repo_root = Path(__file__).resolve().parents[2]
|
||||
ocis_bin = repo_root / "ocis/bin/ocis"
|
||||
wrapper_bin = repo_root / "tests/ociswrapper/bin/ociswrapper"
|
||||
ocis_url = "https://127.0.0.1:9200"
|
||||
ocis_config_dir = Path.home() / ".ocis/config"
|
||||
web_dir = repo_root / "webTestRunner"
|
||||
|
||||
# build ocis + ociswrapper only if not already provided (e.g. via artifact)
|
||||
if not ocis_bin.exists():
|
||||
run(["make", "-C", str(repo_root / "ocis"), "build"])
|
||||
if not wrapper_bin.exists():
|
||||
run(["make", "-C", str(repo_root / "tests/ociswrapper"), "build"],
|
||||
env={"GOWORK": "off"})
|
||||
|
||||
# clone + install web only if not already provided (e.g. via artifact)
|
||||
if not web_dir.exists():
|
||||
drone_env = {}
|
||||
drone_env_file = repo_root / ".drone.env"
|
||||
if drone_env_file.exists():
|
||||
for line in drone_env_file.read_text().splitlines():
|
||||
if "=" in line and not line.startswith("#"):
|
||||
k, v = line.split("=", 1)
|
||||
drone_env[k.strip()] = v.strip()
|
||||
web_branch = drone_env.get("WEB_BRANCH", "master")
|
||||
web_commitid = drone_env.get("WEB_COMMITID", "")
|
||||
run(["git", "clone", "-b", web_branch, "--single-branch", "--no-tags",
|
||||
WEB_REPO, str(web_dir)])
|
||||
if web_commitid:
|
||||
subprocess.run(["git", "checkout", web_commitid], cwd=web_dir, check=True)
|
||||
|
||||
if not (web_dir / "node_modules").exists():
|
||||
pkg_manager = json.loads((web_dir / "package.json").read_text()).get("packageManager", "pnpm")
|
||||
run(["npm", "install", "--silent", "--global", "--force", pkg_manager])
|
||||
subprocess.run(["pnpm", "config", "set", "store-dir", "./.pnpm-store"],
|
||||
cwd=web_dir, check=True)
|
||||
subprocess.run(["pnpm", "install"], cwd=web_dir, check=True)
|
||||
subprocess.run(["pnpm", "exec", "playwright", "install", "--with-deps", "chromium"],
|
||||
cwd=web_dir, check=True)
|
||||
|
||||
# init ocis
|
||||
run([str(ocis_bin), "init", "--insecure", "true"])
|
||||
shutil.copy(
|
||||
repo_root / "tests/config/drone/app-registry.yaml",
|
||||
ocis_config_dir / "app-registry.yaml",
|
||||
)
|
||||
|
||||
# Trust the self-signed cert system-wide so Chromium and node-fetch
|
||||
# don't produce TLS handshake errors that load the server
|
||||
ocis_cert = Path.home() / ".ocis/proxy/server.crt"
|
||||
if ocis_cert.exists():
|
||||
subprocess.run(
|
||||
["sudo", "cp", str(ocis_cert), "/usr/local/share/ca-certificates/ocis.crt"],
|
||||
check=True,
|
||||
)
|
||||
subprocess.run(["sudo", "update-ca-certificates"], check=True)
|
||||
|
||||
# Patch web UI config: replace Drone Docker service name with our URL
|
||||
drone_web_cfg = json.loads(
|
||||
(repo_root / "tests/config/drone/ocis-config.json").read_text()
|
||||
)
|
||||
|
||||
def _patch_urls(obj, old, new):
|
||||
if isinstance(obj, dict):
|
||||
return {k: _patch_urls(v, old, new) for k, v in obj.items()}
|
||||
if isinstance(obj, list):
|
||||
return [_patch_urls(v, old, new) for v in obj]
|
||||
if isinstance(obj, str):
|
||||
return obj.replace(old, new)
|
||||
return obj
|
||||
|
||||
gha_web_cfg = _patch_urls(drone_web_cfg, "https://ocis-server:9200", ocis_url)
|
||||
gha_web_cfg_path = ocis_config_dir / "web-ui-config.json"
|
||||
gha_web_cfg_path.write_text(json.dumps(gha_web_cfg, indent=2))
|
||||
|
||||
server_env = {
|
||||
**os.environ,
|
||||
# core — matches drone ocisServer()
|
||||
"OCIS_URL": ocis_url,
|
||||
"OCIS_CONFIG_DIR": str(ocis_config_dir),
|
||||
"STORAGE_USERS_DRIVER": "ocis",
|
||||
"PROXY_ENABLE_BASIC_AUTH": "true",
|
||||
|
||||
"OCIS_LOG_LEVEL": "error",
|
||||
"IDM_CREATE_DEMO_USERS": "true",
|
||||
"IDM_ADMIN_PASSWORD": "admin",
|
||||
"FRONTEND_SEARCH_MIN_LENGTH": "2",
|
||||
"OCIS_ASYNC_UPLOADS": "true",
|
||||
"OCIS_EVENTS_ENABLE_TLS": "false",
|
||||
"NATS_NATS_HOST": "0.0.0.0",
|
||||
"NATS_NATS_PORT": "9233",
|
||||
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
|
||||
"EVENTHISTORY_STORE": "memory",
|
||||
"OCIS_TRANSLATION_PATH": str(repo_root / "tests/config/translations"),
|
||||
"WEB_UI_CONFIG_FILE": str(gha_web_cfg_path),
|
||||
"THUMBNAILS_TXT_FONTMAP_FILE": str(repo_root / "tests/config/drone/fontsMap.json"),
|
||||
# extra_server_environment — matches drone e2eTestPipeline()
|
||||
"OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST": str(repo_root / "tests/config/drone/banned-password-list.txt"),
|
||||
"GRAPH_AVAILABLE_ROLES": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5,a8d5fe5e-96e3-418d-825b-534dbdf22b99,fb6c3e19-e378-47e5-b277-9732f9de6e21,58c63c02-1d89-4572-916a-870abc5a1b7d,2d00ce52-1fc2-4dbc-8b95-a73b73395f5a,1c996275-f1c9-4e71-abdf-a42f6495e960,312c0871-5ef7-4b3a-85b6-0e4074c64049,aa97fe03-7980-45ac-9e50-b325749fd7e6,63e64e19-8d43-42ec-a738-2b6af2610efa",
|
||||
"FRONTEND_CONFIGURABLE_NOTIFICATIONS": "true",
|
||||
# debug addresses
|
||||
"ACTIVITYLOG_DEBUG_ADDR": "0.0.0.0:9197",
|
||||
"APP_PROVIDER_DEBUG_ADDR": "0.0.0.0:9165",
|
||||
"APP_REGISTRY_DEBUG_ADDR": "0.0.0.0:9243",
|
||||
"AUTH_BASIC_DEBUG_ADDR": "0.0.0.0:9147",
|
||||
"AUTH_MACHINE_DEBUG_ADDR": "0.0.0.0:9167",
|
||||
"AUTH_SERVICE_DEBUG_ADDR": "0.0.0.0:9198",
|
||||
"CLIENTLOG_DEBUG_ADDR": "0.0.0.0:9260",
|
||||
"EVENTHISTORY_DEBUG_ADDR": "0.0.0.0:9270",
|
||||
"FRONTEND_DEBUG_ADDR": "0.0.0.0:9141",
|
||||
"GATEWAY_DEBUG_ADDR": "0.0.0.0:9143",
|
||||
"GRAPH_DEBUG_ADDR": "0.0.0.0:9124",
|
||||
"GROUPS_DEBUG_ADDR": "0.0.0.0:9161",
|
||||
"IDM_DEBUG_ADDR": "0.0.0.0:9239",
|
||||
"IDP_DEBUG_ADDR": "0.0.0.0:9134",
|
||||
"INVITATIONS_DEBUG_ADDR": "0.0.0.0:9269",
|
||||
"NATS_DEBUG_ADDR": "0.0.0.0:9234",
|
||||
"OCDAV_DEBUG_ADDR": "0.0.0.0:9163",
|
||||
"OCM_DEBUG_ADDR": "0.0.0.0:9281",
|
||||
"OCS_DEBUG_ADDR": "0.0.0.0:9114",
|
||||
"POSTPROCESSING_DEBUG_ADDR": "0.0.0.0:9255",
|
||||
"PROXY_DEBUG_ADDR": "0.0.0.0:9205",
|
||||
"SEARCH_DEBUG_ADDR": "0.0.0.0:9224",
|
||||
"SETTINGS_DEBUG_ADDR": "0.0.0.0:9194",
|
||||
"SHARING_DEBUG_ADDR": "0.0.0.0:9151",
|
||||
"SSE_DEBUG_ADDR": "0.0.0.0:9139",
|
||||
"STORAGE_PUBLICLINK_DEBUG_ADDR": "0.0.0.0:9179",
|
||||
"STORAGE_SHARES_DEBUG_ADDR": "0.0.0.0:9156",
|
||||
"STORAGE_SYSTEM_DEBUG_ADDR": "0.0.0.0:9217",
|
||||
"STORAGE_USERS_DEBUG_ADDR": "0.0.0.0:9159",
|
||||
"THUMBNAILS_DEBUG_ADDR": "0.0.0.0:9189",
|
||||
"USERLOG_DEBUG_ADDR": "0.0.0.0:9214",
|
||||
"USERS_DEBUG_ADDR": "0.0.0.0:9145",
|
||||
"WEB_DEBUG_ADDR": "0.0.0.0:9104",
|
||||
"WEBDAV_DEBUG_ADDR": "0.0.0.0:9119",
|
||||
"WEBFINGER_DEBUG_ADDR": "0.0.0.0:9279",
|
||||
}
|
||||
|
||||
if tika_needed:
|
||||
server_env.update({
|
||||
"FRONTEND_FULL_TEXT_SEARCH_ENABLED": "true",
|
||||
"SEARCH_EXTRACTOR_TYPE": "tika",
|
||||
"SEARCH_EXTRACTOR_TIKA_TIKA_URL": "http://localhost:9998",
|
||||
"SEARCH_EXTRACTOR_CS3SOURCE_INSECURE": "true",
|
||||
})
|
||||
|
||||
if keycloak_needed:
|
||||
server_env.update({
|
||||
"OCIS_EXCLUDE_RUN_SERVICES": "idp",
|
||||
"PROXY_AUTOPROVISION_ACCOUNTS": "true",
|
||||
"PROXY_ROLE_ASSIGNMENT_DRIVER": "oidc",
|
||||
"OCIS_OIDC_ISSUER": "https://localhost:8443/realms/oCIS",
|
||||
"PROXY_OIDC_REWRITE_WELLKNOWN": "true",
|
||||
"WEB_OIDC_CLIENT_ID": "web",
|
||||
"PROXY_USER_OIDC_CLAIM": "preferred_username",
|
||||
"PROXY_USER_CS3_CLAIM": "username",
|
||||
"OCIS_ADMIN_USER_ID": "",
|
||||
"GRAPH_ASSIGN_DEFAULT_USER_ROLE": "false",
|
||||
"GRAPH_USERNAME_MATCH": "none",
|
||||
"PROXY_CSP_CONFIG_FILE_LOCATION": str(repo_root / "tests/config/drone/csp.yaml"),
|
||||
"KEYCLOAK_DOMAIN": "localhost:8443",
|
||||
"IDM_CREATE_DEMO_USERS": "false",
|
||||
})
|
||||
|
||||
procs = []
|
||||
|
||||
print("Starting ocis...")
|
||||
if keycloak_needed:
|
||||
# external IdP: run ocis server directly (no ociswrapper)
|
||||
ocis_proc = subprocess.Popen(
|
||||
[str(ocis_bin), "server"],
|
||||
env=server_env,
|
||||
)
|
||||
else:
|
||||
ocis_proc = subprocess.Popen(
|
||||
[str(wrapper_bin), "serve",
|
||||
"--bin", str(ocis_bin),
|
||||
"--url", ocis_url,
|
||||
"--admin-username", "admin",
|
||||
"--admin-password", "admin"],
|
||||
env=server_env,
|
||||
)
|
||||
procs.append(ocis_proc)
|
||||
|
||||
def cleanup(*_):
|
||||
for p in procs:
|
||||
try:
|
||||
p.terminate()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
signal.signal(signal.SIGTERM, cleanup)
|
||||
signal.signal(signal.SIGINT, cleanup)
|
||||
|
||||
try:
|
||||
wait_for(lambda: ocis_healthy(ocis_url, use_basic_auth=not keycloak_needed), 300, "ocis")
|
||||
print("ocis ready.")
|
||||
|
||||
playwright_env = {
|
||||
**os.environ,
|
||||
"BASE_URL_OCIS": ocis_url,
|
||||
"HEADLESS": "true",
|
||||
"RETRY": "3",
|
||||
"SKIP_A11Y_TESTS": "true",
|
||||
"REPORT_TRACING": "true",
|
||||
"NODE_EXTRA_CA_CERTS": str(ocis_cert),
|
||||
"BROWSER": "chromium",
|
||||
}
|
||||
|
||||
if keycloak_needed:
|
||||
playwright_env.update({
|
||||
"KEYCLOAK": "true",
|
||||
"KEYCLOAK_HOST": "localhost:8443",
|
||||
})
|
||||
|
||||
print(f"Running e2e: {e2e_args}")
|
||||
result = subprocess.run(
|
||||
["bash", "run-e2e.sh"] + shlex.split(e2e_args),
|
||||
cwd=web_dir / "tests/e2e",
|
||||
env=playwright_env,
|
||||
)
|
||||
return result.returncode
|
||||
|
||||
finally:
|
||||
cleanup()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -1,709 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Run ocis acceptance tests locally and in GitHub Actions CI.
|
||||
|
||||
Config sourced from .drone.star localApiTests — single source of truth.
|
||||
Usage: BEHAT_SUITES=apiGraph python3 tests/acceptance/run-github.py
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import signal
|
||||
import time
|
||||
import tempfile
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Config sourced from .drone.star
|
||||
# NOTE: EMAIL_SMTP_HOST is "email" (container name) in drone, "localhost" here
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
EMAIL_SMTP_HOST = "localhost"
|
||||
EMAIL_SMTP_PORT = "1025"
|
||||
EMAIL_PORT = "8025"
|
||||
EMAIL_SMTP_SENDER = "ownCloud <noreply@example.com>"
|
||||
|
||||
LOCAL_API_TESTS = {
|
||||
"contractAndLock": {
|
||||
"suites": ["apiContract", "apiLocks"],
|
||||
},
|
||||
"settingsAndNotification": {
|
||||
"suites": ["apiSettings", "apiNotification", "apiCors"],
|
||||
"emailNeeded": True,
|
||||
"extraEnvironment": {
|
||||
"EMAIL_HOST": EMAIL_SMTP_HOST,
|
||||
"EMAIL_PORT": EMAIL_PORT,
|
||||
},
|
||||
"extraServerEnvironment": {
|
||||
"OCIS_ADD_RUN_SERVICES": "notifications",
|
||||
"NOTIFICATIONS_SMTP_HOST": EMAIL_SMTP_HOST,
|
||||
"NOTIFICATIONS_SMTP_PORT": EMAIL_SMTP_PORT,
|
||||
"NOTIFICATIONS_SMTP_INSECURE": "true",
|
||||
"NOTIFICATIONS_SMTP_SENDER": EMAIL_SMTP_SENDER,
|
||||
"NOTIFICATIONS_DEBUG_ADDR": "0.0.0.0:9174",
|
||||
},
|
||||
},
|
||||
"graphUser": {
|
||||
"suites": ["apiGraphUser"],
|
||||
},
|
||||
"spaces": {
|
||||
"suites": ["apiSpaces"],
|
||||
},
|
||||
"spacesShares": {
|
||||
"suites": ["apiSpacesShares"],
|
||||
},
|
||||
"davOperations": {
|
||||
"suites": [
|
||||
"apiSpacesDavOperation", "apiDownloads", "apiAsyncUpload",
|
||||
"apiDepthInfinity", "apiArchiver", "apiActivities",
|
||||
],
|
||||
},
|
||||
"groupAndSearch1": {
|
||||
"suites": ["apiSearch1", "apiGraph", "apiGraphGroup"],
|
||||
},
|
||||
"search2": {
|
||||
"suites": ["apiSearch2", "apiSearchContent"],
|
||||
"tikaNeeded": True,
|
||||
"extraServerEnvironment": {
|
||||
"FRONTEND_FULL_TEXT_SEARCH_ENABLED": "true",
|
||||
"SEARCH_EXTRACTOR_TYPE": "tika",
|
||||
"SEARCH_EXTRACTOR_TIKA_TIKA_URL": "http://localhost:9998",
|
||||
"SEARCH_EXTRACTOR_CS3SOURCE_INSECURE": "true",
|
||||
},
|
||||
},
|
||||
"sharingNg1": {
|
||||
"suites": ["apiSharingNgShares", "apiReshare", "apiSharingNgPermissions"],
|
||||
},
|
||||
"sharingNgAdditionalShareRole": {
|
||||
"suites": ["apiSharingNgAdditionalShareRole"],
|
||||
},
|
||||
"sharingNgShareInvitation": {
|
||||
"suites": ["apiSharingNgDriveInvitation", "apiSharingNgItemInvitation"],
|
||||
},
|
||||
"sharingNgLinkShare": {
|
||||
"suites": [
|
||||
"apiSharingNgDriveLinkShare", "apiSharingNgItemLinkShare",
|
||||
"apiSharingNgLinkShareManagement",
|
||||
],
|
||||
},
|
||||
"antivirus": {
|
||||
"suites": ["apiAntivirus"],
|
||||
"antivirusNeeded": True,
|
||||
"extraServerEnvironment": {
|
||||
"ANTIVIRUS_SCANNER_TYPE": "clamav",
|
||||
"ANTIVIRUS_CLAMAV_SOCKET": "tcp://clamav:3310",
|
||||
"POSTPROCESSING_STEPS": "virusscan",
|
||||
"OCIS_ADD_RUN_SERVICES": "antivirus",
|
||||
"ANTIVIRUS_DEBUG_ADDR": "0.0.0.0:9277",
|
||||
},
|
||||
},
|
||||
"ocm": {
|
||||
"suites": ["apiOcm"],
|
||||
"emailNeeded": True,
|
||||
"federationServer": True,
|
||||
"extraEnvironment": {
|
||||
"EMAIL_HOST": EMAIL_SMTP_HOST,
|
||||
"EMAIL_PORT": EMAIL_PORT,
|
||||
},
|
||||
"extraServerEnvironment": {
|
||||
"OCIS_ADD_RUN_SERVICES": "ocm,notifications",
|
||||
"OCIS_ENABLE_OCM": "true",
|
||||
"OCM_OCM_INVITE_MANAGER_INSECURE": "true",
|
||||
"OCM_OCM_SHARE_PROVIDER_INSECURE": "true",
|
||||
"OCM_OCM_STORAGE_PROVIDER_INSECURE": "true",
|
||||
"OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE": "", # set at runtime
|
||||
"NOTIFICATIONS_SMTP_HOST": EMAIL_SMTP_HOST,
|
||||
"NOTIFICATIONS_SMTP_PORT": EMAIL_SMTP_PORT,
|
||||
"NOTIFICATIONS_SMTP_INSECURE": "true",
|
||||
"NOTIFICATIONS_SMTP_SENDER": EMAIL_SMTP_SENDER,
|
||||
"NOTIFICATIONS_DEBUG_ADDR": "0.0.0.0:9174",
|
||||
},
|
||||
},
|
||||
"authApp": {
|
||||
"suites": ["apiAuthApp"],
|
||||
"extraServerEnvironment": {
|
||||
"OCIS_ADD_RUN_SERVICES": "auth-app",
|
||||
"PROXY_ENABLE_APP_AUTH": "true",
|
||||
},
|
||||
},
|
||||
"wopi": {
|
||||
"suites": ["apiCollaboration"],
|
||||
"collaborationServiceNeeded": True,
|
||||
"extraServerEnvironment": {
|
||||
"GATEWAY_GRPC_ADDR": "0.0.0.0:9142",
|
||||
},
|
||||
},
|
||||
"cliCommands": {
|
||||
"suites": ["cliCommands", "apiServiceAvailability"],
|
||||
"antivirusNeeded": True,
|
||||
"emailNeeded": True,
|
||||
"extraEnvironment": {
|
||||
"EMAIL_HOST": EMAIL_SMTP_HOST,
|
||||
"EMAIL_PORT": EMAIL_PORT,
|
||||
},
|
||||
"extraServerEnvironment": {
|
||||
"NOTIFICATIONS_SMTP_HOST": EMAIL_SMTP_HOST,
|
||||
"NOTIFICATIONS_SMTP_PORT": EMAIL_SMTP_PORT,
|
||||
"NOTIFICATIONS_SMTP_INSECURE": "true",
|
||||
"NOTIFICATIONS_SMTP_SENDER": EMAIL_SMTP_SENDER,
|
||||
"NOTIFICATIONS_DEBUG_ADDR": "0.0.0.0:9174",
|
||||
"ANTIVIRUS_SCANNER_TYPE": "clamav",
|
||||
"ANTIVIRUS_CLAMAV_SOCKET": "tcp://clamav:3310",
|
||||
"ANTIVIRUS_DEBUG_ADDR": "0.0.0.0:9277",
|
||||
"OCIS_ADD_RUN_SERVICES": "antivirus,notifications",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
# reverse lookup: suite → group config
|
||||
_SUITE_TO_CONFIG: dict = {}
|
||||
for _cfg in LOCAL_API_TESTS.values():
|
||||
for _s in _cfg.get("suites", []):
|
||||
_SUITE_TO_CONFIG[_s] = _cfg
|
||||
|
||||
|
||||
# GitHub Actions uses --network host: all wopi services share one network namespace.
|
||||
# Drone gives each service its own container → all can use 9300/9301/9304.
|
||||
# Assign distinct ports here to avoid collisions.
|
||||
_WOPI_PORTS = {
|
||||
"collabora": {"grpc": 9301, "http": 9300, "debug": 9304},
|
||||
"onlyoffice": {"grpc": 9311, "http": 9310, "debug": 9314},
|
||||
"fakeoffice": {"grpc": 9321, "http": 9320, "debug": 9324},
|
||||
}
|
||||
|
||||
|
||||
def merged_config(suites: list) -> dict:
|
||||
"""Union config for all requested suites."""
|
||||
merged = {
|
||||
"emailNeeded": False,
|
||||
"antivirusNeeded": False,
|
||||
"tikaNeeded": False,
|
||||
"federationServer": False,
|
||||
"collaborationServiceNeeded": False,
|
||||
"extraServerEnvironment": {},
|
||||
"extraEnvironment": {},
|
||||
}
|
||||
for suite in suites:
|
||||
cfg = _SUITE_TO_CONFIG.get(suite, {})
|
||||
for flag in ("emailNeeded", "antivirusNeeded", "tikaNeeded",
|
||||
"federationServer", "collaborationServiceNeeded"):
|
||||
if cfg.get(flag):
|
||||
merged[flag] = True
|
||||
merged["extraServerEnvironment"].update(cfg.get("extraServerEnvironment", {}))
|
||||
merged["extraEnvironment"].update(cfg.get("extraEnvironment", {}))
|
||||
return merged
|
||||
|
||||
|
||||
def base_server_env(repo_root: Path, ocis_url: str, ocis_config_dir: str) -> dict:
|
||||
"""Base ocis server environment matching drone ocisServer() function."""
|
||||
return {
|
||||
"OCIS_URL": ocis_url,
|
||||
"OCIS_CONFIG_DIR": ocis_config_dir,
|
||||
"STORAGE_USERS_DRIVER": "ocis",
|
||||
"PROXY_ENABLE_BASIC_AUTH": "true",
|
||||
"OCIS_LOG_LEVEL": "error",
|
||||
"IDM_CREATE_DEMO_USERS": "true",
|
||||
"IDM_ADMIN_PASSWORD": "admin",
|
||||
"FRONTEND_SEARCH_MIN_LENGTH": "2",
|
||||
"OCIS_ASYNC_UPLOADS": "true",
|
||||
"OCIS_EVENTS_ENABLE_TLS": "false",
|
||||
"NATS_NATS_HOST": "0.0.0.0",
|
||||
"NATS_NATS_PORT": "9233",
|
||||
"MICRO_REGISTRY_ADDRESS": "127.0.0.1:9233",
|
||||
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
|
||||
"EVENTHISTORY_STORE": "memory",
|
||||
"OCIS_TRANSLATION_PATH": str(repo_root / "tests/config/translations"),
|
||||
"WEB_UI_CONFIG_FILE": str(repo_root / "tests/config/drone/ocis-config.json"),
|
||||
"THUMBNAILS_TXT_FONTMAP_FILE": str(repo_root / "tests/config/drone/fontsMap.json"),
|
||||
# default tika off (overridden by search2 extraServerEnvironment)
|
||||
"SEARCH_EXTRACTOR_TYPE": "basic",
|
||||
"FRONTEND_FULL_TEXT_SEARCH_ENABLED": "false",
|
||||
# debug addresses
|
||||
"ACTIVITYLOG_DEBUG_ADDR": "0.0.0.0:9197",
|
||||
"APP_PROVIDER_DEBUG_ADDR": "0.0.0.0:9165",
|
||||
"APP_REGISTRY_DEBUG_ADDR": "0.0.0.0:9243",
|
||||
"AUTH_BASIC_DEBUG_ADDR": "0.0.0.0:9147",
|
||||
"AUTH_MACHINE_DEBUG_ADDR": "0.0.0.0:9167",
|
||||
"AUTH_SERVICE_DEBUG_ADDR": "0.0.0.0:9198",
|
||||
"CLIENTLOG_DEBUG_ADDR": "0.0.0.0:9260",
|
||||
"EVENTHISTORY_DEBUG_ADDR": "0.0.0.0:9270",
|
||||
"FRONTEND_DEBUG_ADDR": "0.0.0.0:9141",
|
||||
"GATEWAY_DEBUG_ADDR": "0.0.0.0:9143",
|
||||
"GRAPH_DEBUG_ADDR": "0.0.0.0:9124",
|
||||
"GROUPS_DEBUG_ADDR": "0.0.0.0:9161",
|
||||
"IDM_DEBUG_ADDR": "0.0.0.0:9239",
|
||||
"IDP_DEBUG_ADDR": "0.0.0.0:9134",
|
||||
"INVITATIONS_DEBUG_ADDR": "0.0.0.0:9269",
|
||||
"NATS_DEBUG_ADDR": "0.0.0.0:9234",
|
||||
"OCDAV_DEBUG_ADDR": "0.0.0.0:9163",
|
||||
"OCM_DEBUG_ADDR": "0.0.0.0:9281",
|
||||
"OCS_DEBUG_ADDR": "0.0.0.0:9114",
|
||||
"POSTPROCESSING_DEBUG_ADDR": "0.0.0.0:9255",
|
||||
"PROXY_DEBUG_ADDR": "0.0.0.0:9205",
|
||||
"SEARCH_DEBUG_ADDR": "0.0.0.0:9224",
|
||||
"SETTINGS_DEBUG_ADDR": "0.0.0.0:9194",
|
||||
"SHARING_DEBUG_ADDR": "0.0.0.0:9151",
|
||||
"SSE_DEBUG_ADDR": "0.0.0.0:9139",
|
||||
"STORAGE_PUBLICLINK_DEBUG_ADDR": "0.0.0.0:9179",
|
||||
"STORAGE_SHARES_DEBUG_ADDR": "0.0.0.0:9156",
|
||||
"STORAGE_SYSTEM_DEBUG_ADDR": "0.0.0.0:9217",
|
||||
"STORAGE_USERS_DEBUG_ADDR": "0.0.0.0:9159",
|
||||
"THUMBNAILS_DEBUG_ADDR": "0.0.0.0:9189",
|
||||
"USERLOG_DEBUG_ADDR": "0.0.0.0:9214",
|
||||
"USERS_DEBUG_ADDR": "0.0.0.0:9145",
|
||||
"WEB_DEBUG_ADDR": "0.0.0.0:9104",
|
||||
"WEBDAV_DEBUG_ADDR": "0.0.0.0:9119",
|
||||
"WEBFINGER_DEBUG_ADDR": "0.0.0.0:9279",
|
||||
}
|
||||
|
||||
|
||||
def wait_for(condition_fn, timeout: int, label: str, container: str = None) -> None:
|
||||
start = time.time()
|
||||
deadline = start + timeout
|
||||
last_log = start
|
||||
while not condition_fn():
|
||||
now = time.time()
|
||||
if now > deadline:
|
||||
elapsed = int(now - start)
|
||||
print(f"Timeout waiting for {label} after {elapsed}s", file=sys.stderr)
|
||||
# dump docker diagnostics — use explicit container name if provided
|
||||
cname = container or label
|
||||
for cmd in (
|
||||
["docker", "ps", "-a", "--filter", f"name={cname}", "--no-trunc"],
|
||||
["docker", "logs", "--tail", "50", cname],
|
||||
):
|
||||
r = subprocess.run(cmd, capture_output=True, text=True)
|
||||
if r.stdout.strip():
|
||||
print(f"--- {' '.join(cmd)} ---", file=sys.stderr)
|
||||
print(r.stdout, file=sys.stderr)
|
||||
if r.stderr.strip():
|
||||
print(r.stderr, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
if now - last_log >= 30:
|
||||
print(f" Waiting for {label}... {int(now - start)}s")
|
||||
last_log = now
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def ocis_healthy(ocis_url: str) -> bool:
|
||||
r = subprocess.run(
|
||||
["curl", "-sk", "-uadmin:admin",
|
||||
f"{ocis_url}/graph/v1.0/users/admin",
|
||||
"-w", "%{http_code}", "-o", "/dev/null"],
|
||||
capture_output=True, text=True,
|
||||
)
|
||||
return r.stdout.strip() == "200"
|
||||
|
||||
|
||||
def mailpit_healthy() -> bool:
|
||||
return subprocess.run(
|
||||
["curl", "-sf", "http://localhost:8025/api/v1/messages"],
|
||||
capture_output=True,
|
||||
).returncode == 0
|
||||
|
||||
|
||||
def tika_healthy() -> bool:
|
||||
return subprocess.run(
|
||||
["curl", "-sf", "http://localhost:9998"],
|
||||
capture_output=True,
|
||||
).returncode == 0
|
||||
|
||||
|
||||
def _tcp_ready(host: str, port: int) -> bool:
|
||||
"""Check if a TCP port is accepting connections."""
|
||||
import socket
|
||||
try:
|
||||
with socket.create_connection((host, port), timeout=2):
|
||||
return True
|
||||
except (ConnectionRefusedError, OSError):
|
||||
return False
|
||||
|
||||
|
||||
def clamav_healthy() -> bool:
|
||||
return _tcp_ready("localhost", 3310)
|
||||
|
||||
|
||||
|
||||
def load_env_file(path: Path) -> dict:
|
||||
"""Parse a bash-style env file (export KEY=value) into a dict."""
|
||||
env = {}
|
||||
for line in path.read_text().splitlines():
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#") or line.startswith("!"):
|
||||
continue
|
||||
line = line.removeprefix("export ").strip()
|
||||
if "=" in line:
|
||||
k, v = line.split("=", 1)
|
||||
env[k.strip()] = v.strip()
|
||||
return env
|
||||
|
||||
|
||||
def run(cmd: list, env: dict = None, check: bool = True):
|
||||
e = {**os.environ, **(env or {})}
|
||||
return subprocess.run(cmd, env=e, check=check)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
behat_suites_raw = os.environ.get("BEHAT_SUITES", "").strip()
|
||||
if not behat_suites_raw:
|
||||
print("BEHAT_SUITES is required", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
suites = [s.strip() for s in behat_suites_raw.split(",") if s.strip()]
|
||||
acceptance_test_type = os.environ.get("ACCEPTANCE_TEST_TYPE", "api")
|
||||
|
||||
repo_root = Path(__file__).resolve().parents[2]
|
||||
ocis_bin = repo_root / "ocis/bin/ocis"
|
||||
wrapper_bin = repo_root / "tests/ociswrapper/bin/ociswrapper"
|
||||
ocis_url = "https://localhost:9200"
|
||||
ocis_config_dir = Path.home() / ".ocis/config"
|
||||
|
||||
ocis_fed_url = "https://localhost:10200"
|
||||
|
||||
cfg = merged_config(suites)
|
||||
print(f"Suites: {suites}")
|
||||
print(f"Services: email={cfg['emailNeeded']} tika={cfg['tikaNeeded']} "
|
||||
f"antivirus={cfg['antivirusNeeded']} federation={cfg['federationServer']} "
|
||||
f"wopi={cfg['collaborationServiceNeeded']}")
|
||||
|
||||
# generate IDP web assets (required for IDP service to start; matches drone ci-node-generate)
|
||||
run(["make", "-C", str(repo_root / "services/idp"), "ci-node-generate"])
|
||||
# download web UI assets (required for robots.txt and other static assets; no pnpm needed)
|
||||
run(["make", "-C", str(repo_root / "services/web"), "ci-node-generate"])
|
||||
|
||||
# build (ENABLE_VIPS=true when libvips-dev is installed, matching drone)
|
||||
build_env = {}
|
||||
if subprocess.run(["pkg-config", "--exists", "vips"],
|
||||
capture_output=True).returncode == 0:
|
||||
build_env["ENABLE_VIPS"] = "true"
|
||||
run(["make", "-C", str(repo_root / "ocis"), "build"], env=build_env)
|
||||
run(["make", "-C", str(repo_root / "tests/ociswrapper"), "build"],
|
||||
env={"GOWORK": "off"})
|
||||
|
||||
# php deps
|
||||
run(["composer", "install", "--no-progress"],
|
||||
env={"COMPOSER_NO_INTERACTION": "1", "COMPOSER_NO_AUDIT": "1"})
|
||||
run(["composer", "bin", "behat", "install", "--no-progress"],
|
||||
env={"COMPOSER_NO_INTERACTION": "1", "COMPOSER_NO_AUDIT": "1"})
|
||||
|
||||
# optional services
|
||||
procs = []
|
||||
|
||||
if cfg["emailNeeded"]:
|
||||
print("Starting mailpit...")
|
||||
run(["docker", "run", "-d", "--name", "mailpit", "--network", "host",
|
||||
"axllent/mailpit:v1.22.3"])
|
||||
wait_for(mailpit_healthy, 60, "mailpit")
|
||||
print("mailpit ready.")
|
||||
|
||||
if cfg["antivirusNeeded"]:
|
||||
print("Starting clamav...")
|
||||
run(["docker", "run", "-d", "--name", "clamav", "--network", "host",
|
||||
"owncloudci/clamavd"])
|
||||
wait_for(clamav_healthy, 300, "clamav")
|
||||
print("clamav ready.")
|
||||
# override socket: drone uses container DNS "clamav", we use localhost
|
||||
cfg["extraServerEnvironment"]["ANTIVIRUS_CLAMAV_SOCKET"] = "tcp://localhost:3310"
|
||||
|
||||
if cfg["tikaNeeded"]:
|
||||
print("Starting tika...")
|
||||
run(["docker", "run", "-d", "--name", "tika", "--network", "host",
|
||||
"apache/tika:3.2.2.0-full"])
|
||||
wait_for(tika_healthy, 120, "tika")
|
||||
print("tika ready.")
|
||||
|
||||
# OCM federation: rewrite providers.json with localhost URLs
|
||||
if cfg["federationServer"]:
|
||||
providers_src = repo_root / "tests/config/drone/providers.json"
|
||||
providers = json.loads(providers_src.read_text())
|
||||
for p in providers:
|
||||
# replace container DNS names with localhost
|
||||
p["domain"] = p["domain"].replace("ocis-server:9200", "localhost:9200")
|
||||
p["domain"] = p["domain"].replace("federation-ocis-server:10200", "localhost:10200")
|
||||
for svc in p.get("services", []):
|
||||
ep = svc.get("endpoint", {})
|
||||
ep["path"] = ep.get("path", "").replace("ocis-server:9200", "localhost:9200")
|
||||
ep["path"] = ep.get("path", "").replace("federation-ocis-server:10200", "localhost:10200")
|
||||
svc["host"] = svc.get("host", "").replace("ocis-server:9200", "localhost:9200")
|
||||
svc["host"] = svc.get("host", "").replace("federation-ocis-server:10200", "localhost:10200")
|
||||
providers_tmp = tempfile.NamedTemporaryFile(
|
||||
mode="w", suffix=".json", prefix="ocm-providers-", delete=False)
|
||||
json.dump(providers, providers_tmp)
|
||||
providers_tmp.close()
|
||||
cfg["extraServerEnvironment"]["OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE"] = providers_tmp.name
|
||||
|
||||
# init ocis
|
||||
run([str(ocis_bin), "init", "--insecure", "true"])
|
||||
shutil.copy(
|
||||
repo_root / "tests/config/drone/app-registry.yaml",
|
||||
ocis_config_dir / "app-registry.yaml",
|
||||
)
|
||||
|
||||
# generate fontsMap.json with correct font path (drone hardcodes /drone/src/...)
|
||||
font_path = str(repo_root / "tests/config/drone/NotoSans.ttf")
|
||||
fontmap_tmp = tempfile.NamedTemporaryFile(
|
||||
mode="w", suffix=".json", prefix="fontsMap-", delete=False)
|
||||
json.dump({"defaultFont": font_path}, fontmap_tmp)
|
||||
fontmap_tmp.close()
|
||||
|
||||
# assemble ocis server env
|
||||
server_env = {**os.environ}
|
||||
server_env.update(base_server_env(repo_root, ocis_url, str(ocis_config_dir)))
|
||||
server_env["THUMBNAILS_TXT_FONTMAP_FILE"] = fontmap_tmp.name
|
||||
server_env.update(cfg["extraServerEnvironment"])
|
||||
|
||||
# start ociswrapper (primary ocis)
|
||||
print("Starting ocis...")
|
||||
wrapper_proc = subprocess.Popen(
|
||||
[str(wrapper_bin), "serve",
|
||||
"--bin", str(ocis_bin),
|
||||
"--url", ocis_url,
|
||||
"--admin-username", "admin",
|
||||
"--admin-password", "admin"],
|
||||
env=server_env,
|
||||
)
|
||||
procs.append(wrapper_proc)
|
||||
|
||||
# start federation ocis server (second instance on port 10200)
|
||||
if cfg["federationServer"]:
|
||||
fed_config_dir = Path.home() / ".ocis-federation/config"
|
||||
fed_config_dir.mkdir(parents=True, exist_ok=True)
|
||||
fed_data_dir = Path.home() / ".ocis-federation"
|
||||
|
||||
fed_env = {**os.environ}
|
||||
fed_env.update(base_server_env(repo_root, ocis_fed_url, str(fed_config_dir)))
|
||||
fed_env.update(cfg["extraServerEnvironment"])
|
||||
# load federation port mappings from canonical env file (single source of truth)
|
||||
fed_env.update(load_env_file(repo_root / "tests/config/local/.env-federation"))
|
||||
# CI-specific overrides
|
||||
fed_env.update({
|
||||
"OCIS_URL": ocis_fed_url,
|
||||
"OCIS_BASE_DATA_PATH": str(fed_data_dir),
|
||||
"OCIS_CONFIG_DIR": str(fed_config_dir),
|
||||
"OCIS_RUNTIME_PORT": "10250",
|
||||
"MICRO_REGISTRY_ADDRESS": "127.0.0.1:10233",
|
||||
})
|
||||
|
||||
# init federation ocis with separate config
|
||||
run([str(ocis_bin), "init", "--insecure", "true",
|
||||
"--config-path", str(fed_config_dir)])
|
||||
shutil.copy(
|
||||
repo_root / "tests/config/drone/app-registry.yaml",
|
||||
fed_config_dir / "app-registry.yaml",
|
||||
)
|
||||
|
||||
print("Starting federation ocis...")
|
||||
fed_proc = subprocess.Popen(
|
||||
[str(ocis_bin), "server"],
|
||||
env=fed_env,
|
||||
)
|
||||
procs.append(fed_proc)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Collaboration service helpers — same names/call pattern as drone.star
|
||||
# Only deviation: container hostnames → localhost
|
||||
# ---------------------------------------------------------------------------
|
||||
def fakeOffice():
|
||||
# drone: OC_CI_ALPINE container running serve-hosting-discovery.sh with repo at /drone/src
|
||||
# use same image so BusyBox nc (not OpenBSD nc) handles FIN correctly on stdin EOF
|
||||
run(["docker", "run", "-d", "--name", "fakeoffice", "--network", "host",
|
||||
"-v", f"{repo_root}:/drone/src:ro",
|
||||
"owncloudci/alpine:latest",
|
||||
"sh", "/drone/src/tests/config/drone/serve-hosting-discovery.sh"])
|
||||
return []
|
||||
|
||||
def collaboraService():
|
||||
# drone commands copy-pasted verbatim
|
||||
run(["docker", "run", "-d", "--name", "collabora", "--network", "host",
|
||||
"-e", "DONT_GEN_SSL_CERT=set",
|
||||
"-e", f"extra_params=--o:ssl.enable=true --o:ssl.termination=true "
|
||||
f"--o:welcome.enable=false --o:net.frame_ancestors=https://localhost:9200",
|
||||
"--entrypoint", "/bin/sh",
|
||||
"collabora/code:24.04.5.1.1",
|
||||
"-c", "\n".join([
|
||||
"set -e",
|
||||
"coolconfig generate-proof-key",
|
||||
"bash /start-collabora-online.sh",
|
||||
])])
|
||||
return []
|
||||
|
||||
def onlyofficeService():
|
||||
# GitHub runner ships PostgreSQL pre-started on 5432.
|
||||
# OnlyOffice supervisord starts its own PostgreSQL on 5432 internally.
|
||||
# With --network host both compete for the same port → OnlyOffice DB never
|
||||
# starts → docservice stays down → nginx returns 502 forever.
|
||||
# Drone avoids this because each service has its own network namespace.
|
||||
subprocess.run(["sudo", "systemctl", "stop", "postgresql"],
|
||||
capture_output=True)
|
||||
only_office_json = repo_root / "tests/config/drone/only-office.json"
|
||||
run(["docker", "run", "-d", "--name", "onlyoffice", "--network", "host",
|
||||
"-e", "WOPI_ENABLED=true",
|
||||
"-e", "USE_UNAUTHORIZED_STORAGE=true",
|
||||
"-v", f"{only_office_json}:/tmp/only-office.json:ro",
|
||||
"--entrypoint", "/bin/sh",
|
||||
"onlyoffice/documentserver:9.0.0",
|
||||
"-c", "\n".join([
|
||||
"set -e",
|
||||
"cp /tmp/only-office.json /etc/onlyoffice/documentserver/local.json",
|
||||
"openssl req -x509 -newkey rsa:4096 -keyout onlyoffice.key -out onlyoffice.crt -sha256 -days 365 -batch -nodes",
|
||||
"mkdir -p /var/www/onlyoffice/Data/certs",
|
||||
"cp onlyoffice.key /var/www/onlyoffice/Data/certs/",
|
||||
"cp onlyoffice.crt /var/www/onlyoffice/Data/certs/",
|
||||
"chmod 400 /var/www/onlyoffice/Data/certs/onlyoffice.key",
|
||||
"/app/ds/run-document-server.sh",
|
||||
])])
|
||||
return []
|
||||
|
||||
def wopiCollaborationService(name, ocis_url=ocis_url):
|
||||
# drone: startOcisService("collaboration", "wopi-{name}", environment)
|
||||
# runs: ocis/bin/ocis-debug collaboration server
|
||||
service_name = "wopi-%s" % name
|
||||
ports = _WOPI_PORTS[name]
|
||||
environment = {
|
||||
**os.environ,
|
||||
"OCIS_URL": ocis_url,
|
||||
"MICRO_REGISTRY": "nats-js-kv",
|
||||
"MICRO_REGISTRY_ADDRESS": "localhost:9233",
|
||||
"COLLABORATION_LOG_LEVEL": "debug",
|
||||
"COLLABORATION_GRPC_ADDR": f"0.0.0.0:{ports['grpc']}",
|
||||
"COLLABORATION_HTTP_ADDR": f"0.0.0.0:{ports['http']}",
|
||||
"COLLABORATION_DEBUG_ADDR": f"0.0.0.0:{ports['debug']}",
|
||||
"COLLABORATION_APP_PROOF_DISABLE": "true",
|
||||
"COLLABORATION_APP_INSECURE": "true",
|
||||
"COLLABORATION_CS3API_DATAGATEWAY_INSECURE": "true",
|
||||
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
|
||||
"COLLABORATION_WOPI_SECRET": "some-wopi-secret",
|
||||
}
|
||||
if name == "collabora":
|
||||
environment["COLLABORATION_APP_NAME"] = "Collabora"
|
||||
environment["COLLABORATION_APP_PRODUCT"] = "Collabora"
|
||||
environment["COLLABORATION_APP_ADDR"] = "https://localhost:9980"
|
||||
environment["COLLABORATION_APP_ICON"] = "https://localhost:9980/favicon.ico"
|
||||
elif name == "onlyoffice":
|
||||
environment["COLLABORATION_APP_NAME"] = "OnlyOffice"
|
||||
environment["COLLABORATION_APP_PRODUCT"] = "OnlyOffice"
|
||||
environment["COLLABORATION_APP_ADDR"] = "https://localhost:443"
|
||||
environment["COLLABORATION_APP_ICON"] = "https://localhost:443/web-apps/apps/documenteditor/main/resources/img/favicon.ico"
|
||||
elif name == "fakeoffice":
|
||||
environment["COLLABORATION_APP_NAME"] = "FakeOffice"
|
||||
environment["COLLABORATION_APP_PRODUCT"] = "Microsoft"
|
||||
environment["COLLABORATION_APP_ADDR"] = "http://localhost:8080"
|
||||
environment["COLLABORATION_WOPI_SRC"] = f"http://localhost:{ports['http']}"
|
||||
print(f"Starting {service_name}...")
|
||||
return [subprocess.Popen([str(ocis_bin), "collaboration", "server"], env=environment)]
|
||||
|
||||
def ocisHealthCheck(name, services=[]):
|
||||
# drone: curl healthz + readyz on each service (timeout 300s)
|
||||
for service in services:
|
||||
host, port = service.rsplit(":", 1)
|
||||
for endpoint in ("healthz", "readyz"):
|
||||
wait_for(
|
||||
lambda h="localhost", p=int(port), ep=endpoint: subprocess.run(
|
||||
["curl", "-sf", f"http://{h}:{p}/{ep}"], capture_output=True
|
||||
).returncode == 0,
|
||||
300, f"{service}/{endpoint}",
|
||||
)
|
||||
print(f"health-check-{name}: all services healthy.")
|
||||
|
||||
def wopi_discovery_ready(app_url: str) -> bool:
|
||||
"""Return True once the WOPI app's /hosting/discovery returns HTTP 200."""
|
||||
url = app_url.rstrip("/") + "/hosting/discovery"
|
||||
r = subprocess.run(
|
||||
["curl", "-sfk", url], capture_output=True
|
||||
)
|
||||
return r.returncode == 0
|
||||
|
||||
# drone.star non-k8s collaborationServiceNeeded path (lines 1195-1196, 1140-1141, 1179-1183)
|
||||
if cfg["collaborationServiceNeeded"]:
|
||||
procs += fakeOffice() + collaboraService() + onlyofficeService()
|
||||
# Wait for each app's /hosting/discovery to return 200 before starting its
|
||||
# collaboration service. GetAppURLs in server.go calls discovery synchronously
|
||||
# at startup — non-200 exits the process immediately, healthz never binds.
|
||||
wait_for(lambda: wopi_discovery_ready("http://localhost:8080"), 300, "fakeoffice discovery", container="fakeoffice")
|
||||
wait_for(lambda: wopi_discovery_ready("https://localhost:9980"), 300, "collabora discovery", container="collabora")
|
||||
wait_for(lambda: wopi_discovery_ready("https://localhost:443"), 300, "onlyoffice discovery", container="onlyoffice")
|
||||
procs += wopiCollaborationService("fakeoffice") + \
|
||||
wopiCollaborationService("collabora") + \
|
||||
wopiCollaborationService("onlyoffice")
|
||||
ocisHealthCheck("wopi", [
|
||||
f"localhost:{_WOPI_PORTS['collabora']['debug']}",
|
||||
f"localhost:{_WOPI_PORTS['onlyoffice']['debug']}",
|
||||
f"localhost:{_WOPI_PORTS['fakeoffice']['debug']}",
|
||||
])
|
||||
|
||||
def cleanup(*_):
|
||||
for p in procs:
|
||||
try:
|
||||
p.terminate()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
signal.signal(signal.SIGTERM, cleanup)
|
||||
signal.signal(signal.SIGINT, cleanup)
|
||||
|
||||
try:
|
||||
wait_for(lambda: ocis_healthy(ocis_url), 300, "ocis")
|
||||
print("ocis ready.")
|
||||
|
||||
if cfg["federationServer"]:
|
||||
wait_for(lambda: ocis_healthy(ocis_fed_url), 300, "federation ocis")
|
||||
print("federation ocis ready.")
|
||||
|
||||
# expected failures file
|
||||
if acceptance_test_type == "core-api":
|
||||
filter_tags = "~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
|
||||
base_failures = repo_root / "tests/acceptance/expected-failures-API-on-OCIS-storage.md"
|
||||
else:
|
||||
filter_tags = "~@skip&&~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
|
||||
base_failures = repo_root / "tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md"
|
||||
|
||||
ef_override = os.environ.get("EXPECTED_FAILURES_FILE")
|
||||
if ef_override:
|
||||
p = Path(ef_override)
|
||||
base_failures = p if p.is_absolute() else repo_root / p
|
||||
|
||||
# merge expected-failures-without-remotephp.md only when not using remote.php
|
||||
# (mirrors drone.star: "" if run_with_remote_php else "cat ...without-remotephp.md >> ...")
|
||||
tmp = tempfile.NamedTemporaryFile(mode="w", suffix=".md", delete=False)
|
||||
tmp.write(base_failures.read_text())
|
||||
if os.environ.get("WITH_REMOTE_PHP", "false").lower() != "true":
|
||||
without_rphp = repo_root / "tests/acceptance/expected-failures-without-remotephp.md"
|
||||
if without_rphp.exists():
|
||||
tmp.write("\n")
|
||||
tmp.write(without_rphp.read_text())
|
||||
tmp.close()
|
||||
|
||||
# run tests
|
||||
behat_env = {
|
||||
**os.environ,
|
||||
"TEST_SERVER_URL": ocis_url,
|
||||
"TEST_SERVER_FED_URL": ocis_fed_url,
|
||||
"OCIS_WRAPPER_URL": "http://localhost:5200",
|
||||
"BEHAT_SUITES": behat_suites_raw,
|
||||
"ACCEPTANCE_TEST_TYPE": acceptance_test_type,
|
||||
"BEHAT_FILTER_TAGS": filter_tags,
|
||||
"EXPECTED_FAILURES_FILE": tmp.name,
|
||||
"STORAGE_DRIVER": "ocis",
|
||||
"UPLOAD_DELETE_WAIT_TIME": "0",
|
||||
"EMAIL_HOST": "localhost",
|
||||
"EMAIL_PORT": EMAIL_PORT,
|
||||
"COLLABORATION_SERVICE_URL": f"http://localhost:{_WOPI_PORTS['fakeoffice']['http']}",
|
||||
}
|
||||
behat_env.update(cfg["extraEnvironment"])
|
||||
|
||||
print(f"Running suites: {behat_suites_raw} (type: {acceptance_test_type})")
|
||||
result = subprocess.run(
|
||||
["make", "-C", str(repo_root), "test-acceptance-api"],
|
||||
env=behat_env,
|
||||
)
|
||||
return result.returncode
|
||||
|
||||
finally:
|
||||
cleanup()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -1,244 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Run litmus WebDAV compliance tests locally and in GitHub Actions CI.
|
||||
|
||||
Config sourced from .drone.star litmus() / setupForLitmus() — single source of truth.
|
||||
Usage: python3 tests/acceptance/run-litmus.py
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Constants (mirroring .drone.star)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# HTTPS — matching drone: ocis init generates a self-signed cert; proxy uses TLS by default.
|
||||
# Host-side curl calls use -k (insecure) to skip cert verification.
|
||||
OCIS_URL = "https://127.0.0.1:9200"
|
||||
LITMUS_IMAGE = "owncloudci/litmus:latest"
|
||||
LITMUS_TESTS = "basic copymove props http"
|
||||
SHARE_ENDPOINT = "ocs/v2.php/apps/files_sharing/api/v1/shares"
|
||||
|
||||
|
||||
def get_docker_bridge_ip() -> str:
|
||||
"""Return the Docker bridge gateway IP, reachable from host and Docker containers."""
|
||||
r = subprocess.run(
|
||||
["docker", "network", "inspect", "bridge",
|
||||
"--format", "{{range .IPAM.Config}}{{.Gateway}}{{end}}"],
|
||||
capture_output=True, text=True, check=True,
|
||||
)
|
||||
return r.stdout.strip()
|
||||
|
||||
|
||||
def base_server_env(repo_root: Path, ocis_config_dir: str, ocis_public_url: str) -> dict:
|
||||
"""OCIS server environment matching drone ocisServer() for litmus."""
|
||||
return {
|
||||
"OCIS_URL": ocis_public_url,
|
||||
"OCIS_CONFIG_DIR": ocis_config_dir,
|
||||
"STORAGE_USERS_DRIVER": "ocis",
|
||||
"PROXY_ENABLE_BASIC_AUTH": "true",
|
||||
# No PROXY_TLS override — drone lets ocis use its default TLS (self-signed cert from init)
|
||||
# IDP excluded: its static assets are absent when running as a host process
|
||||
"OCIS_EXCLUDE_RUN_SERVICES": "idp",
|
||||
"OCIS_LOG_LEVEL": "error",
|
||||
"IDM_CREATE_DEMO_USERS": "true",
|
||||
"IDM_ADMIN_PASSWORD": "admin",
|
||||
"FRONTEND_SEARCH_MIN_LENGTH": "2",
|
||||
"OCIS_ASYNC_UPLOADS": "true",
|
||||
"OCIS_EVENTS_ENABLE_TLS": "false",
|
||||
"NATS_NATS_HOST": "0.0.0.0",
|
||||
"NATS_NATS_PORT": "9233",
|
||||
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
|
||||
"EVENTHISTORY_STORE": "memory",
|
||||
"WEB_UI_CONFIG_FILE": str(repo_root / "tests/config/drone/ocis-config.json"),
|
||||
}
|
||||
|
||||
|
||||
def wait_for(condition_fn, timeout: int, label: str) -> None:
|
||||
deadline = time.time() + timeout
|
||||
while not condition_fn():
|
||||
if time.time() > deadline:
|
||||
print(f"Timeout waiting for {label}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def ocis_healthy(ocis_url: str) -> bool:
|
||||
r = subprocess.run(
|
||||
["curl", "-sk", "-uadmin:admin",
|
||||
f"{ocis_url}/graph/v1.0/users/admin",
|
||||
"-w", "%{http_code}", "-o", "/dev/null"],
|
||||
capture_output=True, text=True,
|
||||
)
|
||||
return r.stdout.strip() == "200"
|
||||
|
||||
|
||||
def setup_for_litmus(ocis_url: str) -> tuple:
|
||||
"""
|
||||
Translate tests/config/drone/setup-for-litmus.sh to Python.
|
||||
Returns (space_id, public_token).
|
||||
"""
|
||||
# get personal space ID
|
||||
r = subprocess.run(
|
||||
["curl", "-sk", "-uadmin:admin", f"{ocis_url}/graph/v1.0/me/drives"],
|
||||
capture_output=True, text=True, check=True,
|
||||
)
|
||||
drives = json.loads(r.stdout)
|
||||
space_id = ""
|
||||
for drive in drives.get("value", []):
|
||||
if drive.get("driveType") == "personal":
|
||||
web_dav_url = drive.get("root", {}).get("webDavUrl", "")
|
||||
# last non-empty path segment (same as cut -d"/" -f6 in bash)
|
||||
space_id = [p for p in web_dav_url.split("/") if p][-1]
|
||||
break
|
||||
if not space_id:
|
||||
print("ERROR: could not determine personal space ID", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print(f"SPACE_ID={space_id}")
|
||||
|
||||
# create test folder as einstein
|
||||
subprocess.run(
|
||||
["curl", "-sk", "-ueinstein:relativity", "-X", "MKCOL",
|
||||
f"{ocis_url}/remote.php/webdav/new_folder"],
|
||||
capture_output=True, check=True,
|
||||
)
|
||||
|
||||
# create share from einstein to admin
|
||||
r = subprocess.run(
|
||||
["curl", "-sk", "-ueinstein:relativity",
|
||||
f"{ocis_url}/{SHARE_ENDPOINT}",
|
||||
"-d", "path=/new_folder&shareType=0&permissions=15&name=new_folder&shareWith=admin"],
|
||||
capture_output=True, text=True, check=True,
|
||||
)
|
||||
share_id_match = re.search(r"<id>(.+?)</id>", r.stdout)
|
||||
if share_id_match:
|
||||
share_id = share_id_match.group(1)
|
||||
# accept the share as admin
|
||||
subprocess.run(
|
||||
["curl", "-X", "POST", "-sk", "-uadmin:admin",
|
||||
f"{ocis_url}/{SHARE_ENDPOINT}/pending/{share_id}"],
|
||||
capture_output=True, check=True,
|
||||
)
|
||||
|
||||
# create public share as einstein
|
||||
r = subprocess.run(
|
||||
["curl", "-sk", "-ueinstein:relativity",
|
||||
f"{ocis_url}/{SHARE_ENDPOINT}",
|
||||
"-d", "path=/new_folder&shareType=3&permissions=15&name=new_folder"],
|
||||
capture_output=True, text=True, check=True,
|
||||
)
|
||||
public_token = ""
|
||||
token_match = re.search(r"<token>(.+?)</token>", r.stdout)
|
||||
if token_match:
|
||||
public_token = token_match.group(1)
|
||||
print(f"PUBLIC_TOKEN={public_token}")
|
||||
|
||||
return space_id, public_token
|
||||
|
||||
|
||||
def run_litmus(name: str, endpoint: str) -> int:
|
||||
print(f"\nTesting endpoint [{name}]: {endpoint}", flush=True)
|
||||
result = subprocess.run(
|
||||
["docker", "run", "--rm",
|
||||
"-e", f"LITMUS_URL={endpoint}",
|
||||
"-e", "LITMUS_USERNAME=admin",
|
||||
"-e", "LITMUS_PASSWORD=admin",
|
||||
"-e", f"TESTS={LITMUS_TESTS}",
|
||||
LITMUS_IMAGE,
|
||||
# No extra CMD — ENTRYPOINT is already litmus-wrapper; passing it again
|
||||
# would make the wrapper use the path as LITMUS_URL, overriding the env var.
|
||||
],
|
||||
)
|
||||
return result.returncode
|
||||
|
||||
|
||||
def main() -> int:
|
||||
repo_root = Path(__file__).resolve().parents[2]
|
||||
ocis_bin = repo_root / "ocis/bin/ocis"
|
||||
ocis_config_dir = Path.home() / ".ocis/config"
|
||||
|
||||
# build (matching drone: restores binary from cache, then runs ocis server directly)
|
||||
subprocess.run(["make", "-C", str(repo_root / "ocis"), "build"], check=True)
|
||||
|
||||
# Docker bridge gateway IP: reachable from both the host (via docker0 interface)
|
||||
# and Docker containers (via bridge network default gateway). Use this as OCIS_URL
|
||||
# so that any redirects OCIS generates stay on a hostname the litmus container
|
||||
# can follow — matching how drone uses "ocis-server:9200" consistently.
|
||||
# HTTPS: owncloudci/litmus accepts insecure (self-signed) certs, just like drone does.
|
||||
bridge_ip = get_docker_bridge_ip()
|
||||
litmus_base = f"https://{bridge_ip}:9200"
|
||||
print(f"Docker bridge IP: {bridge_ip}", flush=True)
|
||||
|
||||
# assemble server env first — same env vars drone sets on the container before
|
||||
# running `ocis init`, so IDM_ADMIN_PASSWORD=admin is present during init and
|
||||
# the config is written with the correct password (not a random one)
|
||||
server_env = {**os.environ}
|
||||
server_env.update(base_server_env(repo_root, str(ocis_config_dir), litmus_base))
|
||||
|
||||
# init ocis with full server env (mirrors drone: env is set before ocis init runs)
|
||||
subprocess.run(
|
||||
[str(ocis_bin), "init", "--insecure", "true"],
|
||||
env=server_env,
|
||||
check=True,
|
||||
)
|
||||
shutil.copy(
|
||||
repo_root / "tests/config/drone/app-registry.yaml",
|
||||
ocis_config_dir / "app-registry.yaml",
|
||||
)
|
||||
|
||||
# start ocis server directly (matching drone: no ociswrapper for litmus)
|
||||
print("Starting ocis...", flush=True)
|
||||
ocis_proc = subprocess.Popen(
|
||||
[str(ocis_bin), "server"],
|
||||
env=server_env,
|
||||
)
|
||||
|
||||
def cleanup(*_):
|
||||
try:
|
||||
ocis_proc.terminate()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
signal.signal(signal.SIGTERM, cleanup)
|
||||
signal.signal(signal.SIGINT, cleanup)
|
||||
|
||||
try:
|
||||
wait_for(lambda: ocis_healthy(OCIS_URL), 300, "ocis")
|
||||
print("ocis ready.", flush=True)
|
||||
|
||||
space_id, _ = setup_for_litmus(OCIS_URL)
|
||||
|
||||
endpoints = [
|
||||
("old-endpoint", f"{litmus_base}/remote.php/webdav"),
|
||||
("new-endpoint", f"{litmus_base}/remote.php/dav/files/admin"),
|
||||
("new-shared", f"{litmus_base}/remote.php/dav/files/admin/Shares/new_folder/"),
|
||||
("old-shared", f"{litmus_base}/remote.php/webdav/Shares/new_folder/"),
|
||||
("spaces-endpoint", f"{litmus_base}/remote.php/dav/spaces/{space_id}"),
|
||||
]
|
||||
|
||||
failed = []
|
||||
for name, endpoint in endpoints:
|
||||
rc = run_litmus(name, endpoint)
|
||||
if rc != 0:
|
||||
failed.append(name)
|
||||
|
||||
if failed:
|
||||
print(f"\nFailed endpoints: {', '.join(failed)}", file=sys.stderr)
|
||||
return 1
|
||||
print("\nAll litmus tests passed.")
|
||||
return 0
|
||||
|
||||
finally:
|
||||
cleanup()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -1,375 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Run WOPI validator tests locally and in GitHub Actions CI.
|
||||
|
||||
Config sourced from .drone.star wopiValidatorTests() — single source of truth.
|
||||
Usage: python3 tests/acceptance/run-wopi.py --type builtin
|
||||
python3 tests/acceptance/run-wopi.py --type cs3
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import urllib.parse
|
||||
from pathlib import Path
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Constants (mirroring .drone.star)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# HTTPS — matching drone; host-side curl calls use -k.
|
||||
OCIS_URL = "https://127.0.0.1:9200"
|
||||
VALIDATOR_IMAGE = "owncloudci/wopi-validator"
|
||||
CS3_WOPI_IMAGE = "cs3org/wopiserver:v10.4.0"
|
||||
FAKEOFFICE_IMAGE = "owncloudci/alpine:latest"
|
||||
|
||||
# Testgroups shared between both variants (drone: testgroups list)
|
||||
SHARED_TESTGROUPS = [
|
||||
"BaseWopiViewing",
|
||||
"CheckFileInfoSchema",
|
||||
"EditFlows",
|
||||
"Locks",
|
||||
"AccessTokens",
|
||||
"GetLock",
|
||||
"ExtendedLockLength",
|
||||
"FileVersion",
|
||||
"Features",
|
||||
]
|
||||
|
||||
# Testgroups only run for builtin (drone: builtinOnlyTestGroups, with -s flag)
|
||||
BUILTIN_ONLY_TESTGROUPS = [
|
||||
"PutRelativeFile",
|
||||
"RenameFileIfCreateChildFileIsNotSupported",
|
||||
]
|
||||
|
||||
|
||||
def get_docker_bridge_ip() -> str:
|
||||
r = subprocess.run(
|
||||
["docker", "network", "inspect", "bridge",
|
||||
"--format", "{{range .IPAM.Config}}{{.Gateway}}{{end}}"],
|
||||
capture_output=True, text=True, check=True,
|
||||
)
|
||||
return r.stdout.strip()
|
||||
|
||||
|
||||
def wait_for(condition_fn, timeout: int, label: str) -> None:
|
||||
deadline = time.time() + timeout
|
||||
while not condition_fn():
|
||||
if time.time() > deadline:
|
||||
print(f"Timeout waiting for {label}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def ocis_healthy(ocis_url: str) -> bool:
|
||||
r = subprocess.run(
|
||||
["curl", "-sk", "-uadmin:admin",
|
||||
f"{ocis_url}/graph/v1.0/users/admin",
|
||||
"-w", "%{http_code}", "-o", "/dev/null"],
|
||||
capture_output=True, text=True,
|
||||
)
|
||||
return r.stdout.strip() == "200"
|
||||
|
||||
|
||||
def tcp_reachable(host: str, port: int) -> bool:
|
||||
try:
|
||||
with socket.create_connection((host, port), timeout=1):
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
def wopi_discovery_ready(url: str) -> bool:
|
||||
r = subprocess.run(
|
||||
["curl", "-sk", "-o", "/dev/null", "-w", "%{http_code}", url],
|
||||
capture_output=True, text=True,
|
||||
)
|
||||
return r.stdout.strip() == "200"
|
||||
|
||||
|
||||
def base_server_env(repo_root: Path, ocis_config_dir: str, ocis_public_url: str,
|
||||
bridge_ip: str, wopi_type: str) -> dict:
|
||||
"""
|
||||
OCIS server environment matching drone ocisServer(deploy_type='wopi_validator').
|
||||
builtin: also excludes app-provider (collaboration service takes that role).
|
||||
"""
|
||||
exclude = "idp,app-provider" if wopi_type == "builtin" else "idp"
|
||||
return {
|
||||
"OCIS_URL": ocis_public_url,
|
||||
"OCIS_CONFIG_DIR": ocis_config_dir,
|
||||
"STORAGE_USERS_DRIVER": "ocis",
|
||||
"PROXY_ENABLE_BASIC_AUTH": "true",
|
||||
# No PROXY_TLS override — drone uses default TLS (self-signed cert from init)
|
||||
# IDP excluded: static assets absent when running as host process
|
||||
"OCIS_EXCLUDE_RUN_SERVICES": exclude,
|
||||
"OCIS_LOG_LEVEL": "error",
|
||||
"IDM_CREATE_DEMO_USERS": "true",
|
||||
"IDM_ADMIN_PASSWORD": "admin",
|
||||
"FRONTEND_SEARCH_MIN_LENGTH": "2",
|
||||
"OCIS_ASYNC_UPLOADS": "true",
|
||||
"OCIS_EVENTS_ENABLE_TLS": "false",
|
||||
"NATS_NATS_HOST": "0.0.0.0",
|
||||
"NATS_NATS_PORT": "9233",
|
||||
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
|
||||
"EVENTHISTORY_STORE": "memory",
|
||||
"WEB_UI_CONFIG_FILE": str(repo_root / "tests/config/drone/ocis-config.json"),
|
||||
# wopi_validator extras (drone ocisServer deploy_type="wopi_validator")
|
||||
"GATEWAY_GRPC_ADDR": "0.0.0.0:9142",
|
||||
"APP_PROVIDER_EXTERNAL_ADDR": "com.owncloud.api.app-provider",
|
||||
"APP_PROVIDER_DRIVER": "wopi",
|
||||
"APP_PROVIDER_WOPI_APP_NAME": "FakeOffice",
|
||||
"APP_PROVIDER_WOPI_APP_URL": f"http://{bridge_ip}:8080",
|
||||
"APP_PROVIDER_WOPI_INSECURE": "true",
|
||||
"APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL": f"http://{bridge_ip}:9300",
|
||||
"APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL": ocis_public_url,
|
||||
}
|
||||
|
||||
|
||||
def collab_service_env(bridge_ip: str, ocis_config_dir: str) -> dict:
|
||||
"""
|
||||
Environment for 'ocis collaboration server' (builtin wopi-fakeoffice).
|
||||
Mirrors drone wopiCollaborationService("fakeoffice").
|
||||
"""
|
||||
return {
|
||||
"OCIS_URL": f"https://{bridge_ip}:9200",
|
||||
"OCIS_CONFIG_DIR": ocis_config_dir,
|
||||
"MICRO_REGISTRY": "nats-js-kv",
|
||||
"MICRO_REGISTRY_ADDRESS": "127.0.0.1:9233",
|
||||
"COLLABORATION_LOG_LEVEL": "debug",
|
||||
"COLLABORATION_GRPC_ADDR": "0.0.0.0:9301",
|
||||
"COLLABORATION_HTTP_ADDR": "0.0.0.0:9300",
|
||||
"COLLABORATION_DEBUG_ADDR": "0.0.0.0:9304",
|
||||
"COLLABORATION_APP_PROOF_DISABLE": "true",
|
||||
"COLLABORATION_APP_INSECURE": "true",
|
||||
"COLLABORATION_CS3API_DATAGATEWAY_INSECURE": "true",
|
||||
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
|
||||
"COLLABORATION_WOPI_SECRET": "some-wopi-secret",
|
||||
"COLLABORATION_APP_NAME": "FakeOffice",
|
||||
"COLLABORATION_APP_PRODUCT": "Microsoft",
|
||||
"COLLABORATION_APP_ADDR": f"http://{bridge_ip}:8080",
|
||||
# COLLABORATION_WOPI_SRC is what OCIS tells clients to use — must be reachable
|
||||
# from Docker validator containers (collaboration service runs as host process)
|
||||
"COLLABORATION_WOPI_SRC": f"http://{bridge_ip}:9300",
|
||||
}
|
||||
|
||||
|
||||
def prepare_test_file(bridge_ip: str) -> tuple:
|
||||
"""
|
||||
Upload test.wopitest via WebDAV, open the WOPI app, extract credentials.
|
||||
Mirrors the prepare-test-file step from drone.star.
|
||||
Returns (access_token, access_token_ttl, wopi_src).
|
||||
"""
|
||||
headers_file = "/tmp/wopi-headers.txt"
|
||||
|
||||
# PUT empty test file (--retry-connrefused/--retry-all-errors matching drone)
|
||||
subprocess.run(
|
||||
["curl", "-sk", "-u", "admin:admin", "-X", "PUT",
|
||||
"--fail", "--retry-connrefused", "--retry", "7", "--retry-all-errors",
|
||||
f"{OCIS_URL}/remote.php/webdav/test.wopitest",
|
||||
"-D", headers_file],
|
||||
check=True,
|
||||
)
|
||||
|
||||
# Extract Oc-Fileid from response headers
|
||||
headers_text = Path(headers_file).read_text()
|
||||
print("--- PUT headers ---", flush=True)
|
||||
print(headers_text[:500], flush=True)
|
||||
m = re.search(r"Oc-Fileid:\s*(\S+)", headers_text, re.IGNORECASE)
|
||||
if not m:
|
||||
print("ERROR: Oc-Fileid not found in PUT response headers", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
file_id = m.group(1).strip()
|
||||
print(f"FILE_ID={file_id}", flush=True)
|
||||
|
||||
# POST to app/open to get WOPI access token and wopi src
|
||||
url = f"{OCIS_URL}/app/open?app_name=FakeOffice&file_id={urllib.parse.quote(file_id, safe='')}"
|
||||
r = subprocess.run(
|
||||
["curl", "-sk", "-u", "admin:admin", "-X", "POST",
|
||||
"--fail", "--retry-connrefused", "--retry", "7", "--retry-all-errors", url],
|
||||
capture_output=True, text=True, check=True,
|
||||
)
|
||||
open_json = json.loads(r.stdout)
|
||||
print(f"open.json: {r.stdout[:800]}", flush=True)
|
||||
|
||||
access_token = open_json["form_parameters"]["access_token"]
|
||||
access_token_ttl = str(open_json["form_parameters"]["access_token_ttl"])
|
||||
app_url = open_json.get("app_url", "")
|
||||
|
||||
# Construct wopi_src: drone extracts file ID from app_url after 'files%2F',
|
||||
# then prepends http://wopi-fakeoffice:9300/wopi/files/ — we use bridge_ip instead.
|
||||
wopi_base = f"http://{bridge_ip}:9300/wopi/files/"
|
||||
if "files%2F" in app_url:
|
||||
file_id_encoded = app_url.split("files%2F")[-1].strip().strip('"')
|
||||
elif "files/" in app_url:
|
||||
file_id_encoded = app_url.split("files/")[-1].strip().strip('"')
|
||||
else:
|
||||
file_id_encoded = urllib.parse.quote(file_id, safe="")
|
||||
wopi_src = wopi_base + file_id_encoded
|
||||
print(f"WOPI_SRC={wopi_src}", flush=True)
|
||||
|
||||
return access_token, access_token_ttl, wopi_src
|
||||
|
||||
|
||||
def run_validator(group: str, token: str, wopi_src: str, ttl: str,
|
||||
secure: bool = False) -> int:
|
||||
print(f"\nRunning testgroup [{group}] secure={secure}", flush=True)
|
||||
cmd = [
|
||||
"docker", "run", "--rm",
|
||||
"--workdir", "/app",
|
||||
"--entrypoint", "/app/Microsoft.Office.WopiValidator",
|
||||
VALIDATOR_IMAGE,
|
||||
]
|
||||
if secure:
|
||||
cmd.append("-s")
|
||||
cmd += ["-t", token, "-w", wopi_src, "-l", ttl, "--testgroup", group]
|
||||
return subprocess.run(cmd).returncode
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--type", choices=["builtin", "cs3"], required=True,
|
||||
help="WOPI server type: builtin (collaboration service) or cs3 (cs3org/wopiserver)")
|
||||
args = parser.parse_args()
|
||||
wopi_type = args.type
|
||||
|
||||
repo_root = Path(__file__).resolve().parents[2]
|
||||
ocis_bin = repo_root / "ocis/bin/ocis"
|
||||
ocis_config_dir = Path.home() / ".ocis/config"
|
||||
|
||||
subprocess.run(["make", "-C", str(repo_root / "ocis"), "build"], check=True)
|
||||
|
||||
bridge_ip = get_docker_bridge_ip()
|
||||
print(f"Docker bridge IP: {bridge_ip}", flush=True)
|
||||
|
||||
procs = []
|
||||
containers = []
|
||||
|
||||
def cleanup(*_):
|
||||
for p in procs:
|
||||
try:
|
||||
p.terminate()
|
||||
except Exception:
|
||||
pass
|
||||
for name in containers:
|
||||
subprocess.run(["docker", "rm", "-f", name], capture_output=True)
|
||||
|
||||
signal.signal(signal.SIGTERM, cleanup)
|
||||
signal.signal(signal.SIGINT, cleanup)
|
||||
|
||||
try:
|
||||
# --- fakeoffice: serves hosting-discovery.xml on :8080 ---
|
||||
# Mirrors drone fakeOffice() — owncloudci/alpine running serve-hosting-discovery.sh.
|
||||
# Repo is mounted at /drone/src (the path the script uses).
|
||||
containers.append("wopi-fakeoffice-fake")
|
||||
subprocess.run(["docker", "rm", "-f", "wopi-fakeoffice-fake"], capture_output=True)
|
||||
subprocess.run([
|
||||
"docker", "run", "-d", "--name", "wopi-fakeoffice-fake",
|
||||
"-p", "8080:8080",
|
||||
"-v", f"{repo_root}:/drone/src",
|
||||
FAKEOFFICE_IMAGE,
|
||||
"sh", "/drone/src/tests/config/drone/serve-hosting-discovery.sh",
|
||||
], check=True)
|
||||
|
||||
wait_for(lambda: tcp_reachable(bridge_ip, 8080), 60, "fakeoffice:8080")
|
||||
print("fakeoffice ready.", flush=True)
|
||||
|
||||
# --- Init and start OCIS ---
|
||||
ocis_public_url = f"https://{bridge_ip}:9200"
|
||||
server_env = {**os.environ}
|
||||
server_env.update(base_server_env(
|
||||
repo_root, str(ocis_config_dir), ocis_public_url, bridge_ip, wopi_type))
|
||||
|
||||
subprocess.run(
|
||||
[str(ocis_bin), "init", "--insecure", "true"],
|
||||
env=server_env, check=True,
|
||||
)
|
||||
shutil.copy(
|
||||
repo_root / "tests/config/drone/app-registry.yaml",
|
||||
ocis_config_dir / "app-registry.yaml",
|
||||
)
|
||||
|
||||
print("Starting ocis...", flush=True)
|
||||
ocis_proc = subprocess.Popen([str(ocis_bin), "server"], env=server_env)
|
||||
procs.append(ocis_proc)
|
||||
|
||||
wait_for(lambda: ocis_healthy(OCIS_URL), 300, "ocis")
|
||||
print("ocis ready.", flush=True)
|
||||
|
||||
# --- Wait for fakeoffice discovery endpoint before starting WOPI service ---
|
||||
# ocis collaboration server calls GetAppURLs synchronously at startup;
|
||||
# if /hosting/discovery returns non-200, the process exits immediately.
|
||||
wait_for(lambda: wopi_discovery_ready("http://127.0.0.1:8080/hosting/discovery"),
|
||||
300, "fakeoffice /hosting/discovery")
|
||||
print("fakeoffice discovery ready.", flush=True)
|
||||
|
||||
# --- Start wopi server (after OCIS is healthy so NATS/gRPC are up) ---
|
||||
if wopi_type == "builtin":
|
||||
# Run 'ocis collaboration server' as a host process.
|
||||
# Mirrors drone wopiCollaborationService("fakeoffice") → startOcisService("collaboration").
|
||||
collab_env = {**os.environ}
|
||||
collab_env.update(collab_service_env(bridge_ip, str(ocis_config_dir)))
|
||||
print("Starting collaboration service...", flush=True)
|
||||
collab_proc = subprocess.Popen(
|
||||
[str(ocis_bin), "collaboration", "server"],
|
||||
env=collab_env,
|
||||
)
|
||||
procs.append(collab_proc)
|
||||
else:
|
||||
# cs3: patch wopiserver.conf (replace container hostname with bridge_ip),
|
||||
# then run cs3org/wopiserver as a Docker container.
|
||||
conf_text = (repo_root / "tests/config/drone/wopiserver.conf").read_text()
|
||||
conf_text = conf_text.replace("ocis-server", bridge_ip)
|
||||
conf_tmp = Path("/tmp/wopiserver-patched.conf")
|
||||
conf_tmp.write_text(conf_text)
|
||||
secret_tmp = Path("/tmp/wopisecret")
|
||||
secret_tmp.write_text("123\n")
|
||||
|
||||
containers.append("wopi-cs3server")
|
||||
subprocess.run(["docker", "rm", "-f", "wopi-cs3server"], capture_output=True)
|
||||
subprocess.run([
|
||||
"docker", "run", "-d", "--name", "wopi-cs3server",
|
||||
"-p", "9300:9300",
|
||||
"-v", f"{conf_tmp}:/etc/wopi/wopiserver.conf",
|
||||
"-v", f"{secret_tmp}:/etc/wopi/wopisecret",
|
||||
"--entrypoint", "/app/wopiserver.py",
|
||||
CS3_WOPI_IMAGE,
|
||||
], check=True)
|
||||
|
||||
wait_for(lambda: tcp_reachable(bridge_ip, 9300), 120, "wopi-fakeoffice:9300")
|
||||
print("wopi server ready.", flush=True)
|
||||
|
||||
# --- prepare-test-file: upload file, get WOPI credentials ---
|
||||
access_token, ttl, wopi_src = prepare_test_file(bridge_ip)
|
||||
|
||||
# --- Run validator for each testgroup ---
|
||||
failed = []
|
||||
for group in SHARED_TESTGROUPS:
|
||||
rc = run_validator(group, access_token, wopi_src, ttl, secure=False)
|
||||
if rc != 0:
|
||||
failed.append(group)
|
||||
|
||||
if wopi_type == "builtin":
|
||||
for group in BUILTIN_ONLY_TESTGROUPS:
|
||||
rc = run_validator(group, access_token, wopi_src, ttl, secure=True)
|
||||
if rc != 0:
|
||||
failed.append(group)
|
||||
|
||||
if failed:
|
||||
print(f"\nFailed testgroups: {', '.join(failed)}", file=sys.stderr)
|
||||
return 1
|
||||
print("\nAll WOPI validator tests passed.")
|
||||
return 0
|
||||
|
||||
finally:
|
||||
cleanup()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -190,34 +190,6 @@ make test-acceptance-api
|
||||
make test-acceptance-api
|
||||
```
|
||||
|
||||
### Run OCM tests
|
||||
|
||||
For running OCM test suite on k8s, we need to deploy a federation ocis server
|
||||
in a separate namespace on the same cluster, alongside the ocis server:
|
||||
|
||||
1. Check if setup [step 3](#deploy-ocis-in-k8s) is done correctly. (`ENABLE_OCM=true`)
|
||||
2. Prepare Charts for federation oCIS
|
||||
|
||||
```bash
|
||||
OCM=true make prepare-charts
|
||||
```
|
||||
|
||||
3. Deploy federation oCIS
|
||||
|
||||
```bash
|
||||
OCM=true make deploy-ocis
|
||||
```
|
||||
|
||||
4. Run the tests
|
||||
|
||||
```bash
|
||||
TEST_SERVER_URL=https://ocis-server \
|
||||
TEST_SERVER_FED_URL=https://federation-ocis-server \
|
||||
K8S=true \
|
||||
BEHAT_FEATURE=<test-suites-path>/apiOcm/share.feature \
|
||||
make test-acceptance-api
|
||||
```
|
||||
|
||||
## Cleanup the Setup
|
||||
|
||||
To delete the cluster and all the setup resources, run the following command:
|
||||
|
||||
@@ -89,17 +89,14 @@ export WEB_DEBUG_ADDR=localhost:10104
|
||||
export WEB_HTTP_ADDR=localhost:10100
|
||||
export WEBDAV_DEBUG_ADDR=127.0.0.1:10119
|
||||
export WEBDAV_HTTP_ADDR=127.0.0.1:10115
|
||||
export NOTIFICATIONS_DEBUG_ADDR=127.0.0.1:10174
|
||||
export WEBFINGER_DEBUG_ADDR=127.0.0.1:10279
|
||||
export WEBFINGER_HTTP_ADDR=127.0.0.1:10275
|
||||
export OCIS_SERVICE_ACCOUNT_ID=service-account-id
|
||||
export OCIS_SERVICE_ACCOUNT_SECRET=service-account-secret
|
||||
export OCIS_SERVICE_ACCOUNT_ID=serviceaccount
|
||||
export OCIS_SERVICE_ACCOUNT_SECRET=serviceaccountsecret
|
||||
export OCIS_DECOMPOSEDFS_PROPAGATOR=async
|
||||
export STORAGE_USERS_ASYNC_PROPAGATOR_PROPAGATION_DELAY=10s
|
||||
export TLS_INSECURE=true
|
||||
export OCIS_INSECURE=true
|
||||
export LDAP_GROUP_SUBSCRIPTION_FILTER_TYPE=any
|
||||
export LDAP_USER_SUBSCRIPTION_FILTER_TYPE=any
|
||||
export IDP_ACCESS_TOKEN_EXPIRATION=9000
|
||||
export GATEWAY_STORAGE_USERS_MOUNT_ID=storage-users-1
|
||||
export STORAGE_USERS_MOUNT_ID=storage-users-1
|
||||
@@ -109,13 +106,6 @@ export OCIS_LOG_LEVEL=info
|
||||
export OCIS_LOG_PRETTY=true
|
||||
export OCIS_LOG_COLOR=true
|
||||
export PROXY_ENABLE_BASIC_AUTH=true
|
||||
export FRONTEND_SEARCH_MIN_LENGTH=2
|
||||
export FRONTEND_CONFIGURABLE_NOTIFICATIONS=true
|
||||
export GRAPH_AVAILABLE_ROLES=b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5,a8d5fe5e-96e3-418d-825b-534dbdf22b99,fb6c3e19-e378-47e5-b277-9732f9de6e21,58c63c02-1d89-4572-916a-870abc5a1b7d,2d00ce52-1fc2-4dbc-8b95-a73b73395f5a,1c996275-f1c9-4e71-abdf-a42f6495e960,312c0871-5ef7-4b3a-85b6-0e4074c64049,aa97fe03-7980-45ac-9e50-b325749fd7e6,63e64e19-8d43-42ec-a738-2b6af2610efa
|
||||
export COLLABORATION_WOPIAPP_SECRET=some-wopi-secret
|
||||
export SEARCH_EXTRACTOR_TYPE=tika
|
||||
export SEARCH_EXTRACTOR_TIKA_TIKA_URL=http://localhost:9998
|
||||
export SEARCH_EXTRACTOR_CS3SOURCE_INSECURE=true
|
||||
export IDM_CREATE_DEMO_USERS=true
|
||||
export OCIS_ADMIN_USER_ID=some-admin-user-id-0000-000000000000
|
||||
export IDM_ADMIN_PASSWORD=admin
|
||||
@@ -132,4 +122,4 @@ export USERS_LDAP_BIND_PASSWORD=some-ldap-reva-password
|
||||
export AUTH_BASIC_LDAP_BIND_PASSWORD=some-ldap-reva-password
|
||||
export IDM_IDPSVC_PASSWORD=some-ldap-idp-password
|
||||
export IDP_LDAP_BIND_PASSWORD=some-ldap-idp-password
|
||||
export GRAPH_APPLICATION_ID=application-1
|
||||
export GRAPH_APPLICATION_ID=application-1export
|
||||
+1
-1
@@ -3,7 +3,7 @@ package internal
|
||||
// --------------------------------------------------------------------------------
|
||||
// Versions
|
||||
// --------------------------------------------------------------------------------
|
||||
const SDK_Version = "0.6.0"
|
||||
const SDK_Version = "0.5.0"
|
||||
const Protocol_Version = "1.1.0"
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
+3
-3
@@ -14,14 +14,14 @@ import "unsafe"
|
||||
type storageBuf [maxRate / 8]uint64
|
||||
|
||||
func (b *storageBuf) asBytes() *[maxRate]byte {
|
||||
return (*[maxRate]byte)(unsafe.Pointer(b)) //nolint:gosec
|
||||
return (*[maxRate]byte)(unsafe.Pointer(b))
|
||||
}
|
||||
|
||||
// xorInuses unaligned reads and writes to update d.a to contain d.a
|
||||
// XOR buf.
|
||||
func xorIn(d *State, buf []byte) {
|
||||
n := len(buf)
|
||||
bw := (*[maxRate / 8]uint64)(unsafe.Pointer(&buf[0]))[: n/8 : n/8] //nolint:gosec
|
||||
bw := (*[maxRate / 8]uint64)(unsafe.Pointer(&buf[0]))[: n/8 : n/8]
|
||||
if n >= 72 {
|
||||
d.a[0] ^= bw[0]
|
||||
d.a[1] ^= bw[1]
|
||||
@@ -56,6 +56,6 @@ func xorIn(d *State, buf []byte) {
|
||||
}
|
||||
|
||||
func copyOut(d *State, buf []byte) {
|
||||
ab := (*[maxRate]uint8)(unsafe.Pointer(&d.a[0])) //nolint:gosec
|
||||
ab := (*[maxRate]uint8)(unsafe.Pointer(&d.a[0]))
|
||||
copy(buf, ab[:])
|
||||
}
|
||||
-6
@@ -38,12 +38,6 @@ type PrivateKey interface {
|
||||
encoding.BinaryMarshaler
|
||||
}
|
||||
|
||||
// A private key that retains the seed with which it was generated.
|
||||
type Seeded interface {
|
||||
// returns the seed if retained, otherwise nil
|
||||
Seed() []byte
|
||||
}
|
||||
|
||||
// A Scheme represents a specific instance of a signature scheme.
|
||||
type Scheme interface {
|
||||
// Name of the scheme.
|
||||
|
||||
+3
-9
@@ -128,18 +128,12 @@ type Symlink interface {
|
||||
Readlink(link string) (string, error)
|
||||
}
|
||||
|
||||
// Chmod abstracts the logic around changing file modes.
|
||||
type Chmod interface {
|
||||
// Chmod changes the mode of the named file to mode. If the file is a
|
||||
// symbolic link, it changes the mode of the link's target.
|
||||
Chmod(name string, mode os.FileMode) error
|
||||
}
|
||||
|
||||
// Change abstract the FileInfo change related operations in a storage-agnostic
|
||||
// interface as an extension to the Basic interface
|
||||
type Change interface {
|
||||
Chmod
|
||||
|
||||
// Chmod changes the mode of the named file to mode. If the file is a
|
||||
// symbolic link, it changes the mode of the link's target.
|
||||
Chmod(name string, mode os.FileMode) error
|
||||
// Lchown changes the numeric uid and gid of the named file. If the file is
|
||||
// a symbolic link, it changes the uid and gid of the link itself.
|
||||
Lchown(name string, uid, gid int) error
|
||||
|
||||
-14
@@ -1,7 +1,6 @@
|
||||
package chroot
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -201,19 +200,6 @@ func (fs *ChrootHelper) Readlink(link string) (string, error) {
|
||||
return string(os.PathSeparator) + target, nil
|
||||
}
|
||||
|
||||
func (fs *ChrootHelper) Chmod(path string, mode os.FileMode) error {
|
||||
fullpath, err := fs.underlyingPath(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, ok := fs.underlying.(billy.Chmod)
|
||||
if !ok {
|
||||
return errors.New("underlying fs does not implement billy.Chmod")
|
||||
}
|
||||
return c.Chmod(fullpath, mode)
|
||||
}
|
||||
|
||||
func (fs *ChrootHelper) Chroot(path string) (billy.Filesystem, error) {
|
||||
fullpath, err := fs.underlyingPath(path)
|
||||
if err != nil {
|
||||
|
||||
+1
-10
@@ -13,7 +13,7 @@ type Polyfill struct {
|
||||
c capabilities
|
||||
}
|
||||
|
||||
type capabilities struct{ tempfile, dir, symlink, chroot, chmod bool }
|
||||
type capabilities struct{ tempfile, dir, symlink, chroot bool }
|
||||
|
||||
// New creates a new filesystem wrapping up 'fs' the intercepts all the calls
|
||||
// made and errors if fs doesn't implement any of the billy interfaces.
|
||||
@@ -28,7 +28,6 @@ func New(fs billy.Basic) billy.Filesystem {
|
||||
_, h.c.dir = h.Basic.(billy.Dir)
|
||||
_, h.c.symlink = h.Basic.(billy.Symlink)
|
||||
_, h.c.chroot = h.Basic.(billy.Chroot)
|
||||
_, h.c.chmod = h.Basic.(billy.Chmod)
|
||||
return h
|
||||
}
|
||||
|
||||
@@ -88,14 +87,6 @@ func (h *Polyfill) Chroot(path string) (billy.Filesystem, error) {
|
||||
return h.Basic.(billy.Chroot).Chroot(path)
|
||||
}
|
||||
|
||||
func (h *Polyfill) Chmod(path string, mode os.FileMode) error {
|
||||
if !h.c.chmod {
|
||||
return billy.ErrNotSupported
|
||||
}
|
||||
|
||||
return h.Basic.(billy.Chmod).Chmod(path, mode)
|
||||
}
|
||||
|
||||
func (h *Polyfill) Root() string {
|
||||
if !h.c.chroot {
|
||||
return string(filepath.Separator)
|
||||
|
||||
-4
@@ -177,10 +177,6 @@ func (fs *Memory) Remove(filename string) error {
|
||||
return fs.s.Remove(filename)
|
||||
}
|
||||
|
||||
func (fs *Memory) Chmod(path string, mode os.FileMode) error {
|
||||
return fs.s.Chmod(path, mode)
|
||||
}
|
||||
|
||||
// Falls back to Go's filepath.Join, which works differently depending on the
|
||||
// OS where the code is being executed.
|
||||
func (fs *Memory) Join(elem ...string) string {
|
||||
|
||||
-12
@@ -169,18 +169,6 @@ func (s *storage) Remove(path string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *storage) Chmod(path string, mode os.FileMode) error {
|
||||
path = clean(path)
|
||||
|
||||
f, has := s.Get(path)
|
||||
if !has {
|
||||
return os.ErrNotExist
|
||||
}
|
||||
|
||||
f.mode = mode
|
||||
return nil
|
||||
}
|
||||
|
||||
func clean(path string) string {
|
||||
return filepath.Clean(filepath.FromSlash(path))
|
||||
}
|
||||
|
||||
-16
@@ -126,14 +126,6 @@ func (fs *BoundOS) TempFile(dir, prefix string) (billy.File, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = os.Stat(dir)
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
err = os.MkdirAll(dir, defaultDirectoryMode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tempFile(dir, prefix)
|
||||
@@ -184,14 +176,6 @@ func (fs *BoundOS) Readlink(link string) (string, error) {
|
||||
return os.Readlink(link)
|
||||
}
|
||||
|
||||
func (fs *BoundOS) Chmod(path string, mode os.FileMode) error {
|
||||
abspath, err := fs.abs(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Chmod(abspath, mode)
|
||||
}
|
||||
|
||||
// Chroot returns a new OS filesystem, with the base dir set to the
|
||||
// result of joining the provided path with the underlying base dir.
|
||||
func (fs *BoundOS) Chroot(path string) (billy.Filesystem, error) {
|
||||
|
||||
-4
@@ -74,10 +74,6 @@ func (fs *ChrootOS) Remove(filename string) error {
|
||||
return os.Remove(filename)
|
||||
}
|
||||
|
||||
func (fs *ChrootOS) Chmod(path string, mode os.FileMode) error {
|
||||
return os.Chmod(path, mode)
|
||||
}
|
||||
|
||||
func (fs *ChrootOS) TempFile(dir, prefix string) (billy.File, error) {
|
||||
if err := fs.createDir(dir + string(os.PathSeparator)); err != nil {
|
||||
return nil, err
|
||||
|
||||
+3
-7
@@ -91,8 +91,8 @@ func readVersion(idx *MemoryIndex, r io.Reader) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if v != VersionSupported {
|
||||
return fmt.Errorf("%w: v%d", ErrUnsupportedVersion, v)
|
||||
if v > VersionSupported {
|
||||
return ErrUnsupportedVersion
|
||||
}
|
||||
|
||||
idx.Version = v
|
||||
@@ -106,10 +106,6 @@ func readFanout(idx *MemoryIndex, r io.Reader) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if k > 0 && n < idx.Fanout[k-1] {
|
||||
return fmt.Errorf("%w: fanout table is not monotonically non-decreasing at entry %d", ErrMalformedIdxFile, k)
|
||||
}
|
||||
|
||||
idx.Fanout[k] = n
|
||||
idx.FanoutMapping[k] = noMapping
|
||||
}
|
||||
@@ -159,7 +155,7 @@ func readCRC32(idx *MemoryIndex, r io.Reader) error {
|
||||
}
|
||||
|
||||
func readOffsets(idx *MemoryIndex, r io.Reader) error {
|
||||
var o64cnt int64
|
||||
var o64cnt int
|
||||
for k := 0; k < fanout; k++ {
|
||||
if pos := idx.FanoutMapping[k]; pos != noMapping {
|
||||
if _, err := io.ReadFull(r, idx.Offset32[pos]); err != nil {
|
||||
|
||||
+39
-71
@@ -4,8 +4,8 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@@ -26,14 +26,12 @@ var (
|
||||
ErrInvalidChecksum = errors.New("invalid checksum")
|
||||
// ErrUnknownExtension is returned when an index extension is encountered that is considered mandatory
|
||||
ErrUnknownExtension = errors.New("unknown extension")
|
||||
// ErrMalformedIndexFile is returned when the index file contents are
|
||||
// structurally invalid.
|
||||
ErrMalformedIndexFile = errors.New("index decoder: malformed index file")
|
||||
)
|
||||
|
||||
const (
|
||||
entryHeaderLength = 62
|
||||
entryExtended = 0x4000
|
||||
entryValid = 0x8000
|
||||
nameMask = 0xfff
|
||||
intentToAddMask = 1 << 13
|
||||
skipWorkTreeMask = 1 << 14
|
||||
@@ -142,55 +140,33 @@ func (d *Decoder) readEntry(idx *Index) (*Entry, error) {
|
||||
e.SkipWorktree = extended&skipWorkTreeMask != 0
|
||||
}
|
||||
|
||||
nameConsumed, err := d.readEntryName(idx, e, flags)
|
||||
if err != nil {
|
||||
if err := d.readEntryName(idx, e, flags); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return e, d.padEntry(idx, e, read, nameConsumed)
|
||||
return e, d.padEntry(idx, e, read)
|
||||
}
|
||||
|
||||
// readEntryName reads the entry path and sets e.Name. It returns the
|
||||
// number of bytes consumed from the stream for the name portion.
|
||||
func (d *Decoder) readEntryName(idx *Index, e *Entry, flags uint16) (int, error) {
|
||||
func (d *Decoder) readEntryName(idx *Index, e *Entry, flags uint16) error {
|
||||
var name string
|
||||
var err error
|
||||
|
||||
switch idx.Version {
|
||||
case 2, 3:
|
||||
nameLen := flags & nameMask
|
||||
name, consumed, err := d.doReadEntryName(nameLen)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
e.Name = name
|
||||
return consumed, nil
|
||||
len := flags & nameMask
|
||||
name, err = d.doReadEntryName(len)
|
||||
case 4:
|
||||
name, err := d.doReadEntryNameV4()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
e.Name = name
|
||||
return 0, nil // V4 has no padding; consumed count unused
|
||||
name, err = d.doReadEntryNameV4()
|
||||
default:
|
||||
return 0, ErrUnsupportedVersion
|
||||
}
|
||||
}
|
||||
|
||||
// doReadEntryName reads the entry path for V2/V3 indexes. It returns the
|
||||
// name, the number of bytes consumed from the stream, and any error.
|
||||
// When nameLen equals nameMask (0xFFF), the name was too long to fit in
|
||||
// the 12-bit field and the real length is found by scanning for the NUL
|
||||
// terminator — matching C Git's strlen(name) fallback in create_from_disk.
|
||||
func (d *Decoder) doReadEntryName(nameLen uint16) (string, int, error) {
|
||||
if nameLen == nameMask {
|
||||
name, err := binary.ReadUntil(d.r, '\x00')
|
||||
if err != nil {
|
||||
return "", 0, err
|
||||
}
|
||||
return string(name), len(name) + 1, nil // +1 for the consumed NUL delimiter
|
||||
return ErrUnsupportedVersion
|
||||
}
|
||||
|
||||
name := make([]byte, nameLen)
|
||||
_, err := io.ReadFull(d.r, name)
|
||||
return string(name), int(nameLen), err
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
e.Name = name
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *Decoder) doReadEntryNameV4() (string, error) {
|
||||
@@ -201,14 +177,7 @@ func (d *Decoder) doReadEntryNameV4() (string, error) {
|
||||
|
||||
var base string
|
||||
if d.lastEntry != nil {
|
||||
if l < 0 || int(l) > len(d.lastEntry.Name) {
|
||||
return "", fmt.Errorf("%w: invalid V4 entry name strip length %d (previous name length: %d)",
|
||||
ErrMalformedIndexFile, l, len(d.lastEntry.Name))
|
||||
}
|
||||
base = d.lastEntry.Name[:len(d.lastEntry.Name)-int(l)]
|
||||
} else if l > 0 {
|
||||
return "", fmt.Errorf("%w: non-zero strip length %d on first V4 entry",
|
||||
ErrMalformedIndexFile, l)
|
||||
}
|
||||
|
||||
name, err := binary.ReadUntil(d.r, '\x00')
|
||||
@@ -219,23 +188,24 @@ func (d *Decoder) doReadEntryNameV4() (string, error) {
|
||||
return base + string(name), nil
|
||||
}
|
||||
|
||||
// padEntry discards NUL padding bytes that follow each V2/V3 entry on
|
||||
// disk. nameConsumed is the number of stream bytes consumed while reading
|
||||
// the entry name (which may exceed len(e.Name) when a NUL terminator was
|
||||
// consumed for long names where the 12-bit length field overflowed).
|
||||
func (d *Decoder) padEntry(idx *Index, e *Entry, read, nameConsumed int) error {
|
||||
func (d *Decoder) doReadEntryName(len uint16) (string, error) {
|
||||
name := make([]byte, len)
|
||||
_, err := io.ReadFull(d.r, name)
|
||||
|
||||
return string(name), err
|
||||
}
|
||||
|
||||
// Index entries are padded out to the next 8 byte alignment
|
||||
// for historical reasons related to how C Git read the files.
|
||||
func (d *Decoder) padEntry(idx *Index, e *Entry, read int) error {
|
||||
if idx.Version == 4 {
|
||||
return nil
|
||||
}
|
||||
|
||||
entrySize := read + len(e.Name)
|
||||
padLen := 8 - entrySize%8
|
||||
padLen -= nameConsumed - len(e.Name)
|
||||
if padLen > 0 {
|
||||
_, err := io.CopyN(io.Discard, d.r, int64(padLen))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
_, err := io.CopyN(io.Discard, d.r, int64(padLen))
|
||||
return err
|
||||
}
|
||||
|
||||
func (d *Decoder) readExtensions(idx *Index) error {
|
||||
@@ -342,7 +312,7 @@ func (d *Decoder) readChecksum(expected []byte) error {
|
||||
}
|
||||
|
||||
func validateHeader(r io.Reader) (version uint32, err error) {
|
||||
s := make([]byte, 4)
|
||||
var s = make([]byte, 4)
|
||||
if _, err := io.ReadFull(r, s); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -406,26 +376,24 @@ func (d *treeExtensionDecoder) readEntry() (*TreeEntry, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// An entry can be in an invalidated state and is represented by having a
|
||||
// negative number in the entry_count field.
|
||||
if i == -1 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
e.Entries = i
|
||||
trees, err := binary.ReadUntil(d.r, '\n')
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
subtrees, err := strconv.Atoi(string(trees))
|
||||
i, err = strconv.Atoi(string(trees))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
e.Trees = subtrees
|
||||
|
||||
// An entry can be in an invalidated state and is represented by having a
|
||||
// negative number in the entry_count field. In this case, there is no
|
||||
// object name and the next entry starts immediately after the newline.
|
||||
if i < 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
e.Trees = i
|
||||
_, err = io.ReadFull(d.r, e.Hash[:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+14
-25
@@ -5,7 +5,9 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-git/go-git/v5/plumbing/hash"
|
||||
@@ -158,39 +160,26 @@ func (e *Encoder) encodeEntryName(entry *Entry) error {
|
||||
}
|
||||
|
||||
func (e *Encoder) encodeEntryNameV4(entry *Entry) error {
|
||||
// V4 prefix compression: find the longest common prefix between the
|
||||
// previous entry's name and the current one. The strip length tells
|
||||
// the decoder how many bytes to remove from the end of the previous
|
||||
// name, and the suffix is the remainder of the current name.
|
||||
prefix := 0
|
||||
name := entry.Name
|
||||
l := 0
|
||||
if e.lastEntry != nil {
|
||||
prefix = commonPrefixLen(e.lastEntry.Name, entry.Name)
|
||||
}
|
||||
stripLen := 0
|
||||
if e.lastEntry != nil {
|
||||
stripLen = len(e.lastEntry.Name) - prefix
|
||||
dir := path.Dir(e.lastEntry.Name) + "/"
|
||||
if strings.HasPrefix(entry.Name, dir) {
|
||||
l = len(e.lastEntry.Name) - len(dir)
|
||||
name = strings.TrimPrefix(entry.Name, dir)
|
||||
} else {
|
||||
l = len(e.lastEntry.Name)
|
||||
}
|
||||
}
|
||||
|
||||
e.lastEntry = entry
|
||||
|
||||
if err := binary.WriteVariableWidthInt(e.w, int64(stripLen)); err != nil {
|
||||
err := binary.WriteVariableWidthInt(e.w, int64(l))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
suffix := entry.Name[prefix:]
|
||||
return binary.Write(e.w, append([]byte(suffix), '\x00'))
|
||||
}
|
||||
|
||||
// commonPrefixLen returns the length of the longest common byte prefix
|
||||
// between a and b.
|
||||
func commonPrefixLen(a, b string) int {
|
||||
n := min(len(b), len(a))
|
||||
for i := range n {
|
||||
if a[i] != b[i] {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return n
|
||||
return binary.Write(e.w, []byte(name+string('\x00')))
|
||||
}
|
||||
|
||||
func (e *Encoder) encodeRawExtension(signature string, data []byte) error {
|
||||
|
||||
-2
@@ -54,8 +54,6 @@ type Index struct {
|
||||
ResolveUndo *ResolveUndo
|
||||
// EndOfIndexEntry represents the 'End of Index Entry' extension
|
||||
EndOfIndexEntry *EndOfIndexEntry
|
||||
// ModTime is the modification time of the index file
|
||||
ModTime time.Time
|
||||
}
|
||||
|
||||
// Add creates a new Entry and returns it. The caller should first check that
|
||||
|
||||
-6
@@ -208,12 +208,6 @@ func Open(s storage.Storer, worktree billy.Filesystem) (*Repository, error) {
|
||||
return nil, ErrRepositoryNotExists
|
||||
}
|
||||
|
||||
cfg, err := s.Config()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = verifyExtensions(s, cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
-121
@@ -1,121 +0,0 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/go-git/go-git/v5/config"
|
||||
cfgformat "github.com/go-git/go-git/v5/plumbing/format/config"
|
||||
"github.com/go-git/go-git/v5/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrUnsupportedExtensionRepositoryFormatVersion represents when an
|
||||
// extension being used is not compatible with the repository's
|
||||
// core.repositoryFormatVersion.
|
||||
ErrUnsupportedExtensionRepositoryFormatVersion = errors.New("core.repositoryformatversion does not support extension")
|
||||
|
||||
// ErrUnsupportedRepositoryFormatVersion represents when an repository
|
||||
// is using a format version that is not supported.
|
||||
ErrUnsupportedRepositoryFormatVersion = errors.New("core.repositoryformatversion not supported")
|
||||
|
||||
// ErrUnknownExtension represents when a repository has an extension
|
||||
// which is unknown or unsupported by go-git.
|
||||
ErrUnknownExtension = errors.New("unknown extension")
|
||||
|
||||
// builtinExtensions defines the Git extensions that are supported by
|
||||
// the core go-git implementation.
|
||||
//
|
||||
// Some extensions are storage-specific, those are defined by the Storers
|
||||
// themselves by implementing the ExtensionChecker interface.
|
||||
builtinExtensions = map[string]struct{}{
|
||||
// noop does not change git’s behavior at all.
|
||||
// It is useful only for testing format-1 compatibility.
|
||||
//
|
||||
// This extension is respected regardless of the
|
||||
// core.repositoryFormatVersion setting.
|
||||
"noop": {},
|
||||
|
||||
// noop-v1 does not change git’s behavior at all.
|
||||
// It is useful only for testing format-1 compatibility.
|
||||
"noop-v1": {},
|
||||
}
|
||||
|
||||
// Some Git extensions were supported upstream before the introduction
|
||||
// of repositoryformatversion. These are the only extensions that can be
|
||||
// enabled while core.repositoryformatversion is unset or set to 0.
|
||||
extensionsValidForV0 = map[string]struct{}{
|
||||
"noop": {},
|
||||
"partialClone": {},
|
||||
"preciousObjects": {},
|
||||
"worktreeConfig": {},
|
||||
}
|
||||
)
|
||||
|
||||
type extension struct {
|
||||
name string
|
||||
value string
|
||||
}
|
||||
|
||||
func extensions(cfg *config.Config) []extension {
|
||||
if cfg == nil || cfg.Raw == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !cfg.Raw.HasSection("extensions") {
|
||||
return nil
|
||||
}
|
||||
|
||||
section := cfg.Raw.Section("extensions")
|
||||
out := make([]extension, 0, len(section.Options))
|
||||
for _, opt := range section.Options {
|
||||
out = append(out, extension{name: strings.ToLower(opt.Key), value: strings.ToLower(opt.Value)})
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
func verifyExtensions(st storage.Storer, cfg *config.Config) error {
|
||||
needed := extensions(cfg)
|
||||
|
||||
switch cfg.Core.RepositoryFormatVersion {
|
||||
case "", cfgformat.Version_0, cfgformat.Version_1:
|
||||
default:
|
||||
return fmt.Errorf("%w: %q",
|
||||
ErrUnsupportedRepositoryFormatVersion,
|
||||
cfg.Core.RepositoryFormatVersion)
|
||||
}
|
||||
|
||||
if len(needed) > 0 {
|
||||
if cfg.Core.RepositoryFormatVersion == cfgformat.Version_0 ||
|
||||
cfg.Core.RepositoryFormatVersion == "" {
|
||||
var unsupported []string
|
||||
for _, ext := range needed {
|
||||
if _, ok := extensionsValidForV0[ext.name]; !ok {
|
||||
unsupported = append(unsupported, ext.name)
|
||||
}
|
||||
}
|
||||
if len(unsupported) > 0 {
|
||||
return fmt.Errorf("%w: %s",
|
||||
ErrUnsupportedExtensionRepositoryFormatVersion,
|
||||
strings.Join(unsupported, ", "))
|
||||
}
|
||||
}
|
||||
|
||||
var missing []string
|
||||
for _, ext := range needed {
|
||||
if _, ok := builtinExtensions[ext.name]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
missing = append(missing, ext.name)
|
||||
}
|
||||
|
||||
if len(missing) > 0 {
|
||||
return fmt.Errorf("%w: %s", ErrUnknownExtension, strings.Join(missing, ", "))
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
+2
-23
@@ -3,7 +3,6 @@ package dotgit
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
@@ -138,22 +137,14 @@ func (w *PackWriter) save() error {
|
||||
}
|
||||
|
||||
if err := w.encodeIdx(idx); err != nil {
|
||||
_ = idx.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
if err := idx.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
fixPermissions(w.fs, fmt.Sprintf("%s.idx", base))
|
||||
|
||||
packPath := fmt.Sprintf("%s.pack", base)
|
||||
if err := w.fs.Rename(w.fw.Name(), packPath); err != nil {
|
||||
return err
|
||||
}
|
||||
fixPermissions(w.fs, packPath)
|
||||
|
||||
return nil
|
||||
return w.fs.Rename(w.fw.Name(), fmt.Sprintf("%s.pack", base))
|
||||
}
|
||||
|
||||
func (w *PackWriter) encodeIdx(writer io.Writer) error {
|
||||
@@ -290,17 +281,5 @@ func (w *ObjectWriter) save() error {
|
||||
hex := w.Hash().String()
|
||||
file := w.fs.Join(objectsPath, hex[0:2], hex[2:hash.HexSize])
|
||||
|
||||
// Loose objects are content addressable, if they already exist
|
||||
// we can safely delete the temporary file and short-circuit the
|
||||
// operation.
|
||||
if _, err := w.fs.Stat(file); err == nil || os.IsExist(err) {
|
||||
return w.fs.Remove(w.f.Name())
|
||||
}
|
||||
|
||||
if err := w.fs.Rename(w.f.Name(), file); err != nil {
|
||||
return err
|
||||
}
|
||||
fixPermissions(w.fs, file)
|
||||
|
||||
return nil
|
||||
return w.fs.Rename(w.f.Name(), file)
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
//go:build !windows
|
||||
|
||||
package dotgit
|
||||
|
||||
import (
|
||||
"github.com/go-git/go-billy/v5"
|
||||
"github.com/go-git/go-git/v5/utils/trace"
|
||||
)
|
||||
|
||||
func fixPermissions(fs billy.Filesystem, path string) {
|
||||
if chmodFS, ok := fs.(billy.Chmod); ok {
|
||||
if err := chmodFS.Chmod(path, 0o444); err != nil {
|
||||
trace.General.Printf("failed to chmod %s: %v", path, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func isReadOnly(fs billy.Filesystem, path string) (bool, error) {
|
||||
fi, err := fs.Stat(path)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
if fi.Mode().Perm() == 0o444 {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
//go:build windows
|
||||
|
||||
package dotgit
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/go-git/go-billy/v5"
|
||||
"github.com/go-git/go-git/v5/utils/trace"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
func fixPermissions(fs billy.Filesystem, path string) {
|
||||
fullpath := filepath.Join(fs.Root(), path)
|
||||
p, err := windows.UTF16PtrFromString(fullpath)
|
||||
if err != nil {
|
||||
trace.General.Printf("failed to chmod %s: %v", fullpath, err)
|
||||
return
|
||||
}
|
||||
|
||||
attrs, err := windows.GetFileAttributes(p)
|
||||
if err != nil {
|
||||
trace.General.Printf("failed to chmod %s: %v", fullpath, err)
|
||||
return
|
||||
}
|
||||
|
||||
if attrs&windows.FILE_ATTRIBUTE_READONLY != 0 {
|
||||
return
|
||||
}
|
||||
|
||||
err = windows.SetFileAttributes(p,
|
||||
attrs|windows.FILE_ATTRIBUTE_READONLY,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
trace.General.Printf("failed to chmod %s: %v", fullpath, err)
|
||||
}
|
||||
}
|
||||
|
||||
func isReadOnly(fs billy.Filesystem, path string) (bool, error) {
|
||||
fullpath := filepath.Join(fs.Root(), path)
|
||||
p, err := windows.UTF16PtrFromString(fullpath)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("%w: %q", err, fullpath)
|
||||
}
|
||||
|
||||
attrs, err := windows.GetFileAttributes(p)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("%w: %q", err, fullpath)
|
||||
}
|
||||
|
||||
if attrs&windows.FILE_ATTRIBUTE_READONLY != 0 {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
-5
@@ -48,11 +48,6 @@ func (s *IndexStorage) Index() (i *index.Index, err error) {
|
||||
|
||||
defer ioutil.CheckClose(f, &err)
|
||||
|
||||
fi, statErr := s.dir.Fs().Stat(f.Name())
|
||||
if statErr == nil {
|
||||
idx.ModTime = fi.ModTime()
|
||||
}
|
||||
|
||||
d := index.NewDecoder(f)
|
||||
err = d.Decode(idx)
|
||||
return idx, err
|
||||
|
||||
-4
@@ -69,11 +69,7 @@ type IndexStorage struct {
|
||||
index *index.Index
|
||||
}
|
||||
|
||||
// SetIndex stores the given index.
|
||||
// Note: this method sets idx.ModTime to simulate filesystem storage behavior.
|
||||
func (c *IndexStorage) SetIndex(idx *index.Index) error {
|
||||
// Set ModTime to enable racy git detection in the metadata optimization.
|
||||
idx.ModTime = time.Now()
|
||||
c.index = idx
|
||||
return nil
|
||||
}
|
||||
|
||||
+5
-103
@@ -4,11 +4,9 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
"github.com/go-git/go-git/v5/plumbing/filemode"
|
||||
"github.com/go-git/go-git/v5/plumbing/format/index"
|
||||
"github.com/go-git/go-git/v5/utils/merkletrie/noder"
|
||||
|
||||
"github.com/go-git/go-billy/v5"
|
||||
@@ -18,14 +16,6 @@ var ignore = map[string]bool{
|
||||
".git": true,
|
||||
}
|
||||
|
||||
// Options contains configuration for the filesystem node.
|
||||
type Options struct {
|
||||
// Index is used to enable the metadata-first comparison optimization while
|
||||
// correctly handling the "racy git" condition. If no index is provided,
|
||||
// the function works without the optimization.
|
||||
Index *index.Index
|
||||
}
|
||||
|
||||
// The node represents a file or a directory in a billy.Filesystem. It
|
||||
// implements the interface noder.Noder of merkletrie package.
|
||||
//
|
||||
@@ -34,8 +24,6 @@ type Options struct {
|
||||
type node struct {
|
||||
fs billy.Filesystem
|
||||
submodules map[string]plumbing.Hash
|
||||
idx *index.Index
|
||||
idxMap map[string]*index.Entry
|
||||
|
||||
path string
|
||||
hash []byte
|
||||
@@ -43,7 +31,6 @@ type node struct {
|
||||
isDir bool
|
||||
mode os.FileMode
|
||||
size int64
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
// NewRootNode returns the root node based on a given billy.Filesystem.
|
||||
@@ -55,41 +42,7 @@ func NewRootNode(
|
||||
fs billy.Filesystem,
|
||||
submodules map[string]plumbing.Hash,
|
||||
) noder.Noder {
|
||||
return NewRootNodeWithOptions(fs, submodules, Options{})
|
||||
}
|
||||
|
||||
// NewRootNodeWithOptions returns the root node based on a given billy.Filesystem
|
||||
// with options to set an index. Providing an index enables the metadata-first
|
||||
// comparison optimization while correctly handling the "racy git" condition. If
|
||||
// no index is provided, the function works without the optimization.
|
||||
//
|
||||
// The index's ModTime field is used to detect the racy git condition. When a file's
|
||||
// mtime equals or is newer than the index ModTime, we must hash the file content
|
||||
// even if other metadata matches, because the file may have been modified in the
|
||||
// same second that the index was written.
|
||||
//
|
||||
// Reference: https://git-scm.com/docs/racy-git
|
||||
func NewRootNodeWithOptions(
|
||||
fs billy.Filesystem,
|
||||
submodules map[string]plumbing.Hash,
|
||||
options Options,
|
||||
) noder.Noder {
|
||||
var idxMap map[string]*index.Entry
|
||||
|
||||
if options.Index != nil {
|
||||
idxMap = make(map[string]*index.Entry, len(options.Index.Entries))
|
||||
for _, entry := range options.Index.Entries {
|
||||
idxMap[entry.Name] = entry
|
||||
}
|
||||
}
|
||||
|
||||
return &node{
|
||||
fs: fs,
|
||||
submodules: submodules,
|
||||
idx: options.Index,
|
||||
idxMap: idxMap,
|
||||
isDir: true,
|
||||
}
|
||||
return &node{fs: fs, submodules: submodules, isDir: true}
|
||||
}
|
||||
|
||||
// Hash the hash of a filesystem is the result of concatenating the computed
|
||||
@@ -180,14 +133,11 @@ func (n *node) newChildNode(file os.FileInfo) (*node, error) {
|
||||
node := &node{
|
||||
fs: n.fs,
|
||||
submodules: n.submodules,
|
||||
idx: n.idx,
|
||||
idxMap: n.idxMap,
|
||||
|
||||
path: path,
|
||||
isDir: file.IsDir(),
|
||||
size: file.Size(),
|
||||
mode: file.Mode(),
|
||||
modTime: file.ModTime(),
|
||||
path: path,
|
||||
isDir: file.IsDir(),
|
||||
size: file.Size(),
|
||||
mode: file.Mode(),
|
||||
}
|
||||
|
||||
if _, isSubmodule := n.submodules[path]; isSubmodule {
|
||||
@@ -211,16 +161,6 @@ func (n *node) calculateHash() {
|
||||
n.hash = append(submoduleHash[:], filemode.Submodule.Bytes()...)
|
||||
return
|
||||
}
|
||||
|
||||
if n.idxMap != nil {
|
||||
if entry, ok := n.idxMap[n.path]; ok {
|
||||
if n.metadataMatches(entry) {
|
||||
n.hash = append(entry.Hash[:], mode.Bytes()...)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var hash plumbing.Hash
|
||||
if n.mode&os.ModeSymlink != 0 {
|
||||
hash = n.doCalculateHashForSymlink()
|
||||
@@ -230,44 +170,6 @@ func (n *node) calculateHash() {
|
||||
n.hash = append(hash[:], mode.Bytes()...)
|
||||
}
|
||||
|
||||
func (n *node) metadataMatches(entry *index.Entry) bool {
|
||||
if entry == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if uint32(n.size) != entry.Size {
|
||||
return false
|
||||
}
|
||||
|
||||
if !n.modTime.IsZero() && !n.modTime.Equal(entry.ModifiedAt) {
|
||||
return false
|
||||
}
|
||||
|
||||
mode, err := filemode.NewFromOSFileMode(n.mode)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if mode != entry.Mode {
|
||||
return false
|
||||
}
|
||||
|
||||
if n.idx != nil && !n.idx.ModTime.IsZero() && !n.modTime.IsZero() {
|
||||
if !n.modTime.Before(n.idx.ModTime) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// If we couldn't perform the racy git check (idx is nil or idx.ModTime is zero),
|
||||
// we cannot safely rely on metadata alone — force content hashing.
|
||||
// This can occur with in-memory storage where the index file timestamp is unavailable.
|
||||
if n.idx == nil || n.idx.ModTime.IsZero() {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (n *node) doCalculateHashForRegular() plumbing.Hash {
|
||||
f, err := n.fs.Open(n.path)
|
||||
if err != nil {
|
||||
|
||||
+11
-22
@@ -385,8 +385,7 @@ func (w *Worktree) resetIndex(t *object.Tree, dirs []string, files []string) ([]
|
||||
return nil, err
|
||||
}
|
||||
|
||||
removedFiles := make([]string, 0, len(changes))
|
||||
filesMap := buildFilePathMap(files)
|
||||
var removedFiles []string
|
||||
for _, ch := range changes {
|
||||
a, err := ch.Action()
|
||||
if err != nil {
|
||||
@@ -408,7 +407,7 @@ func (w *Worktree) resetIndex(t *object.Tree, dirs []string, files []string) ([]
|
||||
}
|
||||
|
||||
if len(files) > 0 {
|
||||
contains := inFiles(filesMap, name)
|
||||
contains := inFiles(files, name)
|
||||
if !contains {
|
||||
continue
|
||||
}
|
||||
@@ -437,11 +436,15 @@ func (w *Worktree) resetIndex(t *object.Tree, dirs []string, files []string) ([]
|
||||
return removedFiles, w.r.Storer.SetIndex(idx)
|
||||
}
|
||||
|
||||
// inFiles checks if the given file is in the list of files. The incoming filepaths in files should be cleaned before calling this function.
|
||||
func inFiles(files map[string]struct{}, v string) bool {
|
||||
func inFiles(files []string, v string) bool {
|
||||
v = filepath.Clean(v)
|
||||
_, exists := files[v]
|
||||
return exists
|
||||
for _, s := range files {
|
||||
if filepath.Clean(s) == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (w *Worktree) resetWorktree(t *object.Tree, files []string) error {
|
||||
@@ -456,7 +459,6 @@ func (w *Worktree) resetWorktree(t *object.Tree, files []string) error {
|
||||
}
|
||||
b := newIndexBuilder(idx)
|
||||
|
||||
filesMap := buildFilePathMap(files)
|
||||
for _, ch := range changes {
|
||||
if err := w.validChange(ch); err != nil {
|
||||
return err
|
||||
@@ -474,7 +476,7 @@ func (w *Worktree) resetWorktree(t *object.Tree, files []string) error {
|
||||
continue
|
||||
}
|
||||
|
||||
contains := inFiles(filesMap, file)
|
||||
contains := inFiles(files, file)
|
||||
if !contains {
|
||||
continue
|
||||
}
|
||||
@@ -1204,16 +1206,3 @@ func (b *indexBuilder) Add(e *index.Entry) {
|
||||
func (b *indexBuilder) Remove(name string) {
|
||||
delete(b.entries, filepath.ToSlash(name))
|
||||
}
|
||||
|
||||
// buildFilePathMap creates a map of cleaned file paths for efficient lookup.
|
||||
// Returns nil if the input slice is empty.
|
||||
func buildFilePathMap(files []string) map[string]struct{} {
|
||||
if len(files) == 0 {
|
||||
return nil
|
||||
}
|
||||
filesMap := make(map[string]struct{}, len(files))
|
||||
for _, f := range files {
|
||||
filesMap[filepath.Clean(f)] = struct{}{}
|
||||
}
|
||||
return filesMap
|
||||
}
|
||||
+1
-1
@@ -141,7 +141,7 @@ func (w *Worktree) diffStagingWithWorktree(reverse, excludeIgnoredChanges bool)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
to := filesystem.NewRootNodeWithOptions(w.Filesystem, submodules, filesystem.Options{Index: idx})
|
||||
to := filesystem.NewRootNode(w.Filesystem, submodules)
|
||||
|
||||
var c merkletrie.Changes
|
||||
if reverse {
|
||||
|
||||
+8
-15
@@ -7,7 +7,7 @@ This package provides various compression algorithms.
|
||||
* Optimized [deflate](https://godoc.org/github.com/klauspost/compress/flate) packages which can be used as a dropin replacement for [gzip](https://godoc.org/github.com/klauspost/compress/gzip), [zip](https://godoc.org/github.com/klauspost/compress/zip) and [zlib](https://godoc.org/github.com/klauspost/compress/zlib).
|
||||
* [snappy](https://github.com/klauspost/compress/tree/master/snappy) is a drop-in replacement for `github.com/golang/snappy` offering better compression and concurrent streams.
|
||||
* [huff0](https://github.com/klauspost/compress/tree/master/huff0) and [FSE](https://github.com/klauspost/compress/tree/master/fse) implementations for raw entropy encoding.
|
||||
* [gzhttp](https://github.com/klauspost/compress/tree/master/gzhttp) Provides client and server wrappers for handling gzipped/zstd HTTP requests efficiently.
|
||||
* [gzhttp](https://github.com/klauspost/compress/tree/master/gzhttp) Provides client and server wrappers for handling gzipped requests efficiently.
|
||||
* [pgzip](https://github.com/klauspost/pgzip) is a separate package that provides a very fast parallel gzip implementation.
|
||||
|
||||
[](https://pkg.go.dev/github.com/klauspost/compress?tab=subdirectories)
|
||||
@@ -26,14 +26,8 @@ This package will support the current Go version and 2 versions back.
|
||||
Use the links above for more information on each.
|
||||
|
||||
# changelog
|
||||
* Jan 16th, 2026 [1.18.3](https://github.com/klauspost/compress/releases/tag/v1.18.3)
|
||||
* Downstream CVE-2025-61728. See [golang/go#77102](https://github.com/golang/go/issues/77102).
|
||||
|
||||
* Dec 1st, 2025 - [1.18.2](https://github.com/klauspost/compress/releases/tag/v1.18.2)
|
||||
* flate: Fix invalid encoding on level 9 with single value input in https://github.com/klauspost/compress/pull/1115
|
||||
* flate: reduce stateless allocations by @RXamzin in https://github.com/klauspost/compress/pull/1106
|
||||
|
||||
* Oct 20, 2025 - [1.18.1](https://github.com/klauspost/compress/releases/tag/v1.18.1) - RETRACTED
|
||||
* Oct 20, 2025 - [1.18.1](https://github.com/klauspost/compress/releases/tag/v1.18.1)
|
||||
* zstd: Add simple zstd EncodeTo/DecodeTo functions https://github.com/klauspost/compress/pull/1079
|
||||
* zstd: Fix incorrect buffer size in dictionary encodes https://github.com/klauspost/compress/pull/1059
|
||||
* s2: check for cap, not len of buffer in EncodeBetter/Best by @vdarulis in https://github.com/klauspost/compress/pull/1080
|
||||
@@ -609,7 +603,7 @@ While the release has been extensively tested, it is recommended to testing when
|
||||
|
||||
# deflate usage
|
||||
|
||||
The packages are drop-in replacements for standard library [deflate](https://godoc.org/github.com/klauspost/compress/flate), [gzip](https://godoc.org/github.com/klauspost/compress/gzip), [zip](https://godoc.org/github.com/klauspost/compress/zip), and [zlib](https://godoc.org/github.com/klauspost/compress/zlib). Simply replace the import path to use them:
|
||||
The packages are drop-in replacements for standard libraries. Simply replace the import path to use them:
|
||||
|
||||
Typical speed is about 2x of the standard library packages.
|
||||
|
||||
@@ -620,15 +614,17 @@ Typical speed is about 2x of the standard library packages.
|
||||
| `archive/zip` | `github.com/klauspost/compress/zip` | [zip](https://pkg.go.dev/github.com/klauspost/compress/zip?tab=doc) |
|
||||
| `compress/flate` | `github.com/klauspost/compress/flate` | [flate](https://pkg.go.dev/github.com/klauspost/compress/flate?tab=doc) |
|
||||
|
||||
You may also be interested in [pgzip](https://github.com/klauspost/pgzip), which is a drop-in replacement for gzip, which support multithreaded compression on big files and the optimized [crc32](https://github.com/klauspost/crc32) package used by these packages.
|
||||
* Optimized [deflate](https://godoc.org/github.com/klauspost/compress/flate) packages which can be used as a dropin replacement for [gzip](https://godoc.org/github.com/klauspost/compress/gzip), [zip](https://godoc.org/github.com/klauspost/compress/zip) and [zlib](https://godoc.org/github.com/klauspost/compress/zlib).
|
||||
|
||||
The packages implement the same API as the standard library, so you can use the original godoc documentation: [gzip](http://golang.org/pkg/compress/gzip/), [zip](http://golang.org/pkg/archive/zip/), [zlib](http://golang.org/pkg/compress/zlib/), [flate](http://golang.org/pkg/compress/flate/).
|
||||
You may also be interested in [pgzip](https://github.com/klauspost/pgzip), which is a drop in replacement for gzip, which support multithreaded compression on big files and the optimized [crc32](https://github.com/klauspost/crc32) package used by these packages.
|
||||
|
||||
The packages contains the same as the standard library, so you can use the godoc for that: [gzip](http://golang.org/pkg/compress/gzip/), [zip](http://golang.org/pkg/archive/zip/), [zlib](http://golang.org/pkg/compress/zlib/), [flate](http://golang.org/pkg/compress/flate/).
|
||||
|
||||
Currently there is only minor speedup on decompression (mostly CRC32 calculation).
|
||||
|
||||
Memory usage is typically 1MB for a Writer. stdlib is in the same range.
|
||||
If you expect to have a lot of concurrently allocated Writers consider using
|
||||
the stateless compression described below.
|
||||
the stateless compress described below.
|
||||
|
||||
For compression performance, see: [this spreadsheet](https://docs.google.com/spreadsheets/d/1nuNE2nPfuINCZJRMt6wFWhKpToF95I47XjSsc-1rbPQ/edit?usp=sharing).
|
||||
|
||||
@@ -688,6 +684,3 @@ Here are other packages of good quality and pure Go (no cgo wrappers or autoconv
|
||||
|
||||
This code is licensed under the same conditions as the original Go code. See LICENSE file.
|
||||
|
||||
|
||||
|
||||
|
||||
+9
-19
@@ -39,6 +39,9 @@ type Decoder struct {
|
||||
|
||||
frame *frameDec
|
||||
|
||||
// Custom dictionaries.
|
||||
dicts map[uint32]*dict
|
||||
|
||||
// streamWg is the waitgroup for all streams
|
||||
streamWg sync.WaitGroup
|
||||
}
|
||||
@@ -98,10 +101,12 @@ func NewReader(r io.Reader, opts ...DOption) (*Decoder, error) {
|
||||
d.current.err = ErrDecoderNilInput
|
||||
}
|
||||
|
||||
// Initialize dict map if needed.
|
||||
if d.o.dicts == nil {
|
||||
d.o.dicts = make(map[uint32]*dict)
|
||||
// Transfer option dicts.
|
||||
d.dicts = make(map[uint32]*dict, len(d.o.dicts))
|
||||
for _, dc := range d.o.dicts {
|
||||
d.dicts[dc.id] = dc
|
||||
}
|
||||
d.o.dicts = nil
|
||||
|
||||
// Create decoders
|
||||
d.decoders = make(chan *blockDec, d.o.concurrent)
|
||||
@@ -233,21 +238,6 @@ func (d *Decoder) Reset(r io.Reader) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ResetWithOptions will reset the decoder and apply the given options
|
||||
// for the next stream or DecodeAll operation.
|
||||
// Options are applied on top of the existing options.
|
||||
// Some options cannot be changed on reset and will return an error.
|
||||
func (d *Decoder) ResetWithOptions(r io.Reader, opts ...DOption) error {
|
||||
d.o.resetOpt = true
|
||||
defer func() { d.o.resetOpt = false }()
|
||||
for _, o := range opts {
|
||||
if err := o(&d.o); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return d.Reset(r)
|
||||
}
|
||||
|
||||
// drainOutput will drain the output until errEndOfStream is sent.
|
||||
func (d *Decoder) drainOutput() {
|
||||
if d.current.cancel != nil {
|
||||
@@ -940,7 +930,7 @@ decodeStream:
|
||||
}
|
||||
|
||||
func (d *Decoder) setDict(frame *frameDec) (err error) {
|
||||
dict, ok := d.o.dicts[frame.DictionaryID]
|
||||
dict, ok := d.dicts[frame.DictionaryID]
|
||||
if ok {
|
||||
if debugDecoder {
|
||||
println("setting dict", frame.DictionaryID)
|
||||
|
||||
+8
-52
@@ -20,11 +20,10 @@ type decoderOptions struct {
|
||||
concurrent int
|
||||
maxDecodedSize uint64
|
||||
maxWindowSize uint64
|
||||
dicts map[uint32]*dict
|
||||
dicts []*dict
|
||||
ignoreChecksum bool
|
||||
limitToCap bool
|
||||
decodeBufsBelow int
|
||||
resetOpt bool
|
||||
}
|
||||
|
||||
func (o *decoderOptions) setDefault() {
|
||||
@@ -43,15 +42,8 @@ func (o *decoderOptions) setDefault() {
|
||||
|
||||
// WithDecoderLowmem will set whether to use a lower amount of memory,
|
||||
// but possibly have to allocate more while running.
|
||||
// Cannot be changed with ResetWithOptions.
|
||||
func WithDecoderLowmem(b bool) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
if o.resetOpt && b != o.lowMem {
|
||||
return errors.New("WithDecoderLowmem cannot be changed on Reset")
|
||||
}
|
||||
o.lowMem = b
|
||||
return nil
|
||||
}
|
||||
return func(o *decoderOptions) error { o.lowMem = b; return nil }
|
||||
}
|
||||
|
||||
// WithDecoderConcurrency sets the number of created decoders.
|
||||
@@ -61,23 +53,18 @@ func WithDecoderLowmem(b bool) DOption {
|
||||
// inflight blocks.
|
||||
// When decoding streams and setting maximum to 1,
|
||||
// no async decoding will be done.
|
||||
// The value supplied must be at least 0.
|
||||
// When a value of 0 is provided GOMAXPROCS will be used.
|
||||
// By default this will be set to 4 or GOMAXPROCS, whatever is lower.
|
||||
// Cannot be changed with ResetWithOptions.
|
||||
func WithDecoderConcurrency(n int) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
if n < 0 {
|
||||
return errors.New("concurrency must be at least 0")
|
||||
return errors.New("concurrency must be at least 1")
|
||||
}
|
||||
newVal := n
|
||||
if n == 0 {
|
||||
newVal = runtime.GOMAXPROCS(0)
|
||||
o.concurrent = runtime.GOMAXPROCS(0)
|
||||
} else {
|
||||
o.concurrent = n
|
||||
}
|
||||
if o.resetOpt && newVal != o.concurrent {
|
||||
return errors.New("WithDecoderConcurrency cannot be changed on Reset")
|
||||
}
|
||||
o.concurrent = newVal
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -86,7 +73,6 @@ func WithDecoderConcurrency(n int) DOption {
|
||||
// non-streaming operations or maximum window size for streaming operations.
|
||||
// This can be used to control memory usage of potentially hostile content.
|
||||
// Maximum is 1 << 63 bytes. Default is 64GiB.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithDecoderMaxMemory(n uint64) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
if n == 0 {
|
||||
@@ -106,20 +92,16 @@ func WithDecoderMaxMemory(n uint64) DOption {
|
||||
// "zstd --train" from the Zstandard reference implementation.
|
||||
//
|
||||
// If several dictionaries with the same ID are provided, the last one will be used.
|
||||
// Can be changed with ResetWithOptions.
|
||||
//
|
||||
// [dictionary format]: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#dictionary-format
|
||||
func WithDecoderDicts(dicts ...[]byte) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
if o.dicts == nil {
|
||||
o.dicts = make(map[uint32]*dict)
|
||||
}
|
||||
for _, b := range dicts {
|
||||
d, err := loadDict(b)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o.dicts[d.id] = d
|
||||
o.dicts = append(o.dicts, d)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -127,16 +109,12 @@ func WithDecoderDicts(dicts ...[]byte) DOption {
|
||||
|
||||
// WithDecoderDictRaw registers a dictionary that may be used by the decoder.
|
||||
// The slice content can be arbitrary data.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithDecoderDictRaw(id uint32, content []byte) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
if bits.UintSize > 32 && uint(len(content)) > dictMaxLength {
|
||||
return fmt.Errorf("dictionary of size %d > 2GiB too large", len(content))
|
||||
}
|
||||
if o.dicts == nil {
|
||||
o.dicts = make(map[uint32]*dict)
|
||||
}
|
||||
o.dicts[id] = &dict{id: id, content: content, offsets: [3]int{1, 4, 8}}
|
||||
o.dicts = append(o.dicts, &dict{id: id, content: content, offsets: [3]int{1, 4, 8}})
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -146,7 +124,6 @@ func WithDecoderDictRaw(id uint32, content []byte) DOption {
|
||||
// The Decoder will likely allocate more memory based on the WithDecoderLowmem setting.
|
||||
// If WithDecoderMaxMemory is set to a lower value, that will be used.
|
||||
// Default is 512MB, Maximum is ~3.75 TB as per zstandard spec.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithDecoderMaxWindow(size uint64) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
if size < MinWindowSize {
|
||||
@@ -164,7 +141,6 @@ func WithDecoderMaxWindow(size uint64) DOption {
|
||||
// or any size set in WithDecoderMaxMemory.
|
||||
// This can be used to limit decoding to a specific maximum output size.
|
||||
// Disabled by default.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithDecodeAllCapLimit(b bool) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
o.limitToCap = b
|
||||
@@ -177,37 +153,17 @@ func WithDecodeAllCapLimit(b bool) DOption {
|
||||
// This typically uses less allocations but will have the full decompressed object in memory.
|
||||
// Note that DecodeAllCapLimit will disable this, as well as giving a size of 0 or less.
|
||||
// Default is 128KiB.
|
||||
// Cannot be changed with ResetWithOptions.
|
||||
func WithDecodeBuffersBelow(size int) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
if o.resetOpt && size != o.decodeBufsBelow {
|
||||
return errors.New("WithDecodeBuffersBelow cannot be changed on Reset")
|
||||
}
|
||||
o.decodeBufsBelow = size
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// IgnoreChecksum allows to forcibly ignore checksum checking.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func IgnoreChecksum(b bool) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
o.ignoreChecksum = b
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithDecoderDictDelete removes dictionaries by ID.
|
||||
// If no ids are passed, all dictionaries are deleted.
|
||||
// Should be used with ResetWithOptions.
|
||||
func WithDecoderDictDelete(ids ...uint32) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
if len(ids) == 0 {
|
||||
clear(o.dicts)
|
||||
}
|
||||
for _, id := range ids {
|
||||
delete(o.dicts, id)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
-16
@@ -131,22 +131,6 @@ func (e *Encoder) Reset(w io.Writer) {
|
||||
s.frameContentSize = 0
|
||||
}
|
||||
|
||||
// ResetWithOptions will re-initialize the writer and apply the given options
|
||||
// as a new, independent stream.
|
||||
// Options are applied on top of the existing options.
|
||||
// Some options cannot be changed on reset and will return an error.
|
||||
func (e *Encoder) ResetWithOptions(w io.Writer, opts ...EOption) error {
|
||||
e.o.resetOpt = true
|
||||
defer func() { e.o.resetOpt = false }()
|
||||
for _, o := range opts {
|
||||
if err := o(&e.o); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
e.Reset(w)
|
||||
return nil
|
||||
}
|
||||
|
||||
// ResetContentSize will reset and set a content size for the next stream.
|
||||
// If the bytes written does not match the size given an error will be returned
|
||||
// when calling Close().
|
||||
|
||||
+3
-41
@@ -14,7 +14,6 @@ type EOption func(*encoderOptions) error
|
||||
|
||||
// options retains accumulated state of multiple options.
|
||||
type encoderOptions struct {
|
||||
resetOpt bool
|
||||
concurrent int
|
||||
level EncoderLevel
|
||||
single *bool
|
||||
@@ -72,28 +71,19 @@ func (o encoderOptions) encoder() encoder {
|
||||
|
||||
// WithEncoderCRC will add CRC value to output.
|
||||
// Output will be 4 bytes larger.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithEncoderCRC(b bool) EOption {
|
||||
return func(o *encoderOptions) error { o.crc = b; return nil }
|
||||
}
|
||||
|
||||
// WithEncoderConcurrency will set the concurrency,
|
||||
// meaning the maximum number of encoders to run concurrently.
|
||||
// The value supplied must be at least 0.
|
||||
// When a value of 0 is provided GOMAXPROCS will be used.
|
||||
// The value supplied must be at least 1.
|
||||
// For streams, setting a value of 1 will disable async compression.
|
||||
// By default this will be set to GOMAXPROCS.
|
||||
// Cannot be changed with ResetWithOptions.
|
||||
func WithEncoderConcurrency(n int) EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
if n < 0 {
|
||||
return errors.New("concurrency must at least 0")
|
||||
}
|
||||
if n == 0 {
|
||||
n = runtime.GOMAXPROCS(0)
|
||||
}
|
||||
if o.resetOpt && n != o.concurrent {
|
||||
return errors.New("WithEncoderConcurrency cannot be changed on Reset")
|
||||
if n <= 0 {
|
||||
return fmt.Errorf("concurrency must be at least 1")
|
||||
}
|
||||
o.concurrent = n
|
||||
return nil
|
||||
@@ -105,7 +95,6 @@ func WithEncoderConcurrency(n int) EOption {
|
||||
// A larger value will enable better compression but allocate more memory and,
|
||||
// for above-default values, take considerably longer.
|
||||
// The default value is determined by the compression level and max 8MB.
|
||||
// Cannot be changed with ResetWithOptions.
|
||||
func WithWindowSize(n int) EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
switch {
|
||||
@@ -116,9 +105,6 @@ func WithWindowSize(n int) EOption {
|
||||
case (n & (n - 1)) != 0:
|
||||
return errors.New("window size must be a power of 2")
|
||||
}
|
||||
if o.resetOpt && n != o.windowSize {
|
||||
return errors.New("WithWindowSize cannot be changed on Reset")
|
||||
}
|
||||
|
||||
o.windowSize = n
|
||||
o.customWindow = true
|
||||
@@ -136,7 +122,6 @@ func WithWindowSize(n int) EOption {
|
||||
// n must be > 0 and <= 1GB, 1<<30 bytes.
|
||||
// The padded area will be filled with data from crypto/rand.Reader.
|
||||
// If `EncodeAll` is used with data already in the destination, the total size will be multiple of this.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithEncoderPadding(n int) EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
if n <= 0 {
|
||||
@@ -230,16 +215,12 @@ func (e EncoderLevel) String() string {
|
||||
}
|
||||
|
||||
// WithEncoderLevel specifies a predefined compression level.
|
||||
// Cannot be changed with ResetWithOptions.
|
||||
func WithEncoderLevel(l EncoderLevel) EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
switch {
|
||||
case l <= speedNotSet || l >= speedLast:
|
||||
return fmt.Errorf("unknown encoder level")
|
||||
}
|
||||
if o.resetOpt && l != o.level {
|
||||
return errors.New("WithEncoderLevel cannot be changed on Reset")
|
||||
}
|
||||
o.level = l
|
||||
if !o.customWindow {
|
||||
switch o.level {
|
||||
@@ -267,7 +248,6 @@ func WithEncoderLevel(l EncoderLevel) EOption {
|
||||
// WithZeroFrames will encode 0 length input as full frames.
|
||||
// This can be needed for compatibility with zstandard usage,
|
||||
// but is not needed for this package.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithZeroFrames(b bool) EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
o.fullZero = b
|
||||
@@ -279,7 +259,6 @@ func WithZeroFrames(b bool) EOption {
|
||||
// Disabling this will skip incompressible data faster, but in cases with no matches but
|
||||
// skewed character distribution compression is lost.
|
||||
// Default value depends on the compression level selected.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithAllLitEntropyCompression(b bool) EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
o.customALEntropy = true
|
||||
@@ -291,7 +270,6 @@ func WithAllLitEntropyCompression(b bool) EOption {
|
||||
// WithNoEntropyCompression will always skip entropy compression of literals.
|
||||
// This can be useful if content has matches, but unlikely to benefit from entropy
|
||||
// compression. Usually the slight speed improvement is not worth enabling this.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithNoEntropyCompression(b bool) EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
o.noEntropy = b
|
||||
@@ -309,7 +287,6 @@ func WithNoEntropyCompression(b bool) EOption {
|
||||
// This is only a recommendation, each decoder is free to support higher or lower limits, depending on local limitations.
|
||||
// If this is not specified, block encodes will automatically choose this based on the input size and the window size.
|
||||
// This setting has no effect on streamed encodes.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithSingleSegment(b bool) EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
o.single = &b
|
||||
@@ -321,12 +298,8 @@ func WithSingleSegment(b bool) EOption {
|
||||
// slower encoding speed.
|
||||
// This will not change the window size which is the primary function for reducing
|
||||
// memory usage. See WithWindowSize.
|
||||
// Cannot be changed with ResetWithOptions.
|
||||
func WithLowerEncoderMem(b bool) EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
if o.resetOpt && b != o.lowMem {
|
||||
return errors.New("WithLowerEncoderMem cannot be changed on Reset")
|
||||
}
|
||||
o.lowMem = b
|
||||
return nil
|
||||
}
|
||||
@@ -338,7 +311,6 @@ func WithLowerEncoderMem(b bool) EOption {
|
||||
// "zstd --train" from the Zstandard reference implementation.
|
||||
//
|
||||
// The encoder *may* choose to use no dictionary instead for certain payloads.
|
||||
// Can be changed with ResetWithOptions.
|
||||
//
|
||||
// [dictionary format]: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#dictionary-format
|
||||
func WithEncoderDict(dict []byte) EOption {
|
||||
@@ -356,7 +328,6 @@ func WithEncoderDict(dict []byte) EOption {
|
||||
//
|
||||
// The slice content may contain arbitrary data. It will be used as an initial
|
||||
// history.
|
||||
// Can be changed with ResetWithOptions.
|
||||
func WithEncoderDictRaw(id uint32, content []byte) EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
if bits.UintSize > 32 && uint(len(content)) > dictMaxLength {
|
||||
@@ -366,12 +337,3 @@ func WithEncoderDictRaw(id uint32, content []byte) EOption {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithEncoderDictDelete clears the dictionary, so no dictionary will be used.
|
||||
// Should be used with ResetWithOptions.
|
||||
func WithEncoderDictDelete() EOption {
|
||||
return func(o *encoderOptions) error {
|
||||
o.dict = nil
|
||||
return nil
|
||||
}
|
||||
}
|
||||
+6
-9
@@ -152,22 +152,19 @@ type Mapping map[Subject][]WeightedMapping
|
||||
func (m *Mapping) Validate(vr *ValidationResults) {
|
||||
for ubFrom, wm := range (map[Subject][]WeightedMapping)(*m) {
|
||||
ubFrom.Validate(vr)
|
||||
perCluster := make(map[string]uint32)
|
||||
total := uint32(0)
|
||||
perCluster := make(map[string]uint8)
|
||||
total := uint8(0)
|
||||
for _, e := range wm {
|
||||
e.Subject.Validate(vr)
|
||||
if e.GetWeight() > 100 {
|
||||
vr.AddError("Mapping %q has a weight %d that exceeds 100", ubFrom, e.GetWeight())
|
||||
}
|
||||
if e.Cluster != "" {
|
||||
t := perCluster[e.Cluster]
|
||||
t += uint32(e.GetWeight())
|
||||
t += e.Weight
|
||||
perCluster[e.Cluster] = t
|
||||
if t > 100 {
|
||||
vr.AddError("Mapping %q in cluster %q exceeds 100%% among all of it's weighted to mappings", ubFrom, e.Cluster)
|
||||
}
|
||||
} else {
|
||||
total += uint32(e.GetWeight())
|
||||
total += e.GetWeight()
|
||||
}
|
||||
}
|
||||
if total > 100 {
|
||||
@@ -289,7 +286,7 @@ func (a *Account) Validate(acct *AccountClaims, vr *ValidationResults) {
|
||||
tvr := CreateValidationResults()
|
||||
a.Trace.Destination.Validate(tvr)
|
||||
if !tvr.IsEmpty() {
|
||||
vr.AddError("the account Trace.Destination %s", tvr.Issues[0].Description)
|
||||
vr.AddError(fmt.Sprintf("the account Trace.Destination %s", tvr.Issues[0].Description))
|
||||
}
|
||||
if a.Trace.Destination.HasWildCards() {
|
||||
vr.AddError("the account Trace.Destination subject %q is not a valid publish subject", a.Trace.Destination)
|
||||
@@ -328,7 +325,7 @@ func (a *Account) Validate(acct *AccountClaims, vr *ValidationResults) {
|
||||
a.Info.Validate(vr)
|
||||
|
||||
if err := a.ClusterTraffic.Valid(); err != nil {
|
||||
vr.AddError("%s", err.Error())
|
||||
vr.AddError(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-15
@@ -63,9 +63,6 @@ func formatJwt(kind string, jwtString string) ([]byte, error) {
|
||||
func DecorateSeed(seed []byte) ([]byte, error) {
|
||||
w := bytes.NewBuffer(nil)
|
||||
ts := bytes.TrimSpace(seed)
|
||||
if len(ts) < 2 {
|
||||
return nil, errors.New("seed is too short")
|
||||
}
|
||||
pre := string(ts[0:2])
|
||||
kind := ""
|
||||
switch pre {
|
||||
@@ -141,18 +138,6 @@ func FormatUserConfig(jwtString string, seed []byte) ([]byte, error) {
|
||||
return nil, fmt.Errorf("nkey seed is not an user seed")
|
||||
}
|
||||
|
||||
kp, err := nkeys.FromSeed(seed)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pk, err := kp.PublicKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if pk != gc.Claims().Subject {
|
||||
return nil, fmt.Errorf("nkey seed does not match the jwt subject")
|
||||
}
|
||||
|
||||
d, err := DecorateSeed(seed)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
-9
@@ -26,12 +26,6 @@ import (
|
||||
|
||||
const libVersion = 2
|
||||
|
||||
// MaxTokenSize is the maximum size of a JWT token in bytes
|
||||
const MaxTokenSize = 1024 * 1024 // 1MB
|
||||
|
||||
// ErrTokenTooLarge is returned when a token exceeds MaxTokenSize
|
||||
var ErrTokenTooLarge = errors.New("token too large")
|
||||
|
||||
type identifier struct {
|
||||
Type ClaimType `json:"type,omitempty"`
|
||||
GenericFields `json:"nats,omitempty"`
|
||||
@@ -62,9 +56,6 @@ type v1ClaimsDataDeletedFields struct {
|
||||
// doesn't match the expected algorithm, or the claim is
|
||||
// not valid or verification fails an error is returned.
|
||||
func Decode(token string) (Claims, error) {
|
||||
if len(token) > MaxTokenSize {
|
||||
return nil, fmt.Errorf("token size %d exceeds maximum of %d bytes: %w", len(token), MaxTokenSize, ErrTokenTooLarge)
|
||||
}
|
||||
// must have 3 chunks
|
||||
chunks := strings.Split(token, ".")
|
||||
if len(chunks) != 3 {
|
||||
|
||||
+7
-12
@@ -126,8 +126,7 @@ type Imports []*Import
|
||||
|
||||
// Validate checks if an import is valid for the wrapping account
|
||||
func (i *Imports) Validate(acctPubKey string, vr *ValidationResults) {
|
||||
// Group subjects by account to check for overlaps only within the same account
|
||||
subsByAcct := make(map[string]map[Subject]struct{}, len(*i))
|
||||
toSet := make(map[Subject]struct{}, len(*i))
|
||||
for _, v := range *i {
|
||||
if v == nil {
|
||||
vr.AddError("null import is not allowed")
|
||||
@@ -141,19 +140,15 @@ func (i *Imports) Validate(acctPubKey string, vr *ValidationResults) {
|
||||
if sub == "" {
|
||||
sub = v.Subject
|
||||
}
|
||||
// Check for overlapping subjects only within the same account
|
||||
for subOther := range subsByAcct[v.Account] {
|
||||
if sub.IsContainedIn(subOther) || subOther.IsContainedIn(sub) {
|
||||
vr.AddError("overlapping subject namespace for %q and %q in same account %q", sub, subOther, v.Account)
|
||||
for k := range toSet {
|
||||
if sub.IsContainedIn(k) || k.IsContainedIn(sub) {
|
||||
vr.AddError("overlapping subject namespace for %q and %q", sub, k)
|
||||
}
|
||||
}
|
||||
if subsByAcct[v.Account] == nil {
|
||||
subsByAcct[v.Account] = make(map[Subject]struct{}, len(*i))
|
||||
if _, ok := toSet[sub]; ok {
|
||||
vr.AddError("overlapping subject namespace for %q", v.To)
|
||||
}
|
||||
if _, ok := subsByAcct[v.Account][sub]; ok {
|
||||
vr.AddError("overlapping subject namespace for %q in account %q", sub, v.Account)
|
||||
}
|
||||
subsByAcct[v.Account][sub] = struct{}{}
|
||||
toSet[sub] = struct{}{}
|
||||
}
|
||||
v.Validate(acctPubKey, vr)
|
||||
}
|
||||
|
||||
+2
-2
@@ -71,12 +71,12 @@ func ParseServerVersion(version string) (int, int, int, error) {
|
||||
// Validate checks the validity of the operators contents
|
||||
func (o *Operator) Validate(vr *ValidationResults) {
|
||||
if err := o.validateAccountServerURL(); err != nil {
|
||||
vr.AddError("%s", err.Error())
|
||||
vr.AddError(err.Error())
|
||||
}
|
||||
|
||||
for _, v := range o.validateOperatorServiceURLs() {
|
||||
if v != nil {
|
||||
vr.AddError("%s", v.Error())
|
||||
vr.AddError(v.Error())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+24
-10
@@ -114,28 +114,42 @@ func ParseFileWithChecks(fp string) (map[string]any, error) {
|
||||
return p.mapping, nil
|
||||
}
|
||||
|
||||
// configDigest returns a digest for the parsed config.
|
||||
func configDigest(m map[string]any) (string, error) {
|
||||
digest := sha256.New()
|
||||
e := json.NewEncoder(digest)
|
||||
if err := e.Encode(m); err != nil {
|
||||
return _EMPTY_, err
|
||||
// cleanupUsedEnvVars will recursively remove all already used
|
||||
// environment variables which might be in the parsed tree.
|
||||
func cleanupUsedEnvVars(m map[string]any) {
|
||||
for k, v := range m {
|
||||
t := v.(*token)
|
||||
if t.usedVariable {
|
||||
delete(m, k)
|
||||
continue
|
||||
}
|
||||
// Cleanup any other env var that is still in the map.
|
||||
if tm, ok := t.value.(map[string]any); ok {
|
||||
cleanupUsedEnvVars(tm)
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("sha256:%x", digest.Sum(nil)), nil
|
||||
}
|
||||
|
||||
// ParseFileWithChecksDigest returns the processed config and a digest
|
||||
// that represents the configuration.
|
||||
func ParseFileWithChecksDigest(fp string) (map[string]any, string, error) {
|
||||
m, err := ParseFileWithChecks(fp)
|
||||
data, err := os.ReadFile(fp)
|
||||
if err != nil {
|
||||
return nil, _EMPTY_, err
|
||||
}
|
||||
digest, err := configDigest(m)
|
||||
p, err := parse(string(data), fp, true)
|
||||
if err != nil {
|
||||
return nil, _EMPTY_, err
|
||||
}
|
||||
return m, digest, nil
|
||||
// Filter out any environment variables before taking the digest.
|
||||
cleanupUsedEnvVars(p.mapping)
|
||||
digest := sha256.New()
|
||||
e := json.NewEncoder(digest)
|
||||
err = e.Encode(p.mapping)
|
||||
if err != nil {
|
||||
return nil, _EMPTY_, err
|
||||
}
|
||||
return p.mapping, fmt.Sprintf("sha256:%x", digest.Sum(nil)), nil
|
||||
}
|
||||
|
||||
type token struct {
|
||||
|
||||
+10
-10
@@ -235,19 +235,19 @@ func (d *DN) RDNsMatch(other *DN) bool {
|
||||
if len(d.RDNs) != len(other.RDNs) {
|
||||
return false
|
||||
}
|
||||
matched := make([]bool, len(other.RDNs))
|
||||
|
||||
CheckNextRDN:
|
||||
for _, irdn := range d.RDNs {
|
||||
found := false
|
||||
for j, ordn := range other.RDNs {
|
||||
if !matched[j] && irdn.Equal(ordn) {
|
||||
matched[j] = true
|
||||
found = true
|
||||
break
|
||||
for _, ordn := range other.RDNs {
|
||||
if (len(irdn.Attributes) == len(ordn.Attributes)) &&
|
||||
(irdn.hasAllAttributes(ordn.Attributes) && ordn.hasAllAttributes(irdn.Attributes)) {
|
||||
// Found the RDN, check if next one matches.
|
||||
continue CheckNextRDN
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return false
|
||||
}
|
||||
|
||||
// Could not find a matching individual RDN, auth fails.
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
+10
-20
@@ -138,12 +138,6 @@ type sconns struct {
|
||||
leafs int32
|
||||
}
|
||||
|
||||
// clampInt64ToInt32 safely converts an int64 limit to int32,
|
||||
// clamping values to the [math.MinInt32, math.MaxInt32] range.
|
||||
func clampInt64ToInt32(v int64) int32 {
|
||||
return int32(max(math.MinInt32, min(math.MaxInt32, v)))
|
||||
}
|
||||
|
||||
// Import stream mapping struct
|
||||
type streamImport struct {
|
||||
acc *Account
|
||||
@@ -1616,12 +1610,10 @@ func (a *Account) checkServiceImportsForCycles(from string, visited map[string]b
|
||||
}
|
||||
// Push ourselves and check si.acc
|
||||
visited[a.Name] = true
|
||||
// Make a copy to not overwrite the passed value.
|
||||
f := from
|
||||
if subjectIsSubsetMatch(si.from, f) {
|
||||
f = si.from
|
||||
if subjectIsSubsetMatch(si.from, from) {
|
||||
from = si.from
|
||||
}
|
||||
if err := si.acc.checkServiceImportsForCycles(f, visited); err != nil {
|
||||
if err := si.acc.checkServiceImportsForCycles(from, visited); err != nil {
|
||||
return err
|
||||
}
|
||||
a.mu.RLock()
|
||||
@@ -1676,12 +1668,10 @@ func (a *Account) checkStreamImportsForCycles(to string, visited map[string]bool
|
||||
}
|
||||
// Push ourselves and check si.acc
|
||||
visited[a.Name] = true
|
||||
// Make a copy to not overwrite the passed value.
|
||||
t := to
|
||||
if subjectIsSubsetMatch(si.to, t) {
|
||||
t = si.to
|
||||
if subjectIsSubsetMatch(si.to, to) {
|
||||
to = si.to
|
||||
}
|
||||
if err := si.acc.checkStreamImportsForCycles(t, visited); err != nil {
|
||||
if err := si.acc.checkStreamImportsForCycles(to, visited); err != nil {
|
||||
return err
|
||||
}
|
||||
a.mu.RLock()
|
||||
@@ -3726,10 +3716,10 @@ func (s *Server) updateAccountClaimsWithRefresh(a *Account, ac *jwt.AccountClaim
|
||||
|
||||
// Now do limits if they are present.
|
||||
a.mu.Lock()
|
||||
a.msubs = clampInt64ToInt32(ac.Limits.Subs)
|
||||
a.mpay = clampInt64ToInt32(ac.Limits.Payload)
|
||||
a.mconns = clampInt64ToInt32(ac.Limits.Conn)
|
||||
a.mleafs = clampInt64ToInt32(ac.Limits.LeafNodeConn)
|
||||
a.msubs = int32(ac.Limits.Subs)
|
||||
a.mpay = int32(ac.Limits.Payload)
|
||||
a.mconns = int32(ac.Limits.Conn)
|
||||
a.mleafs = int32(ac.Limits.LeafNodeConn)
|
||||
a.disallowBearer = ac.Limits.DisallowBearer
|
||||
// Check for any revocations
|
||||
if len(ac.Revocations) > 0 {
|
||||
|
||||
+7
-36
@@ -421,9 +421,7 @@ func (c *client) matchesPinnedCert(tlsPinnedCerts PinnedCertSet) bool {
|
||||
}
|
||||
|
||||
var (
|
||||
mustacheRE = regexp.MustCompile(`{{2}([^}]+)}{2}`)
|
||||
maxPermTemplateSubjectExpansions = 4096
|
||||
errPermTemplateExpansionLimit error = fmt.Errorf("template expansion exceeds limit")
|
||||
mustacheRE = regexp.MustCompile(`{{2}([^}]+)}{2}`)
|
||||
)
|
||||
|
||||
func processUserPermissionsTemplate(lim jwt.UserPermissionLimits, ujwt *jwt.UserClaims, acc *Account) (jwt.UserPermissionLimits, error) {
|
||||
@@ -458,11 +456,11 @@ func processUserPermissionsTemplate(lim jwt.UserPermissionLimits, ujwt *jwt.User
|
||||
return p
|
||||
}
|
||||
isTag := func(op string) []string {
|
||||
if len(op) >= 4 && strings.EqualFold("tag(", op[:4]) && strings.HasSuffix(op, ")") {
|
||||
if strings.EqualFold("tag(", op[:4]) && strings.HasSuffix(op, ")") {
|
||||
v := strings.TrimPrefix(op, "tag(")
|
||||
v = strings.TrimSuffix(v, ")")
|
||||
return []string{"tag", v}
|
||||
} else if len(op) >= 12 && strings.EqualFold("account-tag(", op[:12]) && strings.HasSuffix(op, ")") {
|
||||
} else if strings.EqualFold("account-tag(", op[:12]) && strings.HasSuffix(op, ")") {
|
||||
v := strings.TrimPrefix(op, "account-tag(")
|
||||
v = strings.TrimSuffix(v, ")")
|
||||
return []string{"account-tag", v}
|
||||
@@ -531,7 +529,7 @@ func processUserPermissionsTemplate(lim jwt.UserPermissionLimits, ujwt *jwt.User
|
||||
// generate an invalid subject?
|
||||
values[tokenNum] = []string{" "}
|
||||
}
|
||||
} else {
|
||||
} else if failOnBadSubject {
|
||||
return nil, fmt.Errorf("template operation in %q: %q is not defined", list[i], op)
|
||||
}
|
||||
}
|
||||
@@ -546,20 +544,6 @@ func processUserPermissionsTemplate(lim jwt.UserPermissionLimits, ujwt *jwt.User
|
||||
return nil, fmt.Errorf("generated invalid subject")
|
||||
}
|
||||
} else {
|
||||
expCount := 1
|
||||
for _, v := range values {
|
||||
if len(v) == 0 {
|
||||
expCount = 0
|
||||
break
|
||||
}
|
||||
if expCount > maxPermTemplateSubjectExpansions/len(v) {
|
||||
return nil, fmt.Errorf("%w: %d", errPermTemplateExpansionLimit, maxPermTemplateSubjectExpansions)
|
||||
}
|
||||
expCount *= len(v)
|
||||
}
|
||||
if len(emittedList) > maxPermTemplateSubjectExpansions-expCount {
|
||||
return nil, fmt.Errorf("%w: %d", errPermTemplateExpansionLimit, maxPermTemplateSubjectExpansions)
|
||||
}
|
||||
a := nArrayCartesianProduct(values...)
|
||||
for _, aa := range a {
|
||||
subj := list[i]
|
||||
@@ -604,7 +588,6 @@ func processUserPermissionsTemplate(lim jwt.UserPermissionLimits, ujwt *jwt.User
|
||||
func (s *Server) processClientOrLeafAuthentication(c *client, opts *Options) (authorized bool) {
|
||||
var (
|
||||
nkey *NkeyUser
|
||||
ujwt string
|
||||
juc *jwt.UserClaims
|
||||
acc *Account
|
||||
user *User
|
||||
@@ -799,23 +782,16 @@ func (s *Server) processClientOrLeafAuthentication(c *client, opts *Options) (au
|
||||
|
||||
// Check if we have trustedKeys defined in the server. If so we require a user jwt.
|
||||
if s.trustedKeys != nil {
|
||||
ujwt = c.opts.JWT
|
||||
if ujwt == _EMPTY_ && c.isMqtt() {
|
||||
// For MQTT, we pass the password as the JWT too, but do so here so it's not
|
||||
// publicly exposed in the client options if it isn't a JWT.
|
||||
ujwt = c.opts.Password
|
||||
}
|
||||
if ujwt == _EMPTY_ && opts.DefaultSentinel != _EMPTY_ {
|
||||
if c.opts.JWT == _EMPTY_ && opts.DefaultSentinel != _EMPTY_ {
|
||||
c.opts.JWT = opts.DefaultSentinel
|
||||
ujwt = c.opts.JWT
|
||||
}
|
||||
if ujwt == _EMPTY_ {
|
||||
if c.opts.JWT == _EMPTY_ {
|
||||
s.mu.Unlock()
|
||||
c.Debugf("Authentication requires a user JWT")
|
||||
return false
|
||||
}
|
||||
// So we have a valid user jwt here.
|
||||
juc, err = jwt.DecodeUserClaims(ujwt)
|
||||
juc, err = jwt.DecodeUserClaims(c.opts.JWT)
|
||||
if err != nil {
|
||||
s.mu.Unlock()
|
||||
c.Debugf("User JWT not valid: %v", err)
|
||||
@@ -1085,11 +1061,6 @@ func (s *Server) processClientOrLeafAuthentication(c *client, opts *Options) (au
|
||||
// Hold onto the user's public key.
|
||||
c.mu.Lock()
|
||||
c.pubKey = juc.Subject
|
||||
// If this is a MQTT client, we purposefully didn't populate the JWT as it could contain
|
||||
// a password or token. Now we know it's a valid JWT, we can populate it.
|
||||
if c.isMqtt() {
|
||||
c.opts.JWT = ujwt
|
||||
}
|
||||
c.tags = juc.Tags
|
||||
c.nameTag = juc.Name
|
||||
c.mu.Unlock()
|
||||
|
||||
+8
-15
@@ -32,14 +32,6 @@ const (
|
||||
AuthRequestXKeyHeader = "Nats-Server-Xkey"
|
||||
)
|
||||
|
||||
func titleCase(m string) string {
|
||||
r := []rune(m)
|
||||
if len(r) == 0 {
|
||||
return _EMPTY_
|
||||
}
|
||||
return string(append([]rune{unicode.ToUpper(r[0])}, r[1:]...))
|
||||
}
|
||||
|
||||
// Process a callout on this client's behalf.
|
||||
func (s *Server) processClientOrLeafCallout(c *client, opts *Options, proxyRequired, trustedProxy bool) (authorized bool, errStr string) {
|
||||
isOperatorMode := len(opts.TrustedKeys) > 0
|
||||
@@ -58,13 +50,6 @@ func (s *Server) processClientOrLeafCallout(c *client, opts *Options, proxyRequi
|
||||
} else {
|
||||
acc = c.acc
|
||||
}
|
||||
if acc == nil {
|
||||
// FIX for https://github.com/nats-io/nats-server/issues/7841
|
||||
// hand rolled creds on leafnode became crasher here
|
||||
errStr = fmt.Sprintf("%s not mapped to a callout account", c.kindString())
|
||||
s.Warnf(errStr)
|
||||
return false, errStr
|
||||
}
|
||||
|
||||
// Check if we have been requested to encrypt.
|
||||
var xkp nkeys.KeyPair
|
||||
@@ -81,6 +66,9 @@ func (s *Server) processClientOrLeafCallout(c *client, opts *Options, proxyRequi
|
||||
xkp, xkey = s.xkp, s.info.XKey
|
||||
}
|
||||
|
||||
// FIXME: so things like the server ID that get assigned, are used as a sort of nonce - but
|
||||
// reality is that the keypair here, is generated, so the response generated a JWT has to be
|
||||
// this user - no replay possible
|
||||
// Create a keypair for the user. We will expect this public user to be in the signed response.
|
||||
// This prevents replay attacks.
|
||||
ukp, _ := nkeys.CreateUser()
|
||||
@@ -246,6 +234,11 @@ func (s *Server) processClientOrLeafCallout(c *client, opts *Options, proxyRequi
|
||||
}
|
||||
|
||||
processReply := func(_ *subscription, rc *client, racc *Account, subject, reply string, rmsg []byte) {
|
||||
titleCase := func(m string) string {
|
||||
r := []rune(m)
|
||||
return string(append([]rune{unicode.ToUpper(r[0])}, r[1:]...))
|
||||
}
|
||||
|
||||
arc, err := decodeResponse(rc, rmsg, racc)
|
||||
if err != nil {
|
||||
c.authViolation()
|
||||
|
||||
+96
-173
@@ -153,6 +153,7 @@ const (
|
||||
compressionNegotiated // Marks if this connection has negotiated compression level with remote.
|
||||
didTLSFirst // Marks if this connection requested and was accepted doing the TLS handshake first (prior to INFO).
|
||||
isSlowConsumer // Marks connection as a slow consumer.
|
||||
firstPong // Marks if this is the first PONG received
|
||||
)
|
||||
|
||||
// set the flag (would be equivalent to set the boolean to true)
|
||||
@@ -868,11 +869,6 @@ func (c *client) registerWithAccount(acc *Account) error {
|
||||
}
|
||||
|
||||
c.mu.Lock()
|
||||
// This check does not apply to SYSTEM or JETSTREAM or ACCOUNT clients (because they don't have a `nc`...)
|
||||
if c.isClosed() && !isInternalClient(c.kind) {
|
||||
c.mu.Unlock()
|
||||
return ErrConnectionClosed
|
||||
}
|
||||
kind := c.kind
|
||||
srv := c.srv
|
||||
c.acc = acc
|
||||
@@ -932,14 +928,14 @@ func (c *client) applyAccountLimits() {
|
||||
c.msubs = jwt.NoLimit
|
||||
if c.opts.JWT != _EMPTY_ { // user jwt implies account
|
||||
if uc, _ := jwt.DecodeUserClaims(c.opts.JWT); uc != nil {
|
||||
atomic.StoreInt32(&c.mpay, clampInt64ToInt32(uc.Limits.Payload))
|
||||
c.msubs = clampInt64ToInt32(uc.Limits.Subs)
|
||||
atomic.StoreInt32(&c.mpay, int32(uc.Limits.Payload))
|
||||
c.msubs = int32(uc.Limits.Subs)
|
||||
if uc.IssuerAccount != _EMPTY_ && uc.IssuerAccount != uc.Issuer {
|
||||
if scope, ok := c.acc.signingKeys[uc.Issuer]; ok {
|
||||
if userScope, ok := scope.(*jwt.UserScope); ok {
|
||||
// if signing key disappeared or changed and we don't get here, the client will be disconnected
|
||||
c.mpay = clampInt64ToInt32(userScope.Template.Limits.Payload)
|
||||
c.msubs = clampInt64ToInt32(userScope.Template.Limits.Subs)
|
||||
c.mpay = int32(userScope.Template.Limits.Payload)
|
||||
c.msubs = int32(userScope.Template.Limits.Subs)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1357,13 +1353,6 @@ func (c *client) flushClients(budget time.Duration) time.Time {
|
||||
return last
|
||||
}
|
||||
|
||||
func (c *client) resetReadLoopStallTime() {
|
||||
if c.in.tst >= stallClientMaxDuration {
|
||||
c.rateLimitFormatWarnf("Producer was stalled for a total of %v", c.in.tst.Round(time.Millisecond))
|
||||
}
|
||||
c.in.tst = 0
|
||||
}
|
||||
|
||||
// readLoop is the main socket read functionality.
|
||||
// Runs in its own Go routine.
|
||||
func (c *client) readLoop(pre []byte) {
|
||||
@@ -1441,6 +1430,21 @@ func (c *client) readLoop(pre []byte) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if ws {
|
||||
bufs, err = c.wsRead(wsr, reader, b[:n])
|
||||
if bufs == nil && err != nil {
|
||||
if err != io.EOF {
|
||||
c.Errorf("read error: %v", err)
|
||||
}
|
||||
c.closeConnection(closedStateForErr(err))
|
||||
return
|
||||
} else if bufs == nil {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
bufs[0] = b[:n]
|
||||
}
|
||||
|
||||
// Check if the account has mappings and if so set the local readcache flag.
|
||||
// We check here to make sure any changes such as config reload are reflected here.
|
||||
if c.kind == CLIENT || c.kind == LEAF {
|
||||
@@ -1458,32 +1462,17 @@ func (c *client) readLoop(pre []byte) {
|
||||
c.in.bytes = 0
|
||||
c.in.subs = 0
|
||||
|
||||
if ws {
|
||||
err = c.wsReadAndParse(wsr, reader, b[:n])
|
||||
if err != nil {
|
||||
// Match the normal parse path: any already-buffered deliveries
|
||||
// need their pending flush signals drained before we close.
|
||||
c.flushClients(0)
|
||||
if err != io.EOF {
|
||||
c.Errorf("read error: %v", err)
|
||||
}
|
||||
c.closeConnection(closedStateForErr(err))
|
||||
return
|
||||
}
|
||||
c.resetReadLoopStallTime()
|
||||
goto postParse
|
||||
} else {
|
||||
bufs[0] = b[:n]
|
||||
}
|
||||
|
||||
// Main call into parser for inbound data. This will generate callouts
|
||||
// to process messages, etc.
|
||||
for i := 0; i < len(bufs); i++ {
|
||||
if err := c.parse(bufs[i]); err != nil {
|
||||
if err == ErrMinimumVersionRequired {
|
||||
// Special case here, currently only for leaf node connections.
|
||||
// processLeafConnect() already sent the rejection and closed
|
||||
// the connection, so there is nothing else to do here.
|
||||
// When process the CONNECT protocol, if the minimum version
|
||||
// required was not met, an error was printed and sent back to
|
||||
// the remote, and connection was closed after a certain delay
|
||||
// (to avoid "rapid" reconnection from the remote).
|
||||
// We don't need to do any of the things below, simply return.
|
||||
return
|
||||
}
|
||||
if dur := time.Since(c.in.start); dur >= readLoopReportThreshold {
|
||||
@@ -1500,10 +1489,13 @@ func (c *client) readLoop(pre []byte) {
|
||||
}
|
||||
return
|
||||
}
|
||||
c.resetReadLoopStallTime()
|
||||
// Clear total stalled time here.
|
||||
if c.in.tst >= stallClientMaxDuration {
|
||||
c.rateLimitFormatWarnf("Producer was stalled for a total of %v", c.in.tst.Round(time.Millisecond))
|
||||
}
|
||||
c.in.tst = 0
|
||||
}
|
||||
|
||||
postParse:
|
||||
// If we are a ROUTER/LEAF and have processed an INFO, it is possible that
|
||||
// we are asked to switch to compression now.
|
||||
if checkCompress && c.in.flags.isSet(switchToCompression) {
|
||||
@@ -1694,11 +1686,9 @@ func (c *client) flushOutbound() bool {
|
||||
|
||||
cw.Reset(&bb)
|
||||
for _, buf := range collapsed {
|
||||
if err == nil {
|
||||
_, err = cw.Write(buf)
|
||||
if _, err = cw.Write(buf); err != nil {
|
||||
break
|
||||
}
|
||||
// Return always after consumed or error.
|
||||
nbPoolPut(buf)
|
||||
}
|
||||
if err == nil {
|
||||
err = cw.Close()
|
||||
@@ -2123,37 +2113,41 @@ func (c *client) processErr(errStr string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Matcher for pass/password and auth_token fields.
|
||||
var prefixAuthPat = regexp.MustCompile(`"?\s*(?:auth_token\S*?|pass\S*?)"?\s*[:=]\s*"?([^",\r\n}]*)`)
|
||||
|
||||
// Exact matcher for fields sig, proxy_sig and nkey.
|
||||
// Overlapping field "sig" does not match inside "proxy_sig".
|
||||
var exactAuthPat = regexp.MustCompile(`(?:^|[^A-Za-z0-9_])"?\s*(?:proxy_sig|nkey|sig)"?\s*[:=]\s*"?([^",\r\n}]*)`)
|
||||
// Password pattern matcher.
|
||||
var passPat = regexp.MustCompile(`"?\s*pass\S*?"?\s*[:=]\s*"?(([^",\r\n}])*)`)
|
||||
var tokenPat = regexp.MustCompile(`"?\s*auth_token\S*?"?\s*[:=]\s*"?(([^",\r\n}])*)`)
|
||||
|
||||
// removeSecretsFromTrace removes any notion of passwords/tokens from trace
|
||||
// messages for logging.
|
||||
func removeSecretsFromTrace(arg []byte) []byte {
|
||||
buf := redact(prefixAuthPat, arg)
|
||||
return redact(exactAuthPat, buf)
|
||||
buf := redact("pass", passPat, arg)
|
||||
return redact("auth_token", tokenPat, buf)
|
||||
}
|
||||
|
||||
func redact(pat *regexp.Regexp, proto []byte) []byte {
|
||||
m := pat.FindAllSubmatchIndex(proto, -1)
|
||||
if len(m) == 0 {
|
||||
func redact(name string, pat *regexp.Regexp, proto []byte) []byte {
|
||||
if !bytes.Contains(proto, []byte(name)) {
|
||||
return proto
|
||||
}
|
||||
// Take a copy of the connect proto just for the trace message.
|
||||
var _arg [4096]byte
|
||||
buf := append(_arg[:0], proto...)
|
||||
|
||||
m := pat.FindAllSubmatchIndex(buf, -1)
|
||||
if len(m) == 0 {
|
||||
return proto
|
||||
}
|
||||
|
||||
redactedPass := []byte("[REDACTED]")
|
||||
for i := len(m) - 1; i >= 0; i-- {
|
||||
match := m[i]
|
||||
if len(match) < 4 {
|
||||
for _, i := range m {
|
||||
if len(i) < 4 {
|
||||
continue
|
||||
}
|
||||
start, end := match[2], match[3]
|
||||
start := i[2]
|
||||
end := i[3]
|
||||
|
||||
// Replace value substring.
|
||||
buf = append(buf[:start], append(redactedPass, buf[end:]...)...)
|
||||
break
|
||||
}
|
||||
return buf
|
||||
}
|
||||
@@ -2689,9 +2683,11 @@ func (c *client) processPong() {
|
||||
c.rtt = computeRTT(c.rttStart)
|
||||
srv := c.srv
|
||||
reorderGWs := c.kind == GATEWAY && c.gw.outbound
|
||||
firstPong := c.flags.setIfNotSet(firstPong)
|
||||
var ri *routeInfo
|
||||
// For a route with pooling, we may be instructed to start a new route.
|
||||
if c.kind == ROUTER && c.route != nil && c.route.startNewRoute != nil {
|
||||
// When receiving the first PONG, for a route with pooling, we may be
|
||||
// instructed to start a new route.
|
||||
if firstPong && c.kind == ROUTER && c.route != nil {
|
||||
ri = c.route.startNewRoute
|
||||
c.route.startNewRoute = nil
|
||||
}
|
||||
@@ -2809,10 +2805,9 @@ func (c *client) processHeaderPub(arg, remaining []byte) error {
|
||||
// look for the tracing header and if found, we will generate a
|
||||
// trace event with the max payload ingress error.
|
||||
// Do this only for CLIENT connections.
|
||||
if c.kind == CLIENT && c.pa.hdr > 0 && len(remaining) > 0 {
|
||||
hdr := remaining[:min(len(remaining), c.pa.hdr)]
|
||||
if td, ok := c.allowedMsgTraceDest(hdr, false); ok && td != _EMPTY_ {
|
||||
c.initAndSendIngressErrEvent(hdr, td, ErrMaxPayload)
|
||||
if c.kind == CLIENT && len(remaining) > 0 {
|
||||
if td := getHeader(MsgTraceDest, remaining); len(td) > 0 {
|
||||
c.initAndSendIngressErrEvent(remaining, string(td), ErrMaxPayload)
|
||||
}
|
||||
}
|
||||
c.maxPayloadViolation(c.pa.size, maxPayload)
|
||||
@@ -3245,12 +3240,10 @@ func (c *client) canSubscribe(subject string, optQueue ...string) bool {
|
||||
queue = optQueue[0]
|
||||
}
|
||||
|
||||
// For CLIENT connections that are MQTT we will implicitly allow anything that starts with
|
||||
// the "$MQTT.sub." or "$MQTT.deliver.pubrel." prefix. For other types of connections, we
|
||||
// will implicitly allow anything that starts with the full "$MQTT." prefix. However,
|
||||
// For CLIENT connections that are MQTT, or other types of connections, we will
|
||||
// implicitly allow anything that starts with the "$MQTT." prefix. However,
|
||||
// we don't just return here, we skip the check for "allow" but will check "deny".
|
||||
if (c.isMqtt() && (strings.HasPrefix(subject, mqttSubPrefix) || strings.HasPrefix(subject, mqttPubRelDeliverySubjectPrefix))) ||
|
||||
(c.kind != CLIENT && strings.HasPrefix(subject, mqttPrefix)) {
|
||||
if (c.isMqtt() || (c.kind != CLIENT)) && strings.HasPrefix(subject, mqttPrefix) {
|
||||
checkAllow = false
|
||||
}
|
||||
// Check allow list. If no allow list that means all are allowed. Deny can overrule.
|
||||
@@ -4060,41 +4053,6 @@ func (c *client) pubAllowed(subject string) bool {
|
||||
return c.pubAllowedFullCheck(subject, true, false)
|
||||
}
|
||||
|
||||
// allowedMsgTraceDest returns the trace destination if present and authorized.
|
||||
// It only considers static publish permissions and does not consume dynamic
|
||||
// reply permissions because the client is not publishing the trace event itself.
|
||||
func (c *client) allowedMsgTraceDest(hdr []byte, hasLock bool) (string, bool) {
|
||||
if len(hdr) == 0 {
|
||||
return _EMPTY_, true
|
||||
}
|
||||
td := sliceHeader(MsgTraceDest, hdr)
|
||||
if len(td) == 0 {
|
||||
return _EMPTY_, true
|
||||
}
|
||||
dest := bytesToString(td)
|
||||
if c.kind == CLIENT {
|
||||
if hasGWRoutedReplyPrefix(td) {
|
||||
return dest, false
|
||||
}
|
||||
var acc *Account
|
||||
var srv *Server
|
||||
if !hasLock {
|
||||
c.mu.Lock()
|
||||
}
|
||||
acc, srv = c.acc, c.srv
|
||||
if !hasLock {
|
||||
c.mu.Unlock()
|
||||
}
|
||||
if bytes.HasPrefix(td, clientNRGPrefix) && srv != nil && acc != srv.SystemAccount() {
|
||||
return dest, false
|
||||
}
|
||||
}
|
||||
if c.perms != nil && (c.perms.pub.allow != nil || c.perms.pub.deny != nil) && !c.pubAllowedFullCheck(dest, false, hasLock) {
|
||||
return dest, false
|
||||
}
|
||||
return dest, true
|
||||
}
|
||||
|
||||
// pubAllowedFullCheck checks on all publish permissioning depending
|
||||
// on the flag for dynamic reply permissions.
|
||||
func (c *client) pubAllowedFullCheck(subject string, fullCheck, hasLock bool) bool {
|
||||
@@ -4107,10 +4065,10 @@ func (c *client) pubAllowedFullCheck(subject string, fullCheck, hasLock bool) bo
|
||||
return v.(bool)
|
||||
}
|
||||
allowed, checkAllow := true, true
|
||||
// For any connections, other than CLIENT, we will implicitly allow anything that
|
||||
// starts with the "$MQTT." prefix. However, we don't just return here,
|
||||
// we skip the check for "allow" but will check "deny".
|
||||
if c.kind != CLIENT && strings.HasPrefix(subject, mqttPrefix) {
|
||||
// For CLIENT connections that are MQTT, or other types of connections, we will
|
||||
// implicitly allow anything that starts with the "$MQTT." prefix. However,
|
||||
// we don't just return here, we skip the check for "allow" but will check "deny".
|
||||
if (c.isMqtt() || c.kind != CLIENT) && strings.HasPrefix(subject, mqttPrefix) {
|
||||
checkAllow = false
|
||||
}
|
||||
// Cache miss, check allow then deny as needed.
|
||||
@@ -4230,19 +4188,10 @@ func (c *client) processInboundClientMsg(msg []byte) (bool, bool) {
|
||||
genidAddr := &acc.sl.genid
|
||||
|
||||
// Check pub permissions
|
||||
if c.perms != nil && (c.perms.pub.allow != nil || c.perms.pub.deny != nil) {
|
||||
if !c.pubAllowedFullCheck(string(c.pa.subject), true, true) {
|
||||
c.mu.Unlock()
|
||||
c.pubPermissionViolation(c.pa.subject)
|
||||
return false, true
|
||||
}
|
||||
}
|
||||
if c.pa.hdr > 0 {
|
||||
if td, ok := c.allowedMsgTraceDest(msg[:c.pa.hdr], true); !ok {
|
||||
c.mu.Unlock()
|
||||
c.pubPermissionViolation(stringToBytes(td))
|
||||
return false, true
|
||||
}
|
||||
if c.perms != nil && (c.perms.pub.allow != nil || c.perms.pub.deny != nil) && !c.pubAllowedFullCheck(string(c.pa.subject), true, true) {
|
||||
c.mu.Unlock()
|
||||
c.pubPermissionViolation(c.pa.subject)
|
||||
return false, true
|
||||
}
|
||||
c.mu.Unlock()
|
||||
|
||||
@@ -4442,43 +4391,28 @@ func (c *client) setupResponseServiceImport(acc *Account, si *serviceImport, tra
|
||||
return rsi
|
||||
}
|
||||
|
||||
// Will remove a status and description from the header if present.
|
||||
func removeHeaderStatusIfPresent(hdr []byte) []byte {
|
||||
k := []byte("NATS/1.0")
|
||||
kl, i := len(k), bytes.IndexByte(hdr, '\r')
|
||||
if !bytes.HasPrefix(hdr, k) || i <= kl {
|
||||
// Will remove a header if present.
|
||||
func removeHeaderIfPresent(hdr []byte, key string) []byte {
|
||||
start := getHeaderKeyIndex(key, hdr)
|
||||
// key can't be first and we want to check that it is preceded by a '\n'
|
||||
if start < 1 || hdr[start-1] != '\n' {
|
||||
return hdr
|
||||
}
|
||||
hdr = append(hdr[:kl], hdr[i:]...)
|
||||
if len(hdr) == len(emptyHdrLine) {
|
||||
index := start + len(key)
|
||||
if index >= len(hdr) || hdr[index] != ':' {
|
||||
return hdr
|
||||
}
|
||||
end := bytes.Index(hdr[start:], []byte(_CRLF_))
|
||||
if end < 0 {
|
||||
return hdr
|
||||
}
|
||||
hdr = append(hdr[:start], hdr[start+end+len(_CRLF_):]...)
|
||||
if len(hdr) <= len(emptyHdrLine) {
|
||||
return nil
|
||||
}
|
||||
return hdr
|
||||
}
|
||||
|
||||
// Will remove a header if present.
|
||||
func removeHeaderIfPresent(hdr []byte, key string) []byte {
|
||||
for {
|
||||
start := getHeaderKeyIndex(key, hdr)
|
||||
// key can't be first and we want to check that it is preceded by a '\n'
|
||||
if start < 1 || hdr[start-1] != '\n' {
|
||||
return hdr
|
||||
}
|
||||
index := start + len(key)
|
||||
if index >= len(hdr) || hdr[index] != ':' {
|
||||
return hdr
|
||||
}
|
||||
end := bytes.Index(hdr[start:], []byte(_CRLF_))
|
||||
if end < 0 {
|
||||
return hdr
|
||||
}
|
||||
hdr = append(hdr[:start], hdr[start+end+len(_CRLF_):]...)
|
||||
if len(hdr) <= len(emptyHdrLine) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func removeHeaderIfPrefixPresent(hdr []byte, prefix string) []byte {
|
||||
var index int
|
||||
for {
|
||||
@@ -4813,33 +4747,16 @@ func (c *client) processServiceImport(si *serviceImport, acc *Account, msg []byt
|
||||
if !isResponse {
|
||||
isSysImport := siAcc == c.srv.SystemAccount()
|
||||
var ci *ClientInfo
|
||||
var cis *ClientInfo
|
||||
if c.pa.hdr >= 0 {
|
||||
var hci ClientInfo
|
||||
if err := json.Unmarshal(sliceHeader(ClientInfoHdr, msg[:c.pa.hdr]), &hci); err == nil {
|
||||
cis = &hci
|
||||
}
|
||||
}
|
||||
if c.kind == LEAF && c.pa.hdr >= 0 && len(sliceHeader(ClientInfoHdr, msg[:c.pa.hdr])) > 0 {
|
||||
// Leaf nodes may forward a Nats-Request-Info from a remote domain,
|
||||
// but the local server must replace it with the identity of the
|
||||
// authenticated leaf connection instead of trusting forwarded values.
|
||||
ci = c.getClientInfo(share)
|
||||
if hadPrevSi {
|
||||
if hadPrevSi && c.pa.hdr >= 0 {
|
||||
var cis ClientInfo
|
||||
if err := json.Unmarshal(sliceHeader(ClientInfoHdr, msg[:c.pa.hdr]), &cis); err == nil {
|
||||
ci = &cis
|
||||
ci.Service = acc.Name
|
||||
// Check if we are moving into a share details account from a non-shared
|
||||
// and add in server and cluster details.
|
||||
if !share && (si.share || isSysImport) {
|
||||
c.addServerAndClusterInfo(ci)
|
||||
}
|
||||
} else if !share && isSysImport {
|
||||
c.addServerAndClusterInfo(ci)
|
||||
}
|
||||
} else if hadPrevSi && cis != nil {
|
||||
ci = cis
|
||||
ci.Service = acc.Name
|
||||
// Check if we are moving into a share details account from a non-shared
|
||||
// and add in server and cluster details.
|
||||
if !share && (si.share || isSysImport) {
|
||||
c.addServerAndClusterInfo(ci)
|
||||
}
|
||||
} else if c.kind != LEAF || c.pa.hdr < 0 || len(sliceHeader(ClientInfoHdr, msg[:c.pa.hdr])) == 0 {
|
||||
ci = c.getClientInfo(share)
|
||||
@@ -4847,6 +4764,12 @@ func (c *client) processServiceImport(si *serviceImport, acc *Account, msg []byt
|
||||
if !share && isSysImport {
|
||||
c.addServerAndClusterInfo(ci)
|
||||
}
|
||||
} else if c.kind == LEAF && (si.share || isSysImport) {
|
||||
// We have a leaf header here for ci, augment as above.
|
||||
ci = c.getClientInfo(si.share)
|
||||
if !si.share && isSysImport {
|
||||
c.addServerAndClusterInfo(ci)
|
||||
}
|
||||
}
|
||||
// Set clientInfo if present.
|
||||
if ci != nil {
|
||||
|
||||
+22
-29
@@ -131,22 +131,19 @@ func detectProxyProtoVersion(conn net.Conn) (version int, header []byte, err err
|
||||
|
||||
// readProxyProtoV1Header parses PROXY protocol v1 text format.
|
||||
// Expects the "PROXY " prefix (6 bytes) to have already been consumed.
|
||||
// Returns any bytes that were read past the trailing CRLF so the caller can
|
||||
// replay them into the next protocol layer.
|
||||
func readProxyProtoV1Header(conn net.Conn) (*proxyProtoAddr, []byte, error) {
|
||||
func readProxyProtoV1Header(conn net.Conn) (*proxyProtoAddr, error) {
|
||||
// Read rest of line (max 107 bytes total, already read 6)
|
||||
maxRemaining := proxyProtoV1MaxLineLen - 6
|
||||
|
||||
// Read up to maxRemaining bytes at once (more efficient than byte-by-byte)
|
||||
buf := make([]byte, maxRemaining)
|
||||
var line []byte
|
||||
var remaining []byte
|
||||
|
||||
for len(line) < maxRemaining {
|
||||
// Read available data
|
||||
n, err := conn.Read(buf[len(line):])
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to read v1 line: %w", err)
|
||||
return nil, fmt.Errorf("failed to read v1 line: %w", err)
|
||||
}
|
||||
|
||||
line = buf[:len(line)+n]
|
||||
@@ -154,8 +151,7 @@ func readProxyProtoV1Header(conn net.Conn) (*proxyProtoAddr, []byte, error) {
|
||||
// Look for CRLF in what we've read so far
|
||||
for i := 0; i < len(line)-1; i++ {
|
||||
if line[i] == '\r' && line[i+1] == '\n' {
|
||||
// Found CRLF - keep any over-read bytes for the client parser.
|
||||
remaining = append(remaining, line[i+2:]...)
|
||||
// Found CRLF - extract just the line portion
|
||||
line = line[:i]
|
||||
goto foundCRLF
|
||||
}
|
||||
@@ -163,7 +159,7 @@ func readProxyProtoV1Header(conn net.Conn) (*proxyProtoAddr, []byte, error) {
|
||||
}
|
||||
|
||||
// Exceeded max length without finding CRLF
|
||||
return nil, nil, fmt.Errorf("%w: v1 line too long", errProxyProtoInvalid)
|
||||
return nil, fmt.Errorf("%w: v1 line too long", errProxyProtoInvalid)
|
||||
|
||||
foundCRLF:
|
||||
// Get parts from the protocol
|
||||
@@ -171,17 +167,17 @@ foundCRLF:
|
||||
|
||||
// Validate format
|
||||
if len(parts) < 1 {
|
||||
return nil, nil, fmt.Errorf("%w: invalid v1 format", errProxyProtoInvalid)
|
||||
return nil, fmt.Errorf("%w: invalid v1 format", errProxyProtoInvalid)
|
||||
}
|
||||
|
||||
// Handle UNKNOWN (health check, like v2 LOCAL)
|
||||
if parts[0] == proxyProtoV1Unknown {
|
||||
return nil, remaining, nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Must have exactly 5 parts: protocol, src-ip, dst-ip, src-port, dst-port
|
||||
if len(parts) != 5 {
|
||||
return nil, nil, fmt.Errorf("%w: invalid v1 format", errProxyProtoInvalid)
|
||||
return nil, fmt.Errorf("%w: invalid v1 format", errProxyProtoInvalid)
|
||||
}
|
||||
|
||||
protocol := parts[0]
|
||||
@@ -189,29 +185,29 @@ foundCRLF:
|
||||
dstIP := net.ParseIP(parts[2])
|
||||
|
||||
if srcIP == nil || dstIP == nil {
|
||||
return nil, nil, fmt.Errorf("%w: invalid address", errProxyProtoInvalid)
|
||||
return nil, fmt.Errorf("%w: invalid address", errProxyProtoInvalid)
|
||||
}
|
||||
|
||||
// Parse ports
|
||||
srcPort, err := strconv.ParseUint(parts[3], 10, 16)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("invalid source port: %w", err)
|
||||
return nil, fmt.Errorf("invalid source port: %w", err)
|
||||
}
|
||||
|
||||
dstPort, err := strconv.ParseUint(parts[4], 10, 16)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("invalid dest port: %w", err)
|
||||
return nil, fmt.Errorf("invalid dest port: %w", err)
|
||||
}
|
||||
|
||||
// Validate protocol matches IP version
|
||||
if protocol == proxyProtoV1TCP4 && srcIP.To4() == nil {
|
||||
return nil, nil, fmt.Errorf("%w: TCP4 with IPv6 address", errProxyProtoInvalid)
|
||||
return nil, fmt.Errorf("%w: TCP4 with IPv6 address", errProxyProtoInvalid)
|
||||
}
|
||||
if protocol == proxyProtoV1TCP6 && srcIP.To4() != nil {
|
||||
return nil, nil, fmt.Errorf("%w: TCP6 with IPv4 address", errProxyProtoInvalid)
|
||||
return nil, fmt.Errorf("%w: TCP6 with IPv4 address", errProxyProtoInvalid)
|
||||
}
|
||||
if protocol != proxyProtoV1TCP4 && protocol != proxyProtoV1TCP6 {
|
||||
return nil, nil, fmt.Errorf("%w: invalid protocol %s", errProxyProtoInvalid, protocol)
|
||||
return nil, fmt.Errorf("%w: invalid protocol %s", errProxyProtoInvalid, protocol)
|
||||
}
|
||||
|
||||
return &proxyProtoAddr{
|
||||
@@ -219,27 +215,25 @@ foundCRLF:
|
||||
srcPort: uint16(srcPort),
|
||||
dstIP: dstIP,
|
||||
dstPort: uint16(dstPort),
|
||||
}, remaining, nil
|
||||
}, nil
|
||||
}
|
||||
|
||||
// readProxyProtoHeader reads and parses PROXY protocol (v1 or v2) from the connection.
|
||||
// Automatically detects version and routes to appropriate parser.
|
||||
// If the command is LOCAL/UNKNOWN (health check), it returns nil for addr and no error.
|
||||
// If the command is PROXY, it returns the parsed address information.
|
||||
// It also returns any bytes that were read past the v1 header terminator so the
|
||||
// caller can replay them into the normal client parser.
|
||||
// The connection must be fresh (no data read yet).
|
||||
func readProxyProtoHeader(conn net.Conn) (*proxyProtoAddr, []byte, error) {
|
||||
func readProxyProtoHeader(conn net.Conn) (*proxyProtoAddr, error) {
|
||||
// Set read deadline to prevent hanging on slow/malicious clients
|
||||
if err := conn.SetReadDeadline(time.Now().Add(proxyProtoReadTimeout)); err != nil {
|
||||
return nil, nil, err
|
||||
return nil, err
|
||||
}
|
||||
defer conn.SetReadDeadline(time.Time{})
|
||||
|
||||
// Detect version
|
||||
version, firstBytes, err := detectProxyProtoVersion(conn)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch version {
|
||||
@@ -250,26 +244,25 @@ func readProxyProtoHeader(conn net.Conn) (*proxyProtoAddr, []byte, error) {
|
||||
// Read rest of v2 signature (bytes 6-11, total 6 more bytes)
|
||||
remaining := make([]byte, 6)
|
||||
if _, err := io.ReadFull(conn, remaining); err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to read v2 signature: %w", err)
|
||||
return nil, fmt.Errorf("failed to read v2 signature: %w", err)
|
||||
}
|
||||
|
||||
// Verify full signature
|
||||
fullSig := string(firstBytes) + string(remaining)
|
||||
if fullSig != proxyProtoV2Sig {
|
||||
return nil, nil, fmt.Errorf("%w: invalid signature", errProxyProtoInvalid)
|
||||
return nil, fmt.Errorf("%w: invalid signature", errProxyProtoInvalid)
|
||||
}
|
||||
|
||||
// Read rest of header: ver/cmd, fam/proto, addr-len (4 bytes)
|
||||
header := make([]byte, 4)
|
||||
if _, err := io.ReadFull(conn, header); err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to read v2 header: %w", err)
|
||||
return nil, fmt.Errorf("failed to read v2 header: %w", err)
|
||||
}
|
||||
|
||||
// Continue with parsing
|
||||
addr, err := parseProxyProtoV2Header(conn, header)
|
||||
return addr, nil, err
|
||||
return parseProxyProtoV2Header(conn, header)
|
||||
default:
|
||||
return nil, nil, fmt.Errorf("unsupported PROXY protocol version: %d", version)
|
||||
return nil, fmt.Errorf("unsupported PROXY protocol version: %d", version)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ func init() {
|
||||
|
||||
const (
|
||||
// VERSION is the current version for the server.
|
||||
VERSION = "2.12.6"
|
||||
VERSION = "2.12.4"
|
||||
|
||||
// PROTO is the currently supported protocol.
|
||||
// 0 was the original
|
||||
|
||||
+61
-87
@@ -42,6 +42,7 @@ import (
|
||||
const (
|
||||
JSPullRequestPendingMsgs = "Nats-Pending-Messages"
|
||||
JSPullRequestPendingBytes = "Nats-Pending-Bytes"
|
||||
JSPullRequestWrongPinID = "NATS/1.0 423 Nats-Wrong-Pin-Id\r\n\r\n"
|
||||
JSPullRequestNatsPinId = "Nats-Pin-Id"
|
||||
)
|
||||
|
||||
@@ -511,7 +512,7 @@ type consumer struct {
|
||||
// Details described in ADR-42.
|
||||
|
||||
// currentPinId is the current nuid for the pinned consumer.
|
||||
// If the Consumer is running in `PriorityPinnedClient` mode, server will
|
||||
// If the Consumer is running in `PriorityPinnedClient` mode, server will
|
||||
// pick up a new nuid and assign it to first pending pull request.
|
||||
currentPinId string
|
||||
/// pinnedTtl is the remaining time before the current PinId expires.
|
||||
@@ -824,7 +825,7 @@ func checkConsumerCfg(
|
||||
return NewJSStreamInvalidConfigError(ErrBadSubject)
|
||||
}
|
||||
for inner, ssubject := range subjectFilters {
|
||||
if inner != outer && subjectIsSubsetMatch(subject, ssubject) {
|
||||
if inner != outer && SubjectsCollide(subject, ssubject) {
|
||||
return NewJSConsumerOverlappingSubjectFiltersError()
|
||||
}
|
||||
}
|
||||
@@ -1058,22 +1059,17 @@ func (mset *stream) addConsumerWithAssignment(config *ConsumerConfig, oname stri
|
||||
return nil, NewJSConsumerDoesNotExistError()
|
||||
}
|
||||
|
||||
// If we're clustered we've already done this check, only do this if we're a standalone server.
|
||||
// But if we're standalone, only enforce if we're not recovering, since the MaxConsumers could've
|
||||
// been updated while we already had more consumers on disk.
|
||||
if !s.JetStreamIsClustered() && s.standAloneMode() && !isRecovering {
|
||||
// Check for any limits, if the config for the consumer sets a limit we check against that
|
||||
// but if not we use the value from account limits, if account limits is more restrictive
|
||||
// than stream config we prefer the account limits to handle cases where account limits are
|
||||
// updated during the lifecycle of the stream
|
||||
maxc := cfg.MaxConsumers
|
||||
if maxc <= 0 || (selectedLimits.MaxConsumers > 0 && selectedLimits.MaxConsumers < maxc) {
|
||||
maxc = selectedLimits.MaxConsumers
|
||||
}
|
||||
if maxc > 0 && mset.numPublicConsumers() >= maxc {
|
||||
mset.mu.Unlock()
|
||||
return nil, NewJSMaximumConsumersLimitError()
|
||||
}
|
||||
// Check for any limits, if the config for the consumer sets a limit we check against that
|
||||
// but if not we use the value from account limits, if account limits is more restrictive
|
||||
// than stream config we prefer the account limits to handle cases where account limits are
|
||||
// updated during the lifecycle of the stream
|
||||
maxc := cfg.MaxConsumers
|
||||
if maxc <= 0 || (selectedLimits.MaxConsumers > 0 && selectedLimits.MaxConsumers < maxc) {
|
||||
maxc = selectedLimits.MaxConsumers
|
||||
}
|
||||
if maxc > 0 && mset.numPublicConsumers() >= maxc {
|
||||
mset.mu.Unlock()
|
||||
return nil, NewJSMaximumConsumersLimitError()
|
||||
}
|
||||
|
||||
// Check on stream type conflicts with WorkQueues.
|
||||
@@ -1219,13 +1215,14 @@ func (mset *stream) addConsumerWithAssignment(config *ConsumerConfig, oname stri
|
||||
|
||||
// If we have multiple filter subjects, create a sublist which we will use
|
||||
// in calling store.LoadNextMsgMulti.
|
||||
if len(o.subjf) <= 1 {
|
||||
o.filters = nil
|
||||
} else {
|
||||
if len(o.cfg.FilterSubjects) > 0 {
|
||||
o.filters = gsl.NewSublist[struct{}]()
|
||||
for _, filter := range o.subjf {
|
||||
o.filters.Insert(filter.subject, struct{}{})
|
||||
for _, filter := range o.cfg.FilterSubjects {
|
||||
o.filters.Insert(filter, struct{}{})
|
||||
}
|
||||
} else {
|
||||
// Make sure this is nil otherwise.
|
||||
o.filters = nil
|
||||
}
|
||||
|
||||
if o.store != nil && o.store.HasState() {
|
||||
@@ -1405,12 +1402,8 @@ func (o *consumer) monitorQuitC() <-chan struct{} {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
o.mu.Lock()
|
||||
defer o.mu.Unlock()
|
||||
// Recreate if a prior monitor routine was stopped.
|
||||
if o.mqch == nil {
|
||||
o.mqch = make(chan struct{})
|
||||
}
|
||||
o.mu.RLock()
|
||||
defer o.mu.RUnlock()
|
||||
return o.mqch
|
||||
}
|
||||
|
||||
@@ -1693,7 +1686,6 @@ func (o *consumer) setLeader(isLeader bool) {
|
||||
} else if o.srv.gateway.enabled {
|
||||
stopAndClearTimer(&o.gwdtmr)
|
||||
}
|
||||
o.unassignPinId()
|
||||
// If we were the leader make sure to drain queued up acks.
|
||||
if wasLeader {
|
||||
o.ackMsgs.drain()
|
||||
@@ -2053,7 +2045,6 @@ func (o *consumer) deleteNotActive() {
|
||||
if o.srv != nil {
|
||||
qch = o.srv.quitCh
|
||||
}
|
||||
oqch := o.qch
|
||||
o.mu.Unlock()
|
||||
if js != nil {
|
||||
cqch = js.clusterQuitC()
|
||||
@@ -2102,9 +2093,6 @@ func (o *consumer) deleteNotActive() {
|
||||
return
|
||||
case <-cqch:
|
||||
return
|
||||
case <-oqch:
|
||||
// The consumer has stopped already, likely by an earlier delete proposal being applied.
|
||||
return
|
||||
}
|
||||
js.mu.RLock()
|
||||
if js.shuttingDown {
|
||||
@@ -2852,10 +2840,14 @@ func (o *consumer) releaseAnyPendingRequests(isAssigned bool) {
|
||||
if o.mset == nil || o.outq == nil || o.waiting.len() == 0 {
|
||||
return
|
||||
}
|
||||
var hdr []byte
|
||||
if !isAssigned {
|
||||
hdr = []byte("NATS/1.0 409 Consumer Deleted\r\n\r\n")
|
||||
}
|
||||
|
||||
wq := o.waiting
|
||||
for wr := wq.head; wr != nil; {
|
||||
if !isAssigned {
|
||||
hdr := []byte("NATS/1.0 409 Consumer Deleted\r\n\r\n")
|
||||
if hdr != nil {
|
||||
o.outq.send(newJSPubMsg(wr.reply, _EMPTY_, _EMPTY_, hdr, nil, nil, 0))
|
||||
}
|
||||
next := wr.next
|
||||
@@ -3059,11 +3051,6 @@ func (o *consumer) setStoreState(state *ConsumerState) error {
|
||||
err := o.store.Update(state)
|
||||
if err == nil {
|
||||
o.applyState(state)
|
||||
} else if err == ErrStoreOldUpdate {
|
||||
// Our store already has a newer state, which is normal during recovery
|
||||
// when the consumer was loaded from disk before the meta snapshot state
|
||||
// was applied.
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -3928,12 +3915,7 @@ func (o *consumer) setPinnedTimer(priorityGroup string) {
|
||||
} else {
|
||||
o.pinnedTtl = time.AfterFunc(o.cfg.PinnedTTL, func() {
|
||||
o.mu.Lock()
|
||||
// Skip if already unset.
|
||||
if o.currentPinId == _EMPTY_ {
|
||||
o.mu.Unlock()
|
||||
return
|
||||
}
|
||||
o.unassignPinId()
|
||||
o.currentPinId = _EMPTY_
|
||||
o.sendUnpinnedAdvisoryLocked(priorityGroup, "timeout")
|
||||
o.mu.Unlock()
|
||||
o.signalNewMessages()
|
||||
@@ -3941,28 +3923,6 @@ func (o *consumer) setPinnedTimer(priorityGroup string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Lock should be held.
|
||||
func (o *consumer) assignNewPinId(wr *waitingRequest) {
|
||||
if wr.priorityGroup == nil || wr.priorityGroup.Group == _EMPTY_ {
|
||||
return
|
||||
}
|
||||
o.currentPinId = nuid.Next()
|
||||
o.pinnedTS = time.Now().UTC()
|
||||
wr.priorityGroup.Id = o.currentPinId
|
||||
o.setPinnedTimer(wr.priorityGroup.Group)
|
||||
o.sendPinnedAdvisoryLocked(wr.priorityGroup.Group)
|
||||
}
|
||||
|
||||
// Lock should be held.
|
||||
func (o *consumer) unassignPinId() {
|
||||
o.currentPinId = _EMPTY_
|
||||
o.pinnedTS = time.Time{}
|
||||
if o.pinnedTtl != nil {
|
||||
o.pinnedTtl.Stop()
|
||||
o.pinnedTtl = nil
|
||||
}
|
||||
}
|
||||
|
||||
// Return next waiting request. This will check for expirations but not noWait or interest.
|
||||
// That will be handled by processWaiting.
|
||||
// Lock should be held.
|
||||
@@ -3973,6 +3933,11 @@ func (o *consumer) nextWaiting(sz int) *waitingRequest {
|
||||
|
||||
// Check if server needs to assign a new pin id.
|
||||
needNewPin := o.currentPinId == _EMPTY_ && o.cfg.PriorityPolicy == PriorityPinnedClient
|
||||
// As long as we support only one priority group, we can capture that group here and reuse it.
|
||||
var priorityGroup string
|
||||
if len(o.cfg.PriorityGroups) > 0 {
|
||||
priorityGroup = o.cfg.PriorityGroups[0]
|
||||
}
|
||||
|
||||
numCycled := 0
|
||||
for wr := o.waiting.peek(); !o.waiting.isEmpty(); wr = o.waiting.peek() {
|
||||
@@ -4006,12 +3971,15 @@ func (o *consumer) nextWaiting(sz int) *waitingRequest {
|
||||
if wr.expires.IsZero() || time.Now().Before(wr.expires) {
|
||||
if needNewPin {
|
||||
if wr.priorityGroup.Id == _EMPTY_ {
|
||||
o.assignNewPinId(wr)
|
||||
o.currentPinId = nuid.Next()
|
||||
o.pinnedTS = time.Now().UTC()
|
||||
wr.priorityGroup.Id = o.currentPinId
|
||||
o.setPinnedTimer(priorityGroup)
|
||||
|
||||
} else {
|
||||
// There is pin id set, but not a matching one. Send a notification to the client and remove the request.
|
||||
// Probably this is the old pin id.
|
||||
hdr := fmt.Appendf(nil, "NATS/1.0 423 Nats-Wrong-Pin-Id\r\n%s: %d\r\n%s: %d\r\n\r\n", JSPullRequestPendingMsgs, wr.n, JSPullRequestPendingBytes, wr.b)
|
||||
o.outq.send(newJSPubMsg(wr.reply, _EMPTY_, _EMPTY_, hdr, nil, nil, 0))
|
||||
o.outq.send(newJSPubMsg(wr.reply, _EMPTY_, _EMPTY_, []byte(JSPullRequestWrongPinID), nil, nil, 0))
|
||||
o.waiting.removeCurrent()
|
||||
if o.node != nil {
|
||||
o.removeClusterPendingRequest(wr.reply)
|
||||
@@ -4032,8 +4000,7 @@ func (o *consumer) nextWaiting(sz int) *waitingRequest {
|
||||
continue
|
||||
} else {
|
||||
// There is pin id set, but not a matching one. Send a notification to the client and remove the request.
|
||||
hdr := fmt.Appendf(nil, "NATS/1.0 423 Nats-Wrong-Pin-Id\r\n%s: %d\r\n%s: %d\r\n\r\n", JSPullRequestPendingMsgs, wr.n, JSPullRequestPendingBytes, wr.b)
|
||||
o.outq.send(newJSPubMsg(wr.reply, _EMPTY_, _EMPTY_, hdr, nil, nil, 0))
|
||||
o.outq.send(newJSPubMsg(wr.reply, _EMPTY_, _EMPTY_, []byte(JSPullRequestWrongPinID), nil, nil, 0))
|
||||
o.waiting.removeCurrent()
|
||||
if o.node != nil {
|
||||
o.removeClusterPendingRequest(wr.reply)
|
||||
@@ -4045,13 +4012,9 @@ func (o *consumer) nextWaiting(sz int) *waitingRequest {
|
||||
|
||||
if o.cfg.PriorityPolicy == PriorityOverflow {
|
||||
if wr.priorityGroup != nil &&
|
||||
// If both limits are zero we don't cycle and the request will be fulfilled.
|
||||
(wr.priorityGroup.MinPending > 0 || wr.priorityGroup.MinAckPending > 0) &&
|
||||
// We need to check o.npc+1, because before calling nextWaiting, we do o.npc--
|
||||
// If one OR the other limit is exceeded, we want to fulfill the request.
|
||||
// This is an inverted check. For clarity, we check the positive condition and negate.
|
||||
!((wr.priorityGroup.MinPending > 0 && wr.priorityGroup.MinPending <= o.npc+1) ||
|
||||
(wr.priorityGroup.MinAckPending > 0 && wr.priorityGroup.MinAckPending <= int64(len(o.pending)))) {
|
||||
(wr.priorityGroup.MinPending > 0 && wr.priorityGroup.MinPending > o.npc+1 ||
|
||||
wr.priorityGroup.MinAckPending > 0 && wr.priorityGroup.MinAckPending > int64(len(o.pending))) {
|
||||
o.waiting.cycle()
|
||||
numCycled++
|
||||
// We're done cycling through the requests.
|
||||
@@ -4062,10 +4025,19 @@ func (o *consumer) nextWaiting(sz int) *waitingRequest {
|
||||
}
|
||||
}
|
||||
if wr.acc.sl.HasInterest(wr.interest) {
|
||||
if needNewPin {
|
||||
o.sendPinnedAdvisoryLocked(priorityGroup)
|
||||
}
|
||||
return o.waiting.popOrPopAndRequeue(o.cfg.PriorityPolicy)
|
||||
} else if time.Since(wr.received) < defaultGatewayRecentSubExpiration && (o.srv.leafNodeEnabled || o.srv.gateway.enabled) {
|
||||
if needNewPin {
|
||||
o.sendPinnedAdvisoryLocked(priorityGroup)
|
||||
}
|
||||
return o.waiting.popOrPopAndRequeue(o.cfg.PriorityPolicy)
|
||||
} else if o.srv.gateway.enabled && o.srv.hasGatewayInterest(wr.acc.Name, wr.interest) {
|
||||
if needNewPin {
|
||||
o.sendPinnedAdvisoryLocked(priorityGroup)
|
||||
}
|
||||
return o.waiting.popOrPopAndRequeue(o.cfg.PriorityPolicy)
|
||||
}
|
||||
} else {
|
||||
@@ -4223,7 +4195,15 @@ func (o *consumer) processNextMsgRequest(reply string, msg []byte) {
|
||||
sendErr(400, "Bad Request - Priority Group missing")
|
||||
return
|
||||
}
|
||||
if !slices.Contains(o.cfg.PriorityGroups, priorityGroup.Group) {
|
||||
|
||||
found := false
|
||||
for _, group := range o.cfg.PriorityGroups {
|
||||
if group == priorityGroup.Group {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
sendErr(400, "Bad Request - Invalid Priority Group")
|
||||
return
|
||||
}
|
||||
@@ -4461,8 +4441,6 @@ func (o *consumer) getNextMsg() (*jsPubMsg, uint64, error) {
|
||||
// scheduled for redelivery, but it has been removed from the stream.
|
||||
// o.processTerm is called in a goroutine so could run after we get here.
|
||||
// That will correct the pending state and delivery/ack floors, so just skip here.
|
||||
pmsg.returnToPool()
|
||||
pmsg = nil
|
||||
continue
|
||||
}
|
||||
return pmsg, dc, err
|
||||
@@ -4490,7 +4468,6 @@ func (o *consumer) getNextMsg() (*jsPubMsg, uint64, error) {
|
||||
sm, err := o.mset.store.LoadMsg(seq, &pmsg.StoreMsg)
|
||||
if sm == nil || err != nil {
|
||||
pmsg.returnToPool()
|
||||
pmsg = nil
|
||||
}
|
||||
o.sseq++
|
||||
return pmsg, 1, err
|
||||
@@ -5002,7 +4979,6 @@ func (o *consumer) loopAndGatherMsgs(qch chan struct{}) {
|
||||
o.addToRedeliverQueue(pmsg.seq)
|
||||
}
|
||||
pmsg.returnToPool()
|
||||
pmsg = nil
|
||||
goto waitForMsgs
|
||||
}
|
||||
|
||||
@@ -5013,7 +4989,6 @@ func (o *consumer) loopAndGatherMsgs(qch chan struct{}) {
|
||||
select {
|
||||
case <-qch:
|
||||
pmsg.returnToPool()
|
||||
pmsg = nil
|
||||
return
|
||||
case <-time.After(delay):
|
||||
}
|
||||
@@ -5034,7 +5009,6 @@ func (o *consumer) loopAndGatherMsgs(qch chan struct{}) {
|
||||
select {
|
||||
case <-qch:
|
||||
pmsg.returnToPool()
|
||||
pmsg = nil
|
||||
return
|
||||
case <-time.After(delay):
|
||||
}
|
||||
|
||||
-6
@@ -215,9 +215,6 @@ var (
|
||||
|
||||
// ErrMinimumVersionRequired is returned when a connection is not at the minimum version required.
|
||||
ErrMinimumVersionRequired = errors.New("minimum version required")
|
||||
// ErrLeafNodeMinVersionRejected is the leafnode protocol error prefix used
|
||||
// when rejecting a remote due to leafnodes.min_version.
|
||||
ErrLeafNodeMinVersionRejected = errors.New("connection rejected since minimum version required is")
|
||||
|
||||
// ErrInvalidMappingDestination is used for all subject mapping destination errors
|
||||
ErrInvalidMappingDestination = errors.New("invalid mapping destination")
|
||||
@@ -254,9 +251,6 @@ type mappingDestinationErr struct {
|
||||
}
|
||||
|
||||
func (e *mappingDestinationErr) Error() string {
|
||||
if e.token == _EMPTY_ {
|
||||
return e.err.Error()
|
||||
}
|
||||
return fmt.Sprintf("%s in %s", e.err, e.token)
|
||||
}
|
||||
|
||||
|
||||
-15
@@ -1500,8 +1500,6 @@ func (s *Server) initEventTracking() {
|
||||
type UserInfo struct {
|
||||
UserID string `json:"user"`
|
||||
Account string `json:"account"`
|
||||
AccountName string `json:"account_name,omitempty"`
|
||||
UserName string `json:"user_name,omitempty"`
|
||||
Permissions *Permissions `json:"permissions,omitempty"`
|
||||
Expires time.Duration `json:"expires,omitempty"`
|
||||
}
|
||||
@@ -1521,22 +1519,9 @@ func (s *Server) userInfoReq(sub *subscription, c *client, _ *Account, subject,
|
||||
return
|
||||
}
|
||||
|
||||
// Look up the requester's account directly from ci.Account rather than
|
||||
// using the acc returned by getRequestInfo, which may resolve to the
|
||||
// service account (ci.Service) when the request arrives via a chained
|
||||
// service import.
|
||||
var accountName string
|
||||
if ci.Account != _EMPTY_ {
|
||||
if reqAcc, _ := s.LookupAccount(ci.Account); reqAcc != nil {
|
||||
accountName = reqAcc.getNameTag()
|
||||
}
|
||||
}
|
||||
|
||||
response.Data = &UserInfo{
|
||||
UserID: ci.User,
|
||||
Account: ci.Account,
|
||||
AccountName: accountName,
|
||||
UserName: ci.NameTag,
|
||||
Permissions: c.publicPermissions(),
|
||||
Expires: c.claimExpiration(),
|
||||
}
|
||||
|
||||
+119
-191
@@ -508,39 +508,28 @@ func newFileStoreWithCreated(fcfg FileStoreConfig, cfg StreamConfig, created tim
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fs.mu.Lock()
|
||||
// Check if our prior state remembers a last sequence past where we can see.
|
||||
// Unless we're async flushing, in which case this can happen if some blocks weren't flushed.
|
||||
if prior.LastSeq > fs.state.LastSeq && !fs.fcfg.AsyncFlush {
|
||||
if mb, err := fs.newMsgBlockForWrite(); err != nil {
|
||||
fs.mu.Unlock()
|
||||
return nil, err
|
||||
} else if err = mb.writeTombstone(prior.LastSeq, prior.LastTime.UnixNano()); err != nil {
|
||||
fs.mu.Unlock()
|
||||
return nil, err
|
||||
}
|
||||
fs.state.LastSeq, fs.state.LastTime = prior.LastSeq, prior.LastTime
|
||||
if fs.state.Msgs == 0 {
|
||||
fs.state.FirstSeq = fs.state.LastSeq + 1
|
||||
fs.state.FirstTime = time.Time{}
|
||||
}
|
||||
if fs.ld != nil {
|
||||
if _, err := fs.newMsgBlockForWrite(); err == nil {
|
||||
if err = fs.writeTombstone(prior.LastSeq, prior.LastTime.UnixNano()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
// Since we recovered here, make sure to kick ourselves to write out our stream state.
|
||||
fs.dirty++
|
||||
fs.mu.Unlock()
|
||||
}
|
||||
|
||||
// Lock during the remainder of the recovery.
|
||||
fs.mu.Lock()
|
||||
// Use defer to ensure the lock is released if any of the enforcement operations
|
||||
// run into issues to avoid potential deadlocks on exit.
|
||||
unlocked := false
|
||||
defer func() {
|
||||
if !unlocked {
|
||||
fs.mu.Unlock()
|
||||
}
|
||||
}()
|
||||
|
||||
// See if we can bring back our TTL timed hash wheel state from disk.
|
||||
if cfg.AllowMsgTTL {
|
||||
if err = fs.recoverTTLState(); err != nil && !os.IsNotExist(err) {
|
||||
@@ -563,6 +552,9 @@ func newFileStoreWithCreated(fcfg FileStoreConfig, cfg StreamConfig, created tim
|
||||
}
|
||||
}()
|
||||
|
||||
// Lock while we do enforcements and removals.
|
||||
fs.mu.Lock()
|
||||
|
||||
// Check if we have any left over tombstones to process.
|
||||
if len(fs.tombs) > 0 {
|
||||
for _, seq := range fs.tombs {
|
||||
@@ -594,7 +586,6 @@ func newFileStoreWithCreated(fcfg FileStoreConfig, cfg StreamConfig, created tim
|
||||
// Grab first sequence for check below while we have lock.
|
||||
firstSeq := fs.state.FirstSeq
|
||||
fs.mu.Unlock()
|
||||
unlocked = true
|
||||
|
||||
// If the stream has an initial sequence number then make sure we
|
||||
// have purged up until that point. We will do this only if the
|
||||
@@ -1167,14 +1158,10 @@ func (fs *fileStore) recoverMsgBlock(index uint32) (*msgBlock, error) {
|
||||
var lchk [8]byte
|
||||
if mb.rbytes >= checksumSize {
|
||||
if mb.bek != nil {
|
||||
// We pass nil, so get a buf from the block pool, we'll need to recycle it afterward.
|
||||
buf, _ := mb.loadBlock(nil)
|
||||
if len(buf) >= checksumSize {
|
||||
if buf, _ := mb.loadBlock(nil); len(buf) >= checksumSize {
|
||||
mb.bek.XORKeyStream(buf, buf)
|
||||
copy(lchk[0:], buf[len(buf)-checksumSize:])
|
||||
}
|
||||
// We can recycle it now.
|
||||
recycleMsgBlockBuf(buf)
|
||||
} else {
|
||||
file.ReadAt(lchk[:], int64(mb.rbytes)-checksumSize)
|
||||
}
|
||||
@@ -1589,15 +1576,15 @@ func (mb *msgBlock) rebuildStateFromBufLocked(buf []byte, allowTruncate bool) (*
|
||||
rl, slen := le.Uint32(hdr[0:]), int(le.Uint16(hdr[20:]))
|
||||
|
||||
hasHeaders := rl&hbit != 0
|
||||
var ttl int64
|
||||
if mb.fs.ttls != nil && len(hdr) > 0 {
|
||||
ttl, _ = getMessageTTL(hdr)
|
||||
}
|
||||
// Clear any headers bit that could be set.
|
||||
rl &^= hbit
|
||||
shlen := slen
|
||||
if hasHeaders {
|
||||
shlen += 4
|
||||
}
|
||||
dlen := int(rl) - msgHdrSize
|
||||
// Do some quick sanity checks here.
|
||||
if dlen < 0 || shlen > (dlen-recordHashSize) || dlen > int(rl) || index+rl > lbuf || rl > rlBadThresh {
|
||||
if dlen < 0 || slen > (dlen-recordHashSize) || dlen > int(rl) || index+rl > lbuf || rl > rlBadThresh {
|
||||
truncate(index)
|
||||
return gatherLost(lbuf - index), tombstones, errBadMsg{mb.mfn, fmt.Sprintf("sanity check failed (dlen %d slen %d rl %d index %d lbuf %d)", dlen, slen, rl, index, lbuf)}
|
||||
}
|
||||
@@ -1674,6 +1661,21 @@ func (mb *msgBlock) rebuildStateFromBufLocked(buf []byte, allowTruncate bool) (*
|
||||
if !mb.dmap.Exists(seq) {
|
||||
mb.msgs++
|
||||
mb.bytes += uint64(rl)
|
||||
if ttl > 0 {
|
||||
if mb.fs.ttls != nil {
|
||||
expires := time.Duration(ts) + (time.Second * time.Duration(ttl))
|
||||
mb.fs.ttls.Add(seq, int64(expires))
|
||||
}
|
||||
// Need to count these regardless as we might want to enable TTLs
|
||||
// later via UpdateConfig.
|
||||
mb.ttls++
|
||||
}
|
||||
if mb.fs.scheduling != nil {
|
||||
if schedule, ok := getMessageSchedule(hdr); ok && !schedule.IsZero() {
|
||||
mb.fs.scheduling.add(seq, string(subj), schedule.UnixNano())
|
||||
mb.schedules++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateLast(seq, ts)
|
||||
@@ -1692,7 +1694,7 @@ func (mb *msgBlock) rebuildStateFromBufLocked(buf []byte, allowTruncate bool) (*
|
||||
} else if fseq == 0 && maxTombstoneSeq > 0 {
|
||||
atomic.StoreUint64(&mb.first.seq, maxTombstoneSeq+1)
|
||||
mb.first.ts = 0
|
||||
if lseq := atomic.LoadUint64(&mb.last.seq); lseq == 0 {
|
||||
if mb.last.seq == 0 {
|
||||
atomic.StoreUint64(&mb.last.seq, maxTombstoneSeq)
|
||||
mb.last.ts = maxTombstoneTs
|
||||
}
|
||||
@@ -1724,15 +1726,13 @@ func (fs *fileStore) debug(format string, args ...any) {
|
||||
|
||||
// Track local state but ignore timestamps here.
|
||||
func updateTrackingState(state *StreamState, mb *msgBlock) {
|
||||
first := atomic.LoadUint64(&mb.first.seq)
|
||||
last := atomic.LoadUint64(&mb.last.seq)
|
||||
if state.FirstSeq == 0 {
|
||||
state.FirstSeq = first
|
||||
} else if first < state.FirstSeq && mb.first.ts != 0 {
|
||||
state.FirstSeq = first
|
||||
state.FirstSeq = mb.first.seq
|
||||
} else if mb.first.seq < state.FirstSeq && mb.first.ts != 0 {
|
||||
state.FirstSeq = mb.first.seq
|
||||
}
|
||||
if last > state.LastSeq {
|
||||
state.LastSeq = last
|
||||
if mb.last.seq > state.LastSeq {
|
||||
state.LastSeq = mb.last.seq
|
||||
}
|
||||
state.Msgs += mb.msgs
|
||||
state.Bytes += mb.bytes
|
||||
@@ -2305,11 +2305,9 @@ func (fs *fileStore) recoverMsgs() error {
|
||||
if mb, err := fs.recoverMsgBlock(uint32(index)); err == nil && mb != nil {
|
||||
// This is a truncate block with possibly no index. If the OS got shutdown
|
||||
// out from underneath of us this is possible.
|
||||
mb.mu.Lock()
|
||||
if atomic.LoadUint64(&mb.first.seq) == 0 {
|
||||
if mb.first.seq == 0 {
|
||||
mb.dirtyCloseWithRemove(true)
|
||||
fs.removeMsgBlockFromList(mb)
|
||||
mb.mu.Unlock()
|
||||
continue
|
||||
}
|
||||
// If the stream is empty, reset the first/last sequences so these can
|
||||
@@ -2339,14 +2337,6 @@ func (fs *fileStore) recoverMsgs() error {
|
||||
}
|
||||
fs.state.Msgs += mb.msgs
|
||||
fs.state.Bytes += mb.bytes
|
||||
// If the block is empty, correct the sequences to be aligned with the current filestore state.
|
||||
if mb.msgs == 0 {
|
||||
atomic.StoreUint64(&mb.first.seq, fs.state.LastSeq+1)
|
||||
mb.first.ts = 0
|
||||
atomic.StoreUint64(&mb.last.seq, fs.state.LastSeq)
|
||||
mb.last.ts = fs.state.LastTime.UnixNano()
|
||||
}
|
||||
mb.mu.Unlock()
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
@@ -2575,7 +2565,6 @@ func (fs *fileStore) expireMsgsOnRecover() error {
|
||||
fs.selectNextFirst()
|
||||
|
||||
// Check if we have no messages and blocks left.
|
||||
|
||||
if fs.lmb == nil && last.seq != 0 {
|
||||
if lmb, _ := fs.newMsgBlockForWrite(); lmb != nil {
|
||||
fs.writeTombstone(last.seq, last.ts)
|
||||
@@ -3535,11 +3524,6 @@ func (fs *fileStore) allLastSeqsLocked() ([]uint64, error) {
|
||||
mb.fss.IterFast(func(bsubj []byte, ss *SimpleState) bool {
|
||||
// Check if already been processed and accounted.
|
||||
if _, ok := subs[string(bsubj)]; !ok {
|
||||
// Check if we need to recalculate. We only care about the last sequence.
|
||||
if ss.lastNeedsUpdate {
|
||||
// mb is already loaded into the cache so should be fast-ish.
|
||||
mb.recalculateForSubj(bytesToString(bsubj), ss)
|
||||
}
|
||||
seqs = append(seqs, ss.Last)
|
||||
subs[string(bsubj)] = struct{}{}
|
||||
}
|
||||
@@ -3566,7 +3550,6 @@ func (fs *fileStore) filterIsAll(filters []string) bool {
|
||||
}
|
||||
// Sort so we can compare.
|
||||
slices.Sort(filters)
|
||||
slices.Sort(fs.cfg.Subjects)
|
||||
for i, subj := range filters {
|
||||
if !subjectIsSubsetMatch(fs.cfg.Subjects[i], subj) {
|
||||
return false
|
||||
@@ -4041,11 +4024,7 @@ func (fs *fileStore) NumPending(sseq uint64, filter string, lastPerSubject bool)
|
||||
mb.mu.Unlock()
|
||||
}
|
||||
// Make final adjustment.
|
||||
if adjust > total {
|
||||
total = 0
|
||||
} else {
|
||||
total -= adjust
|
||||
}
|
||||
total -= adjust
|
||||
|
||||
return total, validThrough, nil
|
||||
}
|
||||
@@ -4137,7 +4116,7 @@ func (fs *fileStore) NumPendingMulti(sseq uint64, sl *gsl.SimpleSublist, lastPer
|
||||
var shouldExpire bool
|
||||
var updateLLTS bool
|
||||
// We need to walk this block to correct accounting from above.
|
||||
if sseq > atomic.LoadUint64(&mb.first.seq) {
|
||||
if sseq > mb.first.seq {
|
||||
// Track the ones we add back in case more than one.
|
||||
seen := make(map[string]bool)
|
||||
// We need to discount the total by subjects seen before sseq, but also add them right back in if they are >= sseq for this blk.
|
||||
@@ -4379,11 +4358,7 @@ func (fs *fileStore) NumPendingMulti(sseq uint64, sl *gsl.SimpleSublist, lastPer
|
||||
mb.mu.Unlock()
|
||||
}
|
||||
// Make final adjustment.
|
||||
if adjust > total {
|
||||
total = 0
|
||||
} else {
|
||||
total -= adjust
|
||||
}
|
||||
total -= adjust
|
||||
|
||||
return total, validThrough, nil
|
||||
}
|
||||
@@ -4879,15 +4854,11 @@ func (fs *fileStore) SkipMsgs(seq uint64, num uint64) error {
|
||||
const maxDeletes = 64 * 1024
|
||||
mb := fs.lmb
|
||||
|
||||
var msgs uint64
|
||||
numDeletes := int(num)
|
||||
if mb != nil {
|
||||
mb.mu.RLock()
|
||||
numDeletes += mb.dmap.Size()
|
||||
msgs = mb.msgs
|
||||
mb.mu.RUnlock()
|
||||
}
|
||||
if mb == nil || numDeletes > maxDeletes && msgs > 0 || msgs > 0 && mb.blkSize()+emptyRecordLen > fs.fcfg.BlockSize {
|
||||
if mb == nil || numDeletes > maxDeletes && mb.msgs > 0 || mb.msgs > 0 && mb.blkSize()+emptyRecordLen > fs.fcfg.BlockSize {
|
||||
var err error
|
||||
if mb, err = fs.newMsgBlockForWrite(); err != nil {
|
||||
return err
|
||||
@@ -4998,18 +4969,18 @@ func (fs *fileStore) firstSeqForSubj(subj string) (uint64, error) {
|
||||
|
||||
bsubj := stringToBytes(subj)
|
||||
if ss, ok := mb.fss.Find(bsubj); ok && ss != nil {
|
||||
if ss.firstNeedsUpdate || ss.lastNeedsUpdate {
|
||||
mb.recalculateForSubj(subj, ss)
|
||||
}
|
||||
mb.mu.Unlock()
|
||||
// Re-acquire fs lock
|
||||
fs.mu.Lock()
|
||||
// Adjust first if it was not where we thought it should be.
|
||||
if i != start {
|
||||
if info, ok := fs.psim.Find(bsubj); ok {
|
||||
info.fblk = i
|
||||
}
|
||||
}
|
||||
if ss.firstNeedsUpdate || ss.lastNeedsUpdate {
|
||||
mb.recalculateForSubj(subj, ss)
|
||||
}
|
||||
mb.mu.Unlock()
|
||||
// Re-acquire fs lock
|
||||
fs.mu.Lock()
|
||||
return ss.First, nil
|
||||
}
|
||||
// If we did not find it and we loaded this msgBlock try to expire as long as not the last.
|
||||
@@ -5329,15 +5300,18 @@ func (fs *fileStore) removeMsg(seq uint64, secure, viaLimits, needFSLock bool) (
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
smv StoreMsg
|
||||
subj string
|
||||
ts int64
|
||||
lhdr, lmsg int
|
||||
ttl int64
|
||||
)
|
||||
// We don't use a copy as long as that's possible. When unlocking mb or erasing, we'll copy the subject.
|
||||
sm, err := mb.cacheLookupNoCopy(seq, &smv)
|
||||
var smv StoreMsg
|
||||
var sm *StoreMsg
|
||||
var err error
|
||||
if secure {
|
||||
// For a secure erase we can't use NoCopy, as eraseMsg will overwrite the
|
||||
// cache and we won't be able to access sm.subj etc anymore later on.
|
||||
sm, err = mb.cacheLookup(seq, &smv)
|
||||
} else {
|
||||
// For a non-secure erase it's fine to use NoCopy, as the cache won't change
|
||||
// from underneath us.
|
||||
sm, err = mb.cacheLookupNoCopy(seq, &smv)
|
||||
}
|
||||
if err != nil {
|
||||
finishedWithCache()
|
||||
mb.mu.Unlock()
|
||||
@@ -5347,12 +5321,6 @@ func (fs *fileStore) removeMsg(seq uint64, secure, viaLimits, needFSLock bool) (
|
||||
err = nil
|
||||
}
|
||||
return false, err
|
||||
} else if sm != nil {
|
||||
subj = sm.subj
|
||||
ts = sm.ts
|
||||
lhdr = len(sm.hdr)
|
||||
lmsg = len(sm.msg)
|
||||
ttl, _ = getMessageTTL(sm.hdr)
|
||||
}
|
||||
|
||||
// Check if we need to write a deleted record tombstone.
|
||||
@@ -5360,8 +5328,6 @@ func (fs *fileStore) removeMsg(seq uint64, secure, viaLimits, needFSLock bool) (
|
||||
// when the last block is empty.
|
||||
// If not via limits and not empty (empty writes tombstone below if last) write tombstone.
|
||||
if !viaLimits && !isEmpty && sm != nil {
|
||||
// Need to copy the subject since we unlock and re-acquire, and the cache could change.
|
||||
subj = copyString(subj)
|
||||
mb.mu.Unlock() // Only safe way to checkLastBlock is to unlock here...
|
||||
lmb, err := fs.checkLastBlock(emptyRecordLen)
|
||||
if err != nil {
|
||||
@@ -5369,7 +5335,7 @@ func (fs *fileStore) removeMsg(seq uint64, secure, viaLimits, needFSLock bool) (
|
||||
fsUnlock()
|
||||
return false, err
|
||||
}
|
||||
if err := lmb.writeTombstone(seq, ts); err != nil {
|
||||
if err := lmb.writeTombstone(sm.seq, sm.ts); err != nil {
|
||||
finishedWithCache()
|
||||
fsUnlock()
|
||||
return false, err
|
||||
@@ -5378,7 +5344,7 @@ func (fs *fileStore) removeMsg(seq uint64, secure, viaLimits, needFSLock bool) (
|
||||
}
|
||||
|
||||
// Grab size
|
||||
msz := fileStoreMsgSizeRaw(len(subj), lhdr, lmsg)
|
||||
msz := fileStoreMsgSize(sm.subj, sm.hdr, sm.msg)
|
||||
|
||||
// Set cache timestamp for last remove.
|
||||
mb.lrts = ats.AccessTime()
|
||||
@@ -5393,9 +5359,6 @@ func (fs *fileStore) removeMsg(seq uint64, secure, viaLimits, needFSLock bool) (
|
||||
fsUnlock()
|
||||
return false, err
|
||||
}
|
||||
// Need to copy the subject, as eraseMsg will overwrite the cache and we won't
|
||||
// be able to access sm.subj anymore later on.
|
||||
subj = copyString(subj)
|
||||
if err := mb.eraseMsg(seq, int(ri), int(msz), isLastBlock); err != nil {
|
||||
finishedWithCache()
|
||||
mb.mu.Unlock()
|
||||
@@ -5434,11 +5397,13 @@ func (fs *fileStore) removeMsg(seq uint64, secure, viaLimits, needFSLock bool) (
|
||||
mb.ensurePerSubjectInfoLoaded()
|
||||
|
||||
// If we are tracking multiple subjects here make sure we update that accounting.
|
||||
mb.removeSeqPerSubject(subj, seq)
|
||||
fs.removePerSubject(subj)
|
||||
if fs.ttls != nil && ttl > 0 {
|
||||
expires := time.Duration(ts) + (time.Second * time.Duration(ttl))
|
||||
fs.ttls.Remove(seq, int64(expires))
|
||||
mb.removeSeqPerSubject(sm.subj, seq)
|
||||
fs.removePerSubject(sm.subj)
|
||||
if fs.ttls != nil {
|
||||
if ttl, err := getMessageTTL(sm.hdr); err == nil {
|
||||
expires := time.Duration(sm.ts) + (time.Second * time.Duration(ttl))
|
||||
fs.ttls.Remove(seq, int64(expires))
|
||||
}
|
||||
}
|
||||
|
||||
if fifo {
|
||||
@@ -5496,7 +5461,7 @@ func (fs *fileStore) removeMsg(seq uint64, secure, viaLimits, needFSLock bool) (
|
||||
fs.mu.Unlock()
|
||||
// Storage updates.
|
||||
delta := int64(msz)
|
||||
cb(-1, -delta, seq, subj)
|
||||
cb(-1, -delta, seq, sm.subj)
|
||||
|
||||
if !needFSLock {
|
||||
fs.mu.Lock()
|
||||
@@ -5567,16 +5532,11 @@ func (mb *msgBlock) compactWithFloor(floor uint64) error {
|
||||
}
|
||||
hdr := buf[index : index+msgHdrSize]
|
||||
rl, slen := le.Uint32(hdr[0:]), int(le.Uint16(hdr[20:]))
|
||||
hasHeaders := rl&hbit != 0
|
||||
// Clear any headers bit that could be set.
|
||||
rl &^= hbit
|
||||
shlen := slen
|
||||
if hasHeaders {
|
||||
shlen += 4
|
||||
}
|
||||
dlen := int(rl) - msgHdrSize
|
||||
// Do some quick sanity checks here.
|
||||
if dlen < 0 || shlen > (dlen-recordHashSize) || dlen > int(rl) || index+rl > lbuf || rl > rlBadThresh {
|
||||
if dlen < 0 || slen > (dlen-recordHashSize) || dlen > int(rl) || index+rl > lbuf || rl > rlBadThresh {
|
||||
return fmt.Errorf("sanity check failed")
|
||||
}
|
||||
// Only need to process non-deleted messages.
|
||||
@@ -5614,16 +5574,15 @@ func (mb *msgBlock) compactWithFloor(floor uint64) error {
|
||||
|
||||
// Handle compression
|
||||
if mb.cmp != NoCompression && len(nbuf) > 0 {
|
||||
originalSize := len(nbuf)
|
||||
var err error
|
||||
if nbuf, err = mb.cmp.Compress(nbuf); err != nil {
|
||||
cbuf, err := mb.cmp.Compress(nbuf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
meta := &CompressionInfo{
|
||||
Algorithm: mb.cmp,
|
||||
OriginalSize: uint64(originalSize),
|
||||
OriginalSize: uint64(len(nbuf)),
|
||||
}
|
||||
nbuf = append(meta.MarshalMetadata(), nbuf...)
|
||||
nbuf = append(meta.MarshalMetadata(), cbuf...)
|
||||
}
|
||||
|
||||
// Check for encryption.
|
||||
@@ -5957,10 +5916,10 @@ func (mb *msgBlock) truncate(tseq uint64, ts int64) (nmsgs, nbytes uint64, err e
|
||||
}
|
||||
}
|
||||
|
||||
// If the block is compressed/encrypted then we have to load it into memory
|
||||
// and decompress/decrypt it, truncate it and then write it back out.
|
||||
// If the block is compressed then we have to load it into memory
|
||||
// and decompress it, truncate it and then write it back out.
|
||||
// Otherwise, truncate the file itself and close the descriptor.
|
||||
if mb.cmp != NoCompression || mb.bek != nil {
|
||||
if mb.cmp != NoCompression {
|
||||
buf, err := mb.loadBlock(nil)
|
||||
if err != nil {
|
||||
return 0, 0, fmt.Errorf("failed to load block from disk: %w", err)
|
||||
@@ -5972,7 +5931,7 @@ func (mb *msgBlock) truncate(tseq uint64, ts int64) (nmsgs, nbytes uint64, err e
|
||||
return 0, 0, fmt.Errorf("failed to decompress block: %w", err)
|
||||
}
|
||||
buf = buf[:eof]
|
||||
copy(mb.lchk[0:], buf[len(buf)-checksumSize:])
|
||||
copy(mb.lchk[0:], buf[:len(buf)-checksumSize])
|
||||
// We did decompress but don't recompress the truncated buffer here since we're the last block
|
||||
// and would otherwise have compressed data and allow to write uncompressed data in the same block.
|
||||
if err = mb.atomicOverwriteFile(buf, false); err != nil {
|
||||
@@ -7015,7 +6974,6 @@ func (mb *msgBlock) atomicOverwriteFile(buf []byte, allowCompress bool) error {
|
||||
// The original buffer at this point is uncompressed, so we will now compress
|
||||
// it if needed. Note that if the selected algorithm is NoCompression, the
|
||||
// Compress function will just return the input buffer unmodified.
|
||||
originalSize := len(buf)
|
||||
if buf, err = alg.Compress(buf); err != nil {
|
||||
return errorCleanup(fmt.Errorf("failed to compress block: %w", err))
|
||||
}
|
||||
@@ -7025,7 +6983,7 @@ func (mb *msgBlock) atomicOverwriteFile(buf []byte, allowCompress bool) error {
|
||||
// writing metadata.
|
||||
meta := &CompressionInfo{
|
||||
Algorithm: alg,
|
||||
OriginalSize: uint64(originalSize),
|
||||
OriginalSize: uint64(len(buf)),
|
||||
}
|
||||
buf = append(meta.MarshalMetadata(), buf...)
|
||||
}
|
||||
@@ -7373,7 +7331,7 @@ func (mb *msgBlock) indexCacheBuf(buf []byte) error {
|
||||
|
||||
lbuf := uint32(len(buf))
|
||||
var seq, ttls, schedules uint64
|
||||
var sm StoreMsg // Used for finding headers
|
||||
var sm StoreMsg // Used for finding TTL headers
|
||||
|
||||
// To ensure the sequence keeps moving up. As well as confirming our index
|
||||
// is aligned with the mb's first and last sequence.
|
||||
@@ -7388,16 +7346,13 @@ func (mb *msgBlock) indexCacheBuf(buf []byte) error {
|
||||
rl, slen := le.Uint32(hdr[0:]), int(le.Uint16(hdr[20:]))
|
||||
seq = le.Uint64(hdr[4:])
|
||||
|
||||
hasHeaders := rl&hbit != 0
|
||||
// Clear any headers bit that could be set.
|
||||
hasHeaders := rl&hbit != 0
|
||||
rl &^= hbit
|
||||
shlen := slen
|
||||
if hasHeaders {
|
||||
shlen += 4
|
||||
}
|
||||
dlen := int(rl) - msgHdrSize
|
||||
|
||||
// Do some quick sanity checks here.
|
||||
if dlen < 0 || shlen > (dlen-recordHashSize) || dlen > int(rl) || index+rl > lbuf || rl > rlBadThresh {
|
||||
if dlen < 0 || slen > (dlen-recordHashSize) || dlen > int(rl) || index+rl > lbuf || rl > rlBadThresh {
|
||||
mb.fs.warn("indexCacheBuf corrupt record state in %s: dlen %d slen %d index %d rl %d lbuf %d", mb.mfn, dlen, slen, index, rl, lbuf)
|
||||
// This means something is off.
|
||||
// TODO(dlc) - Add into bad list?
|
||||
@@ -8134,13 +8089,8 @@ func (mb *msgBlock) msgFromBufEx(buf []byte, sm *StoreMsg, hh *highwayhash.Diges
|
||||
rl &^= hbit // clear header bit
|
||||
dlen := int(rl) - msgHdrSize
|
||||
slen := int(le.Uint16(hdr[20:]))
|
||||
|
||||
shlen := slen
|
||||
if hasHeaders {
|
||||
shlen += 4
|
||||
}
|
||||
// Simple sanity check.
|
||||
if dlen < 0 || shlen > (dlen-recordHashSize) || dlen > int(rl) || int(rl) > len(buf) || rl > rlBadThresh {
|
||||
if dlen < 0 || slen > (dlen-recordHashSize) || dlen > int(rl) || int(rl) > len(buf) || rl > rlBadThresh {
|
||||
return nil, errBadMsg{mb.mfn, fmt.Sprintf("sanity check failed (dlen %d slen %d rl %d buf %d)", dlen, slen, rl, buf)}
|
||||
}
|
||||
data := buf[msgHdrSize : msgHdrSize+dlen]
|
||||
@@ -8242,8 +8192,7 @@ func (fs *fileStore) SubjectForSeq(seq uint64) (string, error) {
|
||||
fs.mu.RUnlock()
|
||||
if mb != nil {
|
||||
if sm, _, _ := mb.fetchMsgNoCopy(seq, &smv); sm != nil {
|
||||
// Copy the subject, as it's used elsewhere, and the backing cache could be reused in the meantime.
|
||||
return copyString(sm.subj), nil
|
||||
return sm.subj, nil
|
||||
}
|
||||
}
|
||||
return _EMPTY_, ErrStoreMsgNotFound
|
||||
@@ -8316,11 +8265,6 @@ func (fs *fileStore) loadLast(subj string, sm *StoreMsg) (lsm *StoreMsg, err err
|
||||
// Optimize if subject is not a wildcard.
|
||||
if !wc {
|
||||
if ss, ok := mb.fss.Find(stringToBytes(subj)); ok && ss != nil {
|
||||
// Check if we need to recalculate. We only care about the last sequence.
|
||||
if ss.lastNeedsUpdate {
|
||||
// mb is already loaded into the cache so should be fast-ish.
|
||||
mb.recalculateForSubj(subj, ss)
|
||||
}
|
||||
l = ss.Last
|
||||
}
|
||||
}
|
||||
@@ -8880,9 +8824,7 @@ func (fs *fileStore) cacheLoads() uint64 {
|
||||
var tl uint64
|
||||
fs.mu.RLock()
|
||||
for _, mb := range fs.blks {
|
||||
mb.mu.RLock()
|
||||
tl += mb.cloads
|
||||
mb.mu.RUnlock()
|
||||
}
|
||||
fs.mu.RUnlock()
|
||||
return tl
|
||||
@@ -8893,7 +8835,7 @@ func (fs *fileStore) cacheSize() uint64 {
|
||||
var sz uint64
|
||||
fs.mu.RLock()
|
||||
for _, mb := range fs.blks {
|
||||
mb.mu.Lock()
|
||||
mb.mu.RLock()
|
||||
var needsCleanup bool
|
||||
if mb.cache == nil {
|
||||
mb.cache = mb.ecache.Value()
|
||||
@@ -8905,7 +8847,7 @@ func (fs *fileStore) cacheSize() uint64 {
|
||||
if needsCleanup {
|
||||
mb.finishedWithCache()
|
||||
}
|
||||
mb.mu.Unlock()
|
||||
mb.mu.RUnlock()
|
||||
}
|
||||
fs.mu.RUnlock()
|
||||
return sz
|
||||
@@ -9004,7 +8946,6 @@ func (fs *fileStore) PurgeEx(subject string, sequence, keep uint64) (purged uint
|
||||
if mb.cacheNotLoaded() {
|
||||
if err := mb.loadMsgsWithLock(); err != nil {
|
||||
mb.mu.Unlock()
|
||||
fs.mu.Unlock()
|
||||
return 0, err
|
||||
}
|
||||
shouldExpire = true
|
||||
@@ -9108,7 +9049,6 @@ func (fs *fileStore) PurgeEx(subject string, sequence, keep uint64) (purged uint
|
||||
if len(tombs) > 0 {
|
||||
for _, tomb := range tombs {
|
||||
if err := fs.writeTombstoneNoFlush(tomb.seq, tomb.ts); err != nil {
|
||||
fs.mu.Unlock()
|
||||
return purged, err
|
||||
}
|
||||
}
|
||||
@@ -9428,7 +9368,6 @@ SKIP:
|
||||
if len(tombs) > 0 {
|
||||
for _, tomb := range tombs {
|
||||
if err := fs.writeTombstoneNoFlush(tomb.seq, tomb.ts); err != nil {
|
||||
fs.mu.Unlock()
|
||||
return purged, err
|
||||
}
|
||||
}
|
||||
@@ -9619,7 +9558,6 @@ func (fs *fileStore) Truncate(seq uint64) error {
|
||||
// If we end up not needing to write tombstones, this block will be cleaned up at the end.
|
||||
tmb, err := fs.newMsgBlockForWrite()
|
||||
if err != nil {
|
||||
fs.mu.Unlock()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -10221,29 +10159,6 @@ func (fs *fileStore) populateGlobalPerSubjectInfo(mb *msgBlock) {
|
||||
})
|
||||
}
|
||||
|
||||
// Calls os.RemoveAll on the given `dir` directory, but if an error occurs,
|
||||
// retries up to one second. If that still fails, returns the last error
|
||||
// that os.RemoveAll returned.
|
||||
func removeAllWithRetry(dir string) error {
|
||||
<-dios
|
||||
err := os.RemoveAll(dir)
|
||||
dios <- struct{}{}
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
ttl := time.Now().Add(time.Second)
|
||||
for time.Now().Before(ttl) {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
<-dios
|
||||
err = os.RemoveAll(dir)
|
||||
dios <- struct{}{}
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Close the message block.
|
||||
func (mb *msgBlock) close(sync bool) {
|
||||
if mb == nil {
|
||||
@@ -10346,12 +10261,28 @@ func (fs *fileStore) Delete(inline bool) error {
|
||||
}
|
||||
// Do this in separate Go routine in case lots of blocks.
|
||||
// Purge above protects us as does the removal of meta artifacts above.
|
||||
if inline {
|
||||
if err := removeAllWithRetry(ndir); err != nil {
|
||||
return err
|
||||
removeDir := func() {
|
||||
<-dios
|
||||
err := os.RemoveAll(ndir)
|
||||
dios <- struct{}{}
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
ttl := time.Now().Add(time.Second)
|
||||
for time.Now().Before(ttl) {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
<-dios
|
||||
err = os.RemoveAll(ndir)
|
||||
dios <- struct{}{}
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if inline {
|
||||
removeDir()
|
||||
} else {
|
||||
go removeAllWithRetry(ndir)
|
||||
go removeDir()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -10906,18 +10837,18 @@ func (fs *fileStore) streamSnapshot(w io.WriteCloser, includeConsumers bool, err
|
||||
const minLen = 32
|
||||
sfn := filepath.Join(fs.fcfg.StoreDir, msgDir, streamStreamStateFile)
|
||||
if buf, err := os.ReadFile(sfn); err == nil && len(buf) >= minLen {
|
||||
fs.mu.Lock()
|
||||
if fs.aek != nil {
|
||||
ns := fs.aek.NonceSize()
|
||||
buf, err = fs.aek.Open(nil, buf[:ns], buf[ns:len(buf)-highwayhash.Size64], nil)
|
||||
if err == nil {
|
||||
// Redo hash checksum at end on plaintext.
|
||||
fs.mu.Lock()
|
||||
hh.Reset()
|
||||
hh.Write(buf)
|
||||
buf = fs.hh.Sum(buf)
|
||||
fs.mu.Unlock()
|
||||
}
|
||||
}
|
||||
fs.mu.Unlock()
|
||||
if err == nil && writeFile(msgPre+streamStreamStateFile, buf) != nil {
|
||||
return
|
||||
}
|
||||
@@ -11708,7 +11639,7 @@ func (o *consumerFileStore) Update(state *ConsumerState) error {
|
||||
|
||||
// Check to see if this is an outdated update.
|
||||
if state.Delivered.Consumer < o.state.Delivered.Consumer || state.AckFloor.Stream < o.state.AckFloor.Stream {
|
||||
return ErrStoreOldUpdate
|
||||
return fmt.Errorf("old update ignored")
|
||||
}
|
||||
|
||||
o.state.Delivered = state.Delivered
|
||||
@@ -11772,7 +11703,6 @@ func (o *consumerFileStore) writeState(buf []byte) error {
|
||||
if o.aek != nil {
|
||||
var err error
|
||||
if buf, err = o.encryptState(buf); err != nil {
|
||||
o.mu.Unlock()
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -12138,7 +12068,6 @@ func (o *consumerFileStore) Stop() error {
|
||||
if buf, err = o.encodeState(); err == nil && len(buf) > 0 {
|
||||
if o.aek != nil {
|
||||
if buf, err = o.encryptState(buf); err != nil {
|
||||
o.mu.Unlock()
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -12193,6 +12122,7 @@ func (o *consumerFileStore) delete(streamDeleted bool) error {
|
||||
o.qch = nil
|
||||
}
|
||||
|
||||
var err error
|
||||
odir := o.odir
|
||||
o.odir = _EMPTY_
|
||||
o.closed = true
|
||||
@@ -12201,18 +12131,16 @@ func (o *consumerFileStore) delete(streamDeleted bool) error {
|
||||
|
||||
// If our stream was not deleted this will remove the directories.
|
||||
if odir != _EMPTY_ && !streamDeleted {
|
||||
if err := removeAllWithRetry(odir); err != nil {
|
||||
return err
|
||||
}
|
||||
<-dios
|
||||
err = os.RemoveAll(odir)
|
||||
dios <- struct{}{}
|
||||
}
|
||||
|
||||
if !streamDeleted {
|
||||
if err := fs.RemoveConsumer(o); err != nil {
|
||||
return err
|
||||
}
|
||||
fs.RemoveConsumer(o)
|
||||
}
|
||||
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *fileStore) AddConsumer(o ConsumerStore) error {
|
||||
|
||||
+13
-9
@@ -1563,7 +1563,7 @@ func (a *Account) EnableJetStream(limits map[string]JetStreamAccountLimits, tq c
|
||||
}
|
||||
|
||||
// Add in the stream.
|
||||
mset, err := a.recoverStream(&cfg.StreamConfig)
|
||||
mset, err := a.addStream(&cfg.StreamConfig)
|
||||
if err != nil {
|
||||
s.Warnf(" Error recreating stream %q: %v", cfg.Name, err)
|
||||
// If we removed a keyfile from above make sure to put it back.
|
||||
@@ -2365,10 +2365,8 @@ func tierName(replicas int) string {
|
||||
}
|
||||
|
||||
func isSameTier(cfgA, cfgB *StreamConfig) bool {
|
||||
a := max(1, cfgA.Replicas)
|
||||
b := max(1, cfgB.Replicas)
|
||||
// TODO (mh) this is where we could select based off a placement tag as well "qos:tier"
|
||||
return a == b
|
||||
return cfgA.Replicas == cfgB.Replicas
|
||||
}
|
||||
|
||||
func (jsa *jsAccount) jetStreamAndClustered() (*jetStream, bool) {
|
||||
@@ -2443,11 +2441,17 @@ func (jsa *jsAccount) wouldExceedLimits(storeType StorageType, tierName string,
|
||||
// Since tiers are flat we need to scale limit up by replicas when checking.
|
||||
if storeType == MemoryStorage {
|
||||
totalMem := inUse.total.mem + (int64(memStoreMsgSize(subj, hdr, msg)) * r)
|
||||
if selectedLimits.MemoryMaxStreamBytes > 0 && totalMem > selectedLimits.MemoryMaxStreamBytes*lr {
|
||||
return true, nil
|
||||
}
|
||||
if selectedLimits.MaxMemory >= 0 && totalMem > selectedLimits.MaxMemory*lr {
|
||||
return true, nil
|
||||
}
|
||||
} else {
|
||||
totalStore := inUse.total.store + (int64(fileStoreMsgSize(subj, hdr, msg)) * r)
|
||||
if selectedLimits.StoreMaxStreamBytes > 0 && totalStore > selectedLimits.StoreMaxStreamBytes*lr {
|
||||
return true, nil
|
||||
}
|
||||
if selectedLimits.MaxStore >= 0 && totalStore > selectedLimits.MaxStore*lr {
|
||||
return true, nil
|
||||
}
|
||||
@@ -2486,25 +2490,25 @@ func (js *jetStream) checkBytesLimits(selectedLimits *JetStreamAccountLimits, ad
|
||||
if addBytes < 0 {
|
||||
addBytes = 1
|
||||
}
|
||||
totalBytes := addSaturate(addBytes, maxBytesOffset)
|
||||
totalBytes := addBytes + maxBytesOffset
|
||||
|
||||
switch storage {
|
||||
case MemoryStorage:
|
||||
// Account limits defined.
|
||||
if selectedLimits.MaxMemory >= 0 && (currentRes > selectedLimits.MaxMemory || totalBytes > selectedLimits.MaxMemory-currentRes) {
|
||||
if selectedLimits.MaxMemory >= 0 && currentRes+totalBytes > selectedLimits.MaxMemory {
|
||||
return NewJSMemoryResourcesExceededError()
|
||||
}
|
||||
// Check if this server can handle request.
|
||||
if checkServer && (js.memReserved > js.config.MaxMemory || totalBytes > js.config.MaxMemory-js.memReserved) {
|
||||
if checkServer && js.memReserved+totalBytes > js.config.MaxMemory {
|
||||
return NewJSMemoryResourcesExceededError()
|
||||
}
|
||||
case FileStorage:
|
||||
// Account limits defined.
|
||||
if selectedLimits.MaxStore >= 0 && (currentRes > selectedLimits.MaxStore || totalBytes > selectedLimits.MaxStore-currentRes) {
|
||||
if selectedLimits.MaxStore >= 0 && currentRes+totalBytes > selectedLimits.MaxStore {
|
||||
return NewJSStorageResourcesExceededError()
|
||||
}
|
||||
// Check if this server can handle request.
|
||||
if checkServer && (js.storeReserved > js.config.MaxStore || totalBytes > js.config.MaxStore-js.storeReserved) {
|
||||
if checkServer && js.storeReserved+totalBytes > js.config.MaxStore {
|
||||
return NewJSStorageResourcesExceededError()
|
||||
}
|
||||
}
|
||||
|
||||
+196
-259
@@ -24,10 +24,11 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"github.com/nats-io/nuid"
|
||||
)
|
||||
@@ -562,17 +563,9 @@ type JSApiStreamSnapshotRequest struct {
|
||||
DeliverSubject string `json:"deliver_subject"`
|
||||
// Do not include consumers in the snapshot.
|
||||
NoConsumers bool `json:"no_consumers,omitempty"`
|
||||
// Optional chunk size preference. Defaults to 128KB,
|
||||
// automatically clamped to within the range 1KB to 1MB.
|
||||
// A smaller chunk size means more in-flight messages
|
||||
// and more acks needed. Links with good throughput
|
||||
// but high latency may need to increase this.
|
||||
// Optional chunk size preference.
|
||||
// Best to just let server select.
|
||||
ChunkSize int `json:"chunk_size,omitempty"`
|
||||
// Optional window size preference. Defaults to 8MB,
|
||||
// automatically clamped to within the range 1KB to 32MB.
|
||||
// very slow connections may need to reduce this to
|
||||
// avoid slow consumer issues.
|
||||
WindowSize int `json:"window_size,omitempty"`
|
||||
// Check all message's checksums prior to snapshot.
|
||||
CheckMsgs bool `json:"jsck,omitempty"`
|
||||
}
|
||||
@@ -607,7 +600,7 @@ const JSApiStreamRestoreResponseType = "io.nats.jetstream.api.v1.stream_restore_
|
||||
|
||||
// JSApiStreamRemovePeerRequest is the required remove peer request.
|
||||
type JSApiStreamRemovePeerRequest struct {
|
||||
// Server name or peer ID of the peer to be removed.
|
||||
// Server name of the peer to be removed.
|
||||
Peer string `json:"peer"`
|
||||
}
|
||||
|
||||
@@ -1585,19 +1578,23 @@ func (s *Server) jsonResponse(v any) string {
|
||||
|
||||
// Read lock must be held
|
||||
func (jsa *jsAccount) tieredReservation(tier string, cfg *StreamConfig) int64 {
|
||||
var reservation int64
|
||||
for _, sa := range jsa.streams {
|
||||
// Don't count the stream toward the limit if it already exists.
|
||||
if sa.cfg.Name == cfg.Name {
|
||||
continue
|
||||
reservation := int64(0)
|
||||
if tier == _EMPTY_ {
|
||||
for _, sa := range jsa.streams {
|
||||
if sa.cfg.MaxBytes > 0 {
|
||||
if sa.cfg.Storage == cfg.Storage && sa.cfg.Name != cfg.Name {
|
||||
reservation += (int64(sa.cfg.Replicas) * sa.cfg.MaxBytes)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tier == _EMPTY_ || isSameTier(&sa.cfg, cfg)) && sa.cfg.MaxBytes > 0 && sa.cfg.Storage == cfg.Storage {
|
||||
// If tier is empty, all storage is flat and we should adjust for replicas.
|
||||
// Otherwise if tiered, storage replication already taken into consideration.
|
||||
if tier == _EMPTY_ && sa.cfg.Replicas > 1 {
|
||||
reservation = addSaturate(reservation, mulSaturate(int64(sa.cfg.Replicas), sa.cfg.MaxBytes))
|
||||
} else {
|
||||
reservation = addSaturate(reservation, sa.cfg.MaxBytes)
|
||||
} else {
|
||||
for _, sa := range jsa.streams {
|
||||
if sa.cfg.Replicas == cfg.Replicas {
|
||||
if sa.cfg.MaxBytes > 0 {
|
||||
if isSameTier(&sa.cfg, cfg) && sa.cfg.Name != cfg.Name {
|
||||
reservation += (int64(sa.cfg.Replicas) * sa.cfg.MaxBytes)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1880,7 +1877,7 @@ func (s *Server) jsStreamNamesRequest(sub *subscription, c *client, _ *Account,
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
offset = max(req.Offset, 0)
|
||||
offset = req.Offset
|
||||
if req.Subject != _EMPTY_ {
|
||||
filter = req.Subject
|
||||
}
|
||||
@@ -2016,7 +2013,7 @@ func (s *Server) jsStreamListRequest(sub *subscription, c *client, _ *Account, s
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
offset = max(req.Offset, 0)
|
||||
offset = req.Offset
|
||||
if req.Subject != _EMPTY_ {
|
||||
filter = req.Subject
|
||||
}
|
||||
@@ -2212,7 +2209,7 @@ func (s *Server) jsStreamInfoRequest(sub *subscription, c *client, a *Account, s
|
||||
return
|
||||
}
|
||||
details, subjects = req.DeletedDetails, req.SubjectsFilter
|
||||
offset = max(req.Offset, 0)
|
||||
offset = req.Offset
|
||||
}
|
||||
|
||||
mset, err := acc.lookupStream(streamName)
|
||||
@@ -2579,7 +2576,7 @@ func (s *Server) jsStreamRemovePeerRequest(sub *subscription, c *client, _ *Acco
|
||||
}
|
||||
|
||||
js.mu.RLock()
|
||||
isLeader, sa := cc.isLeader(), js.streamAssignmentOrInflight(acc.Name, name)
|
||||
isLeader, sa := cc.isLeader(), js.streamAssignment(acc.Name, name)
|
||||
js.mu.RUnlock()
|
||||
|
||||
// Make sure we are meta leader.
|
||||
@@ -2625,17 +2622,13 @@ func (s *Server) jsStreamRemovePeerRequest(sub *subscription, c *client, _ *Acco
|
||||
return
|
||||
}
|
||||
|
||||
// Check to see if we are a member of the group and if the group has no leader.
|
||||
// Peers here is a server name, convert to node name.
|
||||
nodeName := getHash(req.Peer)
|
||||
|
||||
js.mu.RLock()
|
||||
rg := sa.Group
|
||||
|
||||
// Check to see if we are a member of the group.
|
||||
// Peer here is either a peer ID or a server name, convert to node name.
|
||||
nodeName := getHash(req.Peer)
|
||||
isMember := rg.isMember(nodeName)
|
||||
if !isMember {
|
||||
nodeName = req.Peer
|
||||
isMember = rg.isMember(nodeName)
|
||||
}
|
||||
js.mu.RUnlock()
|
||||
|
||||
// Make sure we are a member.
|
||||
@@ -3090,13 +3083,6 @@ func (s *Server) jsLeaderAccountPurgeRequest(sub *subscription, c *client, _ *Ac
|
||||
|
||||
var resp = JSApiAccountPurgeResponse{ApiResponse: ApiResponse{Type: JSApiAccountPurgeResponseType}}
|
||||
|
||||
// Check for path like separators in the name.
|
||||
if strings.ContainsAny(accName, `\/`) {
|
||||
resp.Error = NewJSStreamGeneralError(errors.New("account name can not contain path separators"))
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
|
||||
if !s.JetStreamIsClustered() {
|
||||
var streams []*stream
|
||||
var ac *Account
|
||||
@@ -3149,23 +3135,22 @@ func (s *Server) jsLeaderAccountPurgeRequest(sub *subscription, c *client, _ *Ac
|
||||
return
|
||||
}
|
||||
|
||||
js.mu.Lock()
|
||||
js.mu.RLock()
|
||||
ns, nc := 0, 0
|
||||
for osa := range js.streamAssignmentsOrInflightSeq(accName) {
|
||||
for oca := range js.consumerAssignmentsOrInflightSeq(accName, osa.Config.Name) {
|
||||
streams, hasAccount := cc.streams[accName]
|
||||
for _, osa := range streams {
|
||||
for _, oca := range osa.consumers {
|
||||
oca.deleted = true
|
||||
ca := &consumerAssignment{Group: oca.Group, Stream: oca.Stream, Name: oca.Name, Config: oca.Config, Subject: subject, Client: oca.Client, Created: oca.Created}
|
||||
meta.Propose(encodeDeleteConsumerAssignment(ca))
|
||||
cc.trackInflightConsumerProposal(accName, osa.Config.Name, ca, true)
|
||||
nc++
|
||||
}
|
||||
sa := &streamAssignment{Group: osa.Group, Config: osa.Config, Subject: subject, Client: osa.Client, Created: osa.Created}
|
||||
meta.Propose(encodeDeleteStreamAssignment(sa))
|
||||
cc.trackInflightStreamProposal(accName, sa, true)
|
||||
ns++
|
||||
}
|
||||
js.mu.Unlock()
|
||||
js.mu.RUnlock()
|
||||
|
||||
hasAccount := ns > 0
|
||||
s.Noticef("Purge request for account %s (streams: %d, consumer: %d, hasAccount: %t)", accName, ns, nc, hasAccount)
|
||||
|
||||
resp.Initiated = true
|
||||
@@ -3845,10 +3830,9 @@ func (s *Server) jsConsumerUnpinRequest(sub *subscription, c *client, _ *Account
|
||||
}
|
||||
|
||||
o.mu.Lock()
|
||||
o.unassignPinId()
|
||||
o.currentPinId = _EMPTY_
|
||||
o.sendUnpinnedAdvisoryLocked(req.Group, "admin")
|
||||
o.mu.Unlock()
|
||||
o.signalNewMessages()
|
||||
s.sendAPIResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(resp))
|
||||
}
|
||||
|
||||
@@ -4042,16 +4026,6 @@ func (s *Server) jsStreamRestoreRequest(sub *subscription, c *client, _ *Account
|
||||
if stream != req.Config.Name && req.Config.Name == _EMPTY_ {
|
||||
req.Config.Name = stream
|
||||
}
|
||||
if stream != req.Config.Name {
|
||||
resp.Error = NewJSStreamMismatchError()
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
|
||||
if s.JetStreamIsClustered() {
|
||||
s.jsClusteredStreamRestoreRequest(ci, acc, &req, subject, reply, rmsg)
|
||||
return
|
||||
}
|
||||
|
||||
// check stream config at the start of the restore process, not at the end
|
||||
cfg, apiErr := s.checkStreamCfg(&req.Config, acc, false)
|
||||
@@ -4061,6 +4035,11 @@ func (s *Server) jsStreamRestoreRequest(sub *subscription, c *client, _ *Account
|
||||
return
|
||||
}
|
||||
|
||||
if s.JetStreamIsClustered() {
|
||||
s.jsClusteredStreamRestoreRequest(ci, acc, &req, subject, reply, rmsg)
|
||||
return
|
||||
}
|
||||
|
||||
if err := acc.jsNonClusteredStreamLimitsCheck(&cfg); err != nil {
|
||||
resp.Error = err
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
@@ -4081,12 +4060,30 @@ func (s *Server) jsStreamRestoreRequest(sub *subscription, c *client, _ *Account
|
||||
return
|
||||
}
|
||||
|
||||
s.processStreamRestore(ci, acc, &cfg, subject, reply, string(msg))
|
||||
s.processStreamRestore(ci, acc, &req.Config, subject, reply, string(msg))
|
||||
}
|
||||
|
||||
func (s *Server) processStreamRestore(ci *ClientInfo, acc *Account, cfg *StreamConfig, subject, reply, msg string) <-chan error {
|
||||
js := s.getJetStream()
|
||||
|
||||
var resp = JSApiStreamRestoreResponse{ApiResponse: ApiResponse{Type: JSApiStreamRestoreResponseType}}
|
||||
|
||||
snapDir := filepath.Join(js.config.StoreDir, snapStagingDir)
|
||||
if _, err := os.Stat(snapDir); os.IsNotExist(err) {
|
||||
if err := os.MkdirAll(snapDir, defaultDirPerms); err != nil {
|
||||
resp.Error = &ApiError{Code: 503, Description: "JetStream unable to create temp storage for restore"}
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
tfile, err := os.CreateTemp(snapDir, "js-restore-")
|
||||
if err != nil {
|
||||
resp.Error = NewJSTempStorageFailedError()
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, msg, s.jsonResponse(&resp))
|
||||
return nil
|
||||
}
|
||||
|
||||
streamName := cfg.Name
|
||||
s.Noticef("Starting restore for stream '%s > %s'", acc.Name, streamName)
|
||||
|
||||
@@ -4112,59 +4109,29 @@ func (s *Server) processStreamRestore(ci *ClientInfo, acc *Account, cfg *StreamC
|
||||
}
|
||||
|
||||
// For signaling to upper layers.
|
||||
var resultOnce sync.Once
|
||||
var closeOnce sync.Once
|
||||
resultCh := make(chan result, 1)
|
||||
pr, pw := io.Pipe()
|
||||
activeQ := newIPQueue[int](s, fmt.Sprintf("[ACC:%s] stream '%s' restore", acc.Name, streamName)) // of int
|
||||
|
||||
setResult := func(err error, reply string) {
|
||||
resultOnce.Do(func() {
|
||||
resultCh <- result{err, reply}
|
||||
})
|
||||
}
|
||||
activeQ := newIPQueue[int](s, fmt.Sprintf("[ACC:%s] stream '%s' restore", acc.Name, streamName))
|
||||
restoreCh := make(chan struct {
|
||||
mset *stream
|
||||
err error
|
||||
}, 1)
|
||||
closeWithError := func(err error) {
|
||||
closeOnce.Do(func() {
|
||||
if err != nil {
|
||||
pw.CloseWithError(err)
|
||||
} else {
|
||||
pw.Close()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
s.startGoRoutine(func() {
|
||||
defer s.grWG.Done()
|
||||
mset, err := acc.RestoreStream(cfg, pr)
|
||||
if err != nil {
|
||||
pr.CloseWithError(err)
|
||||
} else {
|
||||
pr.Close()
|
||||
}
|
||||
restoreCh <- struct {
|
||||
mset *stream
|
||||
err error
|
||||
}{
|
||||
mset: mset,
|
||||
err: err,
|
||||
}
|
||||
})
|
||||
var total int
|
||||
|
||||
// FIXME(dlc) - Probably take out of network path eventually due to disk I/O?
|
||||
processChunk := func(sub *subscription, c *client, _ *Account, subject, reply string, msg []byte) {
|
||||
// We require reply subjects to communicate back failures, flow etc. If they do not have one log and cancel.
|
||||
if reply == _EMPTY_ {
|
||||
sub.client.processUnsub(sub.sid)
|
||||
setResult(fmt.Errorf("restore for stream '%s > %s' requires reply subject for each chunk", acc.Name, streamName), reply)
|
||||
resultCh <- result{
|
||||
fmt.Errorf("restore for stream '%s > %s' requires reply subject for each chunk", acc.Name, streamName),
|
||||
reply,
|
||||
}
|
||||
return
|
||||
}
|
||||
// Account client messages have \r\n on end. This is an error.
|
||||
if len(msg) < LEN_CR_LF {
|
||||
sub.client.processUnsub(sub.sid)
|
||||
setResult(fmt.Errorf("restore for stream '%s > %s' received short chunk", acc.Name, streamName), reply)
|
||||
resultCh <- result{
|
||||
fmt.Errorf("restore for stream '%s > %s' received short chunk", acc.Name, streamName),
|
||||
reply,
|
||||
}
|
||||
return
|
||||
}
|
||||
// Adjust.
|
||||
@@ -4172,32 +4139,26 @@ func (s *Server) processStreamRestore(ci *ClientInfo, acc *Account, cfg *StreamC
|
||||
|
||||
// This means we are complete with our transfer from the client.
|
||||
if len(msg) == 0 {
|
||||
s.Debugf("Finished streaming restore for stream '%s > %s'", acc.Name, streamName)
|
||||
closeWithError(nil)
|
||||
setResult(nil, reply)
|
||||
s.Debugf("Finished staging restore for stream '%s > %s'", acc.Name, streamName)
|
||||
resultCh <- result{err, reply}
|
||||
return
|
||||
}
|
||||
|
||||
// Signal activity before and after the blocking write.
|
||||
// The pre-write signal refreshes the stall watchdog when the
|
||||
// chunk arrives; the post-write signal refreshes it again once
|
||||
// RestoreStream has consumed the data. This keeps the idle
|
||||
// window between chunks anchored to the end of the previous
|
||||
// write instead of its start.
|
||||
activeQ.push(0)
|
||||
// We track total and check on server limits.
|
||||
// TODO(dlc) - We could check apriori and cancel initial request if we know it won't fit.
|
||||
total += len(msg)
|
||||
if js.wouldExceedLimits(FileStorage, total) {
|
||||
s.resourcesExceededError(FileStorage)
|
||||
resultCh <- result{NewJSInsufficientResourcesError(), reply}
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := pw.Write(msg); err != nil {
|
||||
closeWithError(err)
|
||||
sub.client.processUnsub(sub.sid)
|
||||
var resp = JSApiStreamCreateResponse{ApiResponse: ApiResponse{Type: JSApiStreamCreateResponseType}}
|
||||
if IsNatsErr(err, JSStorageResourcesExceededErr, JSMemoryResourcesExceededErr) {
|
||||
s.resourcesExceededError(cfg.Storage)
|
||||
// Append chunk to temp file. Mark as issue if we encounter an error.
|
||||
if n, err := tfile.Write(msg); n != len(msg) || err != nil {
|
||||
resultCh <- result{err, reply}
|
||||
if reply != _EMPTY_ {
|
||||
s.sendInternalAccountMsg(acc, reply, "-ERR 'storage failure during restore'")
|
||||
}
|
||||
resp.Error = NewJSStreamRestoreError(err, Unless(err))
|
||||
if s.sendInternalAccountMsg(acc, reply, s.jsonResponse(&resp)) == nil {
|
||||
reply = _EMPTY_
|
||||
}
|
||||
setResult(err, reply)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -4208,7 +4169,8 @@ func (s *Server) processStreamRestore(ci *ClientInfo, acc *Account, cfg *StreamC
|
||||
|
||||
sub, err := acc.subscribeInternal(restoreSubj, processChunk)
|
||||
if err != nil {
|
||||
closeWithError(err)
|
||||
tfile.Close()
|
||||
os.Remove(tfile.Name())
|
||||
resp.Error = NewJSRestoreSubscribeFailedError(err, restoreSubj)
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, msg, s.jsonResponse(&resp))
|
||||
return nil
|
||||
@@ -4218,14 +4180,14 @@ func (s *Server) processStreamRestore(ci *ClientInfo, acc *Account, cfg *StreamC
|
||||
resp.DeliverSubject = restoreSubj
|
||||
s.sendAPIResponse(ci, acc, subject, reply, msg, s.jsonResponse(resp))
|
||||
|
||||
// Returned to the caller to wait for completion.
|
||||
doneCh := make(chan error, 1)
|
||||
|
||||
// Monitor the progress from another Go routine.
|
||||
s.startGoRoutine(func() {
|
||||
defer s.grWG.Done()
|
||||
defer func() {
|
||||
closeWithError(ErrConnectionClosed)
|
||||
tfile.Close()
|
||||
os.Remove(tfile.Name())
|
||||
sub.client.processUnsub(sub.sid)
|
||||
activeQ.unregister()
|
||||
}()
|
||||
@@ -4235,97 +4197,71 @@ func (s *Server) processStreamRestore(ci *ClientInfo, acc *Account, cfg *StreamC
|
||||
defer notActive.Stop()
|
||||
|
||||
total := 0
|
||||
var inputDone bool
|
||||
var replySubj string
|
||||
var inputErr error
|
||||
var restoreDone bool
|
||||
var restoreResult struct {
|
||||
mset *stream
|
||||
err error
|
||||
}
|
||||
|
||||
finish := func(reply string, err error, mset *stream) {
|
||||
end := time.Now().UTC()
|
||||
|
||||
s.publishAdvisory(acc, JSAdvisoryStreamRestoreCompletePre+"."+streamName, &JSRestoreCompleteAdvisory{
|
||||
TypedEvent: TypedEvent{
|
||||
Type: JSRestoreCompleteAdvisoryType,
|
||||
ID: nuid.Next(),
|
||||
Time: end,
|
||||
},
|
||||
Stream: streamName,
|
||||
Start: start,
|
||||
End: end,
|
||||
Bytes: int64(total),
|
||||
Client: ci.forAdvisory(),
|
||||
Domain: domain,
|
||||
})
|
||||
|
||||
var resp = JSApiStreamCreateResponse{ApiResponse: ApiResponse{Type: JSApiStreamCreateResponseType}}
|
||||
if err != nil {
|
||||
if IsNatsErr(err, JSStorageResourcesExceededErr, JSMemoryResourcesExceededErr) {
|
||||
s.resourcesExceededError(cfg.Storage)
|
||||
}
|
||||
resp.Error = NewJSStreamRestoreError(err, Unless(err))
|
||||
s.Warnf("Restore failed for %s for stream '%s > %s' in %v",
|
||||
friendlyBytes(int64(total)), acc.Name, streamName, end.Sub(start))
|
||||
} else {
|
||||
msetCfg := mset.config()
|
||||
resp.StreamInfo = &StreamInfo{
|
||||
Created: mset.createdTime(),
|
||||
State: mset.state(),
|
||||
Config: *setDynamicStreamMetadata(&msetCfg),
|
||||
TimeStamp: time.Now().UTC(),
|
||||
}
|
||||
s.Noticef("Completed restore of %s for stream '%s > %s' in %v",
|
||||
friendlyBytes(int64(total)), acc.Name, streamName, end.Sub(start).Round(time.Millisecond))
|
||||
}
|
||||
if reply != _EMPTY_ {
|
||||
s.sendInternalAccountMsg(acc, reply, s.jsonResponse(&resp))
|
||||
}
|
||||
doneCh <- err
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case result := <-resultCh:
|
||||
replySubj = result.reply
|
||||
inputDone = true
|
||||
inputErr = result.err
|
||||
notActive.Stop()
|
||||
if result.err != nil {
|
||||
closeWithError(result.err)
|
||||
s.Warnf(result.err.Error())
|
||||
err := result.err
|
||||
var mset *stream
|
||||
|
||||
// If we staged properly go ahead and do restore now.
|
||||
if err == nil {
|
||||
s.Debugf("Finalizing restore for stream '%s > %s'", acc.Name, streamName)
|
||||
tfile.Seek(0, 0)
|
||||
mset, err = acc.RestoreStream(cfg, tfile)
|
||||
} else {
|
||||
errStr := err.Error()
|
||||
tmp := []rune(errStr)
|
||||
tmp[0] = unicode.ToUpper(tmp[0])
|
||||
s.Warnf(errStr)
|
||||
}
|
||||
if restoreDone {
|
||||
err := inputErr
|
||||
if err == nil {
|
||||
err = restoreResult.err
|
||||
|
||||
end := time.Now().UTC()
|
||||
|
||||
// TODO(rip) - Should this have the error code in it??
|
||||
s.publishAdvisory(acc, JSAdvisoryStreamRestoreCompletePre+"."+streamName, &JSRestoreCompleteAdvisory{
|
||||
TypedEvent: TypedEvent{
|
||||
Type: JSRestoreCompleteAdvisoryType,
|
||||
ID: nuid.Next(),
|
||||
Time: end,
|
||||
},
|
||||
Stream: streamName,
|
||||
Start: start,
|
||||
End: end,
|
||||
Bytes: int64(total),
|
||||
Client: ci.forAdvisory(),
|
||||
Domain: domain,
|
||||
})
|
||||
|
||||
var resp = JSApiStreamCreateResponse{ApiResponse: ApiResponse{Type: JSApiStreamCreateResponseType}}
|
||||
|
||||
if err != nil {
|
||||
resp.Error = NewJSStreamRestoreError(err, Unless(err))
|
||||
s.Warnf("Restore failed for %s for stream '%s > %s' in %v",
|
||||
friendlyBytes(int64(total)), acc.Name, streamName, end.Sub(start))
|
||||
} else {
|
||||
msetCfg := mset.config()
|
||||
resp.StreamInfo = &StreamInfo{
|
||||
Created: mset.createdTime(),
|
||||
State: mset.state(),
|
||||
Config: *setDynamicStreamMetadata(&msetCfg),
|
||||
TimeStamp: time.Now().UTC(),
|
||||
}
|
||||
finish(replySubj, err, restoreResult.mset)
|
||||
return
|
||||
}
|
||||
case rr := <-restoreCh:
|
||||
restoreDone = true
|
||||
restoreResult = rr
|
||||
if inputDone {
|
||||
err := inputErr
|
||||
if err == nil {
|
||||
err = rr.err
|
||||
}
|
||||
finish(replySubj, err, rr.mset)
|
||||
return
|
||||
s.Noticef("Completed restore of %s for stream '%s > %s' in %v",
|
||||
friendlyBytes(int64(total)), acc.Name, streamName, end.Sub(start).Round(time.Millisecond))
|
||||
}
|
||||
|
||||
// On the last EOF, send back the stream info or error status.
|
||||
s.sendInternalAccountMsg(acc, result.reply, s.jsonResponse(&resp))
|
||||
// Signal to the upper layers.
|
||||
doneCh <- err
|
||||
return
|
||||
case <-activeQ.ch:
|
||||
if n, ok := activeQ.popOne(); ok {
|
||||
total += n
|
||||
if !inputDone {
|
||||
notActive.Reset(activityInterval)
|
||||
}
|
||||
notActive.Reset(activityInterval)
|
||||
}
|
||||
case <-notActive.C:
|
||||
err := fmt.Errorf("restore for stream '%s > %s' is stalled", acc.Name, streamName)
|
||||
closeWithError(err)
|
||||
err := fmt.Errorf("restore for stream '%s > %s' is stalled", acc, streamName)
|
||||
doneCh <- err
|
||||
return
|
||||
}
|
||||
@@ -4462,36 +4398,20 @@ func (s *Server) jsStreamSnapshotRequest(sub *subscription, c *client, _ *Accoun
|
||||
}
|
||||
|
||||
// Default chunk size for now.
|
||||
const defaultSnapshotChunkSize = 128 * 1024 // 128KiB
|
||||
const defaultSnapshotWindowSize = 8 * 1024 * 1024 // 8MiB
|
||||
const defaultSnapshotAckTimeout = 5 * time.Second
|
||||
|
||||
var snapshotAckTimeout = defaultSnapshotAckTimeout
|
||||
const defaultSnapshotChunkSize = 128 * 1024
|
||||
const defaultSnapshotWindowSize = 8 * 1024 * 1024 // 8MB
|
||||
|
||||
// streamSnapshot will stream out our snapshot to the reply subject.
|
||||
func (s *Server) streamSnapshot(acc *Account, mset *stream, sr *SnapshotResult, req *JSApiStreamSnapshotRequest) {
|
||||
chunkSize, wndSize := req.ChunkSize, req.WindowSize
|
||||
chunkSize := req.ChunkSize
|
||||
if chunkSize == 0 {
|
||||
chunkSize = defaultSnapshotChunkSize
|
||||
}
|
||||
if wndSize == 0 {
|
||||
wndSize = defaultSnapshotWindowSize
|
||||
}
|
||||
chunkSize = min(max(1024, chunkSize), 1024*1024) // Clamp within 1KiB to 1MiB
|
||||
wndSize = min(max(1024, wndSize), 32*1024*1024) // Clamp within 1KiB to 32MiB
|
||||
wndSize = max(wndSize, chunkSize) // Guarantee at least one chunk
|
||||
maxInflight := wndSize / chunkSize // Between 1 and 32,768
|
||||
|
||||
// Setup for the chunk stream.
|
||||
reply := req.DeliverSubject
|
||||
r := sr.Reader
|
||||
defer r.Close()
|
||||
|
||||
// In case we run into an error, this allows subscription callbacks
|
||||
// to not sit and block endlessly.
|
||||
done := make(chan struct{})
|
||||
defer close(done)
|
||||
|
||||
// Check interest for the snapshot deliver subject.
|
||||
inch := make(chan bool, 1)
|
||||
acc.sl.RegisterNotification(req.DeliverSubject, inch)
|
||||
@@ -4505,59 +4425,78 @@ func (s *Server) streamSnapshot(acc *Account, mset *stream, sr *SnapshotResult,
|
||||
}
|
||||
}
|
||||
|
||||
// One slot per chunk. Each chunk read takes a slot, each ack will
|
||||
// replace it. Smooths out in-flight number of chunks.
|
||||
slots := make(chan struct{}, maxInflight)
|
||||
for range maxInflight {
|
||||
slots <- struct{}{}
|
||||
// Create our ack flow handler.
|
||||
// This is very simple for now.
|
||||
ackSize := defaultSnapshotWindowSize / chunkSize
|
||||
if ackSize < 8 {
|
||||
ackSize = 8
|
||||
} else if ackSize > 8*1024 {
|
||||
ackSize = 8 * 1024
|
||||
}
|
||||
acks := make(chan struct{}, ackSize)
|
||||
acks <- struct{}{}
|
||||
|
||||
// Track bytes outstanding.
|
||||
var out int32
|
||||
|
||||
// We will place sequence number and size of chunk sent in the reply.
|
||||
ackSubj := fmt.Sprintf(jsSnapshotAckT, mset.name(), nuid.Next())
|
||||
ackSub, _ := mset.subscribeInternal(ackSubj+".>", func(_ *subscription, _ *client, _ *Account, subject, _ string, _ []byte) {
|
||||
select {
|
||||
case slots <- struct{}{}:
|
||||
case <-done:
|
||||
cs, _ := strconv.Atoi(tokenAt(subject, 6))
|
||||
// This is very crude and simple, but ok for now.
|
||||
// This only matters when sending multiple chunks.
|
||||
if atomic.AddInt32(&out, int32(-cs)) < defaultSnapshotWindowSize {
|
||||
select {
|
||||
case acks <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
})
|
||||
defer mset.unsubscribe(ackSub)
|
||||
|
||||
// TODO(dlc) - Add in NATS-Chunked-Sequence header
|
||||
var hdr []byte
|
||||
chunk := make([]byte, chunkSize)
|
||||
for index := 1; ; index++ {
|
||||
select {
|
||||
case <-slots:
|
||||
// A slot has become available.
|
||||
case <-inch:
|
||||
// The receiver appears to have gone away.
|
||||
hdr = []byte("NATS/1.0 408 No Interest\r\n\r\n")
|
||||
goto done
|
||||
case err := <-sr.errCh:
|
||||
// The snapshotting goroutine has failed for some reason.
|
||||
hdr = []byte(fmt.Sprintf("NATS/1.0 500 %s\r\n\r\n", err))
|
||||
goto done
|
||||
case <-time.After(snapshotAckTimeout):
|
||||
// It's taking a very long time for the receiver to send us acks,
|
||||
// they have probably stalled or there is high loss on the link.
|
||||
hdr = []byte("NATS/1.0 408 No Flow Response\r\n\r\n")
|
||||
goto done
|
||||
}
|
||||
n, err := io.ReadFull(r, chunk)
|
||||
chunk := chunk[:n]
|
||||
chunk := make([]byte, chunkSize)
|
||||
n, err := r.Read(chunk)
|
||||
chunk = chunk[:n]
|
||||
if err != nil {
|
||||
if n > 0 {
|
||||
mset.outq.send(newJSPubMsg(reply, _EMPTY_, _EMPTY_, nil, chunk, nil, 0))
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
// Wait on acks for flow control if past our window size.
|
||||
// Wait up to 10ms for now if no acks received.
|
||||
if atomic.LoadInt32(&out) > defaultSnapshotWindowSize {
|
||||
select {
|
||||
case <-acks:
|
||||
// ok to proceed.
|
||||
case <-inch:
|
||||
// Lost interest
|
||||
hdr = []byte("NATS/1.0 408 No Interest\r\n\r\n")
|
||||
goto done
|
||||
case <-time.After(2 * time.Second):
|
||||
hdr = []byte("NATS/1.0 408 No Flow Response\r\n\r\n")
|
||||
goto done
|
||||
}
|
||||
}
|
||||
ackReply := fmt.Sprintf("%s.%d.%d", ackSubj, len(chunk), index)
|
||||
if hdr == nil {
|
||||
hdr = []byte("NATS/1.0 204\r\n\r\n")
|
||||
}
|
||||
mset.outq.send(newJSPubMsg(reply, _EMPTY_, ackReply, nil, chunk, nil, 0))
|
||||
atomic.AddInt32(&out, int32(len(chunk)))
|
||||
}
|
||||
|
||||
if err := <-sr.errCh; err != _EMPTY_ {
|
||||
hdr = []byte(fmt.Sprintf("NATS/1.0 500 %s\r\n\r\n", err))
|
||||
}
|
||||
|
||||
done:
|
||||
// Send last EOF
|
||||
// TODO(dlc) - place hash in header
|
||||
mset.outq.send(newJSPubMsg(reply, _EMPTY_, _EMPTY_, hdr, nil, nil, 0))
|
||||
}
|
||||
|
||||
@@ -4700,8 +4639,6 @@ func (s *Server) jsConsumerCreateRequest(sub *subscription, c *client, a *Accoun
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
// Durable, so we need to honor the name.
|
||||
req.Config.Name = consumerName
|
||||
}
|
||||
// If new style and durable set make sure they match.
|
||||
if rt == ccNew {
|
||||
@@ -4853,7 +4790,7 @@ func (s *Server) jsConsumerNamesRequest(sub *subscription, c *client, _ *Account
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
offset = max(req.Offset, 0)
|
||||
offset = req.Offset
|
||||
}
|
||||
|
||||
streamName := streamNameFromSubject(subject)
|
||||
@@ -4981,7 +4918,7 @@ func (s *Server) jsConsumerListRequest(sub *subscription, c *client, _ *Account,
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
offset = max(req.Offset, 0)
|
||||
offset = req.Offset
|
||||
}
|
||||
|
||||
streamName := streamNameFromSubject(subject)
|
||||
|
||||
+445
-1036
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -17,7 +17,7 @@ import "strconv"
|
||||
|
||||
const (
|
||||
// JSApiLevel is the maximum supported JetStream API level for this server.
|
||||
JSApiLevel int = 3
|
||||
JSApiLevel int = 2
|
||||
|
||||
JSRequiredLevelMetadataKey = "_nats.req.level"
|
||||
JSServerVersionMetadataKey = "_nats.ver"
|
||||
|
||||
+22
-37
@@ -63,9 +63,9 @@ const (
|
||||
// LEAF connection as opposed to a CLIENT.
|
||||
leafNodeWSPath = "/leafnode"
|
||||
|
||||
// When a soliciting leafnode is rejected because it does not meet the
|
||||
// configured minimum version, delay the next reconnect attempt by this long.
|
||||
leafNodeMinVersionReconnectDelay = 5 * time.Second
|
||||
// This is the time the server will wait, when receiving a CONNECT,
|
||||
// before closing the connection if the required minimum version is not met.
|
||||
leafNodeWaitBeforeClose = 5 * time.Second
|
||||
)
|
||||
|
||||
type leaf struct {
|
||||
@@ -691,8 +691,9 @@ func (s *Server) connectToRemoteLeafNode(remote *leafNodeCfg, firstConnect bool)
|
||||
} else {
|
||||
s.Debugf("Trying to connect as leafnode to remote server on %q%s", rURL.Host, ipStr)
|
||||
|
||||
// Check if proxy is configured
|
||||
if proxyURL != _EMPTY_ {
|
||||
// Check if proxy is configured first, then check if URL supports it
|
||||
if proxyURL != _EMPTY_ && isWSURL(rURL) {
|
||||
// Use proxy for WebSocket connections - use original hostname, resolved IP for connection
|
||||
targetHost := rURL.Host
|
||||
// If URL doesn't include port, add the default port for the scheme
|
||||
if rURL.Port() == _EMPTY_ {
|
||||
@@ -2081,11 +2082,17 @@ func (c *client) processLeafNodeConnect(s *Server, arg []byte, lang string) erro
|
||||
if mv := s.getOpts().LeafNode.MinVersion; mv != _EMPTY_ {
|
||||
major, minor, update, _ := versionComponents(mv)
|
||||
if !versionAtLeast(proto.Version, major, minor, update) {
|
||||
// Send back an INFO so recent remote servers process the rejection
|
||||
// cleanly, then close immediately. The soliciting side applies the
|
||||
// reconnect delay when it processes the error.
|
||||
// We are going to send back an INFO because otherwise recent
|
||||
// versions of the remote server would simply break the connection
|
||||
// after 2 seconds if not receiving it. Instead, we want the
|
||||
// other side to just "stall" until we finish waiting for the holding
|
||||
// period and close the connection below.
|
||||
s.sendPermsAndAccountInfo(c)
|
||||
c.sendErrAndErr(fmt.Sprintf("%s %q", ErrLeafNodeMinVersionRejected, mv))
|
||||
c.sendErrAndErr(fmt.Sprintf("connection rejected since minimum version required is %q", mv))
|
||||
select {
|
||||
case <-c.srv.quitCh:
|
||||
case <-time.After(leafNodeWaitBeforeClose):
|
||||
}
|
||||
c.closeConnection(MinimumVersionRequired)
|
||||
return ErrMinimumVersionRequired
|
||||
}
|
||||
@@ -2753,14 +2760,6 @@ func (c *client) processLeafSub(argo []byte) (err error) {
|
||||
}
|
||||
|
||||
acc := c.acc
|
||||
// Guard against LS+ arriving before CONNECT has been processed, which
|
||||
// can happen when compression is enabled.
|
||||
if acc == nil {
|
||||
c.mu.Unlock()
|
||||
c.sendErr("Authorization Violation")
|
||||
c.closeConnection(ProtocolViolation)
|
||||
return nil
|
||||
}
|
||||
// Check if we have a loop.
|
||||
ldsPrefix := bytes.HasPrefix(sub.subject, []byte(leafNodeLoopDetectionSubjectPrefix))
|
||||
|
||||
@@ -2877,6 +2876,7 @@ func (c *client) processLeafUnsub(arg []byte) error {
|
||||
// Indicate any activity, so pub and sub or unsubs.
|
||||
c.in.subs++
|
||||
|
||||
acc := c.acc
|
||||
srv := c.srv
|
||||
|
||||
c.mu.Lock()
|
||||
@@ -2885,15 +2885,6 @@ func (c *client) processLeafUnsub(arg []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
acc := c.acc
|
||||
// Guard against LS- arriving before CONNECT has been processed.
|
||||
if acc == nil {
|
||||
c.mu.Unlock()
|
||||
c.sendErr("Authorization Violation")
|
||||
c.closeConnection(ProtocolViolation)
|
||||
return nil
|
||||
}
|
||||
|
||||
spoke := c.isSpokeLeafNode()
|
||||
// We store local subs by account and subject and optionally queue name.
|
||||
// LS- will have the arg exactly as the key.
|
||||
@@ -2925,7 +2916,8 @@ func (c *client) processLeafUnsub(arg []byte) error {
|
||||
|
||||
func (c *client) processLeafHeaderMsgArgs(arg []byte) error {
|
||||
// Unroll splitArgs to avoid runtime/heap issues
|
||||
args := c.argsa[:0]
|
||||
a := [MAX_MSG_ARGS][]byte{}
|
||||
args := a[:0]
|
||||
start := -1
|
||||
for i, b := range arg {
|
||||
switch b {
|
||||
@@ -3008,7 +3000,8 @@ func (c *client) processLeafHeaderMsgArgs(arg []byte) error {
|
||||
|
||||
func (c *client) processLeafMsgArgs(arg []byte) error {
|
||||
// Unroll splitArgs to avoid runtime/heap issues
|
||||
args := c.argsa[:0]
|
||||
a := [MAX_MSG_ARGS][]byte{}
|
||||
args := a[:0]
|
||||
start := -1
|
||||
for i, b := range arg {
|
||||
switch b {
|
||||
@@ -3188,11 +3181,6 @@ func (c *client) leafProcessErr(errStr string) {
|
||||
c.Errorf("Leafnode connection dropped with same cluster name error. Delaying attempt to reconnect for %v", delay)
|
||||
return
|
||||
}
|
||||
if strings.Contains(errStr, ErrLeafNodeMinVersionRejected.Error()) {
|
||||
_, delay := c.setLeafConnectDelayIfSoliciting(leafNodeMinVersionReconnectDelay)
|
||||
c.Errorf("Leafnode connection dropped due to minimum version requirement. Delaying attempt to reconnect for %v", delay)
|
||||
return
|
||||
}
|
||||
|
||||
// We will look for Loop detected error coming from the other side.
|
||||
// If we solicit, set the connect delay.
|
||||
@@ -3215,10 +3203,7 @@ func (c *client) setLeafConnectDelayIfSoliciting(delay time.Duration) (string, t
|
||||
}
|
||||
c.leaf.remote.setConnectDelay(delay)
|
||||
}
|
||||
var accName string
|
||||
if c.acc != nil {
|
||||
accName = c.acc.Name
|
||||
}
|
||||
accName := c.acc.Name
|
||||
c.mu.Unlock()
|
||||
return accName, delay
|
||||
}
|
||||
|
||||
Loaded 100 of 199 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user