Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6a838708c | ||
|
|
fb72f45e10 | ||
|
|
3893ce2e5c | ||
|
|
147b19d4ff | ||
|
|
9f91522d76 | ||
|
|
bbb3ed25d7 | ||
|
|
81844d6b26 | ||
|
|
75d9af7d92 |
No files matched your search
@@ -12,7 +12,7 @@ jobs:
|
||||
outputs:
|
||||
docs-only: ${{ steps.check.outputs.docs-only }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -56,13 +56,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
@@ -141,9 +141,7 @@ jobs:
|
||||
make ci-golangci-lint > /tmp/golangci-lint.log 2>&1 & PIDS=($!)
|
||||
( ENABLE_VIPS=true make -C ocis build-debug \
|
||||
&& mv ocis/bin/ocis-debug ocis/bin/ocis ) > /tmp/ocis-build.log 2>&1 & PIDS+=($!)
|
||||
make test > /tmp/unit-tests.log 2>&1 & PIDS+=($!)
|
||||
# vips-tagged files live only under thumbnails; scoped run, no coverprofile.
|
||||
go test -v -tags 'enable_vips' ./services/thumbnails/... > /tmp/unit-tests-vips.log 2>&1 & PIDS+=($!)
|
||||
make test > /tmp/unit-tests.log 2>&1 & PIDS+=($!)
|
||||
GOWORK=off make -C tests/ociswrapper build > /tmp/ociswrapper-build.log 2>&1 & PIDS+=($!)
|
||||
|
||||
FAILED=0
|
||||
@@ -160,7 +158,6 @@ jobs:
|
||||
echo "=== ocis build ===" && cat /tmp/ocis-build.log
|
||||
echo "=== ociswrapper build ===" && cat /tmp/ociswrapper-build.log
|
||||
echo "=== unit tests ===" && cat /tmp/unit-tests.log
|
||||
echo "=== vips unit tests ===" && cat /tmp/unit-tests-vips.log
|
||||
|
||||
exit $FAILED
|
||||
|
||||
@@ -229,7 +226,7 @@ jobs:
|
||||
- apiCollaboration
|
||||
- apiVault
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
|
||||
with:
|
||||
@@ -313,7 +310,7 @@ jobs:
|
||||
suite:
|
||||
- cliCommands,apiServiceAvailability # grouped: both need ClamAV + email services
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
|
||||
with:
|
||||
@@ -361,7 +358,7 @@ jobs:
|
||||
suite:
|
||||
- apiGraphUser,apiGraph,apiGraphGroup
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
|
||||
with:
|
||||
@@ -417,7 +414,7 @@ jobs:
|
||||
- "coreApiWebdavProperties"
|
||||
- "coreApiWebdavMove1,coreApiWebdavPreviews,coreApiWebdavUpload,coreApiWebdavUploadTUS"
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
|
||||
with:
|
||||
@@ -533,8 +530,8 @@ jobs:
|
||||
args: "--type playwright --suites vault-storage"
|
||||
vault_storage: true
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
# 24.16.0 breaks playwright install (yauzl zip extraction hangs); pin to last known good.
|
||||
# https://github.com/microsoft/playwright/issues/40724
|
||||
@@ -703,7 +700,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Install libvips runtime
|
||||
run: |
|
||||
@@ -728,7 +725,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Install libvips runtime
|
||||
run: |
|
||||
@@ -753,7 +750,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Install libvips runtime
|
||||
run: |
|
||||
@@ -778,7 +775,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Install libvips runtime
|
||||
run: |
|
||||
@@ -803,13 +800,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
- 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@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
@@ -836,13 +833,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
- 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@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
@@ -869,8 +866,8 @@ jobs:
|
||||
env:
|
||||
GOCOVERDIR: ${{ github.workspace }}/coverage-reports
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
- name: Install REUSE tool
|
||||
run: pip install reuse
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout ocis repo
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
repository: owncloud/ocis
|
||||
|
||||
|
||||
+17
-253
@@ -10,10 +10,7 @@ env:
|
||||
PHP_VERSION: "8.4"
|
||||
K3D_VERSION: "v5.8.3"
|
||||
HELM_VERSION: "v3.18.4"
|
||||
TEST_SERVER_DOMAIN: ocis-server
|
||||
FED_SERVER_DOMAIN: federation-ocis-server
|
||||
TEST_SERVER_URL: https://ocis-server
|
||||
FED_SERVER_URL: https://federation-ocis-server
|
||||
STORAGE_DRIVER: ocis
|
||||
OCIS_WRAPPER_URL: http://localhost:5200
|
||||
K8S: true
|
||||
@@ -42,7 +39,7 @@ jobs:
|
||||
- suite: apiGraphUser
|
||||
- suite: apiGraph
|
||||
- suite: apiGraphGroup
|
||||
- suite: apiSpaces
|
||||
# - suite: apiSpaces
|
||||
- suite: apiSpacesShares
|
||||
- suite: apiSpacesDavOperation
|
||||
- suite: apiDownloads
|
||||
@@ -52,7 +49,7 @@ jobs:
|
||||
- suite: apiActivities
|
||||
- suite: apiSearch1
|
||||
- suite: apiSearch2
|
||||
- suite: apiSearchContent
|
||||
# - suite: apiSearchContent
|
||||
- suite: apiSharingNgShares
|
||||
- suite: apiReshare
|
||||
- suite: apiSharingNgPermissions
|
||||
@@ -65,7 +62,7 @@ jobs:
|
||||
- suite: apiAuthApp
|
||||
- suite: apiAntivirus
|
||||
- suite: apiOcm
|
||||
- suite: apiCollaboration
|
||||
# - suite: apiCollaboration
|
||||
- suite: apiVault
|
||||
- suite: "coreApiAuth,coreApiCapabilities,coreApiFavorites,coreApiMain,coreApiVersions"
|
||||
- suite: "coreApiShareManagementBasicToShares,coreApiShareManagementToShares"
|
||||
@@ -75,11 +72,12 @@ jobs:
|
||||
- suite: "coreApiTrashbin,coreApiTrashbinRestore,coreApiWebdavEtagPropagation1,coreApiWebdavEtagPropagation2"
|
||||
- suite: "coreApiWebdavDelete,coreApiWebdavOperations,coreApiWebdavMove2"
|
||||
- suite: "coreApiWebdavProperties"
|
||||
- suite: "coreApiWebdavMove1,coreApiWebdavUpload,coreApiWebdavUploadTUS,coreApiWebdavPreviews"
|
||||
# - suite: "coreApiWebdavPreviews"
|
||||
- suite: "coreApiWebdavMove1,coreApiWebdavUpload,coreApiWebdavUploadTUS"
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup PHP ${{ env.PHP_VERSION }}
|
||||
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
|
||||
@@ -107,7 +105,7 @@ jobs:
|
||||
|
||||
- name: Prepare hosts
|
||||
run: |
|
||||
echo "127.0.0.1 $TEST_SERVER_DOMAIN clamav email collabora onlyoffice fakeoffice tika $FED_SERVER_DOMAIN keycloak" \
|
||||
echo "127.0.0.1 ocis-server clamav email collabora onlyoffice fakeoffice tika federation-ocis-server keycloak" \
|
||||
| sudo tee -a /etc/hosts
|
||||
|
||||
- name: Spin up K3d Cluster
|
||||
@@ -183,11 +181,11 @@ jobs:
|
||||
|
||||
# patch the realm so the "web" client's redirect/origin URLs match
|
||||
# the k8s ingress domain instead of the non-k8s "localhost:9200" one
|
||||
sed "s|https://localhost:9200|${TEST_SERVER_URL}|g" \
|
||||
sed 's|https://localhost:9200|https://ocis-server|g' \
|
||||
tests/config/ci/ocis-mfa-ci-realm.dist.json > /tmp/ocis-realm.json
|
||||
|
||||
docker run -d --name keycloak --network host \
|
||||
-e OCIS_DOMAIN="$TEST_SERVER_URL" \
|
||||
-e OCIS_DOMAIN=https://ocis-server \
|
||||
-e KC_HOSTNAME=keycloak \
|
||||
-e KC_PORT=8443 \
|
||||
-e KC_DB=postgres \
|
||||
@@ -215,99 +213,34 @@ jobs:
|
||||
bash tests/config/k8s/expose-external-svc.sh keycloak:8443
|
||||
fi
|
||||
|
||||
if [[ "${{ matrix.suite }}" == "apiCollaboration" ]]; then
|
||||
# Start Collabora
|
||||
docker run -d \
|
||||
--name collabora \
|
||||
--network host \
|
||||
--entrypoint bash \
|
||||
-e DONT_GEN_SSL_CERT=set \
|
||||
-e "extra_params=--o:ssl.enable=true --o:ssl.termination=true --o:welcome.enable=false --o:net.frame_ancestors=https://127.0.0.1:9200" \
|
||||
collabora/code:25.04.7.3.1 \
|
||||
-c "coolconfig generate-proof-key && bash /start-collabora-online.sh"
|
||||
timeout 150 bash -c 'until curl -kfsSL https://localhost:9980/hosting/discovery > /dev/null; do sleep 5; done'
|
||||
echo "collabora ready."
|
||||
|
||||
# Start OnlyOffice
|
||||
docker run -d \
|
||||
--name onlyoffice \
|
||||
-p 7443:443 \
|
||||
-e WOPI_ENABLED=true \
|
||||
-e USE_UNAUTHORIZED_STORAGE=true \
|
||||
-v "$(pwd)/tests/config/ci/only-office.json:/tmp/local.json:ro" \
|
||||
--entrypoint /bin/sh \
|
||||
onlyoffice/documentserver:9.2.1 \
|
||||
-c "set -e
|
||||
cp /tmp/local.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"
|
||||
timeout 150 bash -c 'until curl -kfsSL https://localhost:7443/hosting/discovery > /dev/null; do sleep 5; done'
|
||||
echo "onlyoffice ready."
|
||||
|
||||
#Start FakeOffice
|
||||
docker run -d --name fakeoffice --network host \
|
||||
-v "$(pwd):/ocis:ro" \
|
||||
python:3-alpine \
|
||||
python3 -c "
|
||||
import http.server, pathlib
|
||||
body = pathlib.Path('/ocis/tests/config/ci/hosting-discovery.xml').read_bytes()
|
||||
class H(http.server.BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
self.send_response(200)
|
||||
self.send_header('Content-Type', 'text/xml')
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
def log_message(self, *a): pass
|
||||
http.server.HTTPServer(('', 8080), H).serve_forever()
|
||||
"
|
||||
timeout 60 bash -c 'until curl -fsSL http://localhost:8080/hosting/discovery > /dev/null; do sleep 5; done'
|
||||
echo "fakeoffice ready."
|
||||
|
||||
bash tests/config/k8s/expose-external-svc.sh collabora:9980
|
||||
bash tests/config/k8s/expose-external-svc.sh onlyoffice:7443
|
||||
bash tests/config/k8s/expose-external-svc.sh fakeoffice:8080
|
||||
fi
|
||||
|
||||
- name: Deploy oCIS
|
||||
run: |
|
||||
cd tests/config/k8s
|
||||
kubectl get pods -n "$TEST_SERVER_DOMAIN" -Aw &
|
||||
kubectl get pods -n ocis-server -Aw &
|
||||
make deploy-ocis
|
||||
if [[ "${{ matrix.suite }}" == "apiOcm" ]]; then
|
||||
OCM=true make deploy-ocis
|
||||
fi
|
||||
|
||||
- name: Expose node ports
|
||||
if: ${{ matrix.suite == 'apiCollaboration' }}
|
||||
run: |
|
||||
bash tests/config/k8s/expose-nodeports.sh collaboration-collabora 9300 30300
|
||||
bash tests/config/k8s/expose-nodeports.sh collaboration-fakeoffice 9300 30301
|
||||
bash tests/config/k8s/expose-nodeports.sh collaboration-onlyoffice 9300 30302
|
||||
bash tests/config/k8s/expose-nodeports.sh collaboration-fakeoffice 9304 30304
|
||||
|
||||
- name: Wait for oCIS to be ready
|
||||
env:
|
||||
FILE_URL: ${{ env.TEST_SERVER_URL }}/remote.php/dav/files/admin/hello1.txt
|
||||
run: |
|
||||
kubectl wait \
|
||||
--namespace "$TEST_SERVER_DOMAIN" \
|
||||
--namespace ocis-server \
|
||||
--for=condition=Available \
|
||||
deployment \
|
||||
--all \
|
||||
--timeout=10m
|
||||
|
||||
kubectl wait \
|
||||
--namespace "$TEST_SERVER_DOMAIN" \
|
||||
--namespace ocis-server \
|
||||
--for=condition=Ready \
|
||||
pod \
|
||||
--all \
|
||||
--timeout=10m
|
||||
|
||||
kubectl get pods -n "$TEST_SERVER_DOMAIN"
|
||||
kubectl get pods -n ocis-server
|
||||
|
||||
retry() {
|
||||
local label=$1
|
||||
@@ -331,7 +264,7 @@ jobs:
|
||||
# reached via port-forward since it isn't exposed by any Service.
|
||||
# local port 19205 (not 9205): 9100-9399 is already bound on the
|
||||
# host by the k3d loadbalancer's NodePort range, see create-cluster.
|
||||
kubectl -n "$TEST_SERVER_DOMAIN" port-forward deployment/proxy 19205:9205 &
|
||||
kubectl -n ocis-server port-forward deployment/proxy 19205:9205 &
|
||||
PORT_FORWARD_PID=$!
|
||||
trap 'kill $PORT_FORWARD_PID 2>/dev/null' EXIT
|
||||
|
||||
@@ -383,7 +316,7 @@ jobs:
|
||||
run: |
|
||||
(
|
||||
while true; do
|
||||
kubectl -n "$TEST_SERVER_DOMAIN" port-forward deployment/proxy 19205:9205 >> /tmp/proxy-readyz-portforward.log 2>&1
|
||||
kubectl -n ocis-server port-forward deployment/proxy 19205:9205 >> /tmp/proxy-readyz-portforward.log 2>&1
|
||||
sleep 1
|
||||
done
|
||||
) &
|
||||
@@ -398,7 +331,7 @@ jobs:
|
||||
--admin-username admin \
|
||||
--admin-password admin \
|
||||
--skip-ocis-run \
|
||||
-n "$TEST_SERVER_DOMAIN" &
|
||||
-n ocis-server &
|
||||
|
||||
- name: Prepare expected failures
|
||||
if: startsWith( matrix.suite, 'core' )
|
||||
@@ -415,7 +348,7 @@ jobs:
|
||||
if: startsWith( matrix.suite, 'api' )
|
||||
env:
|
||||
TEST_SERVER_URL: ${{ env.TEST_SERVER_URL }}
|
||||
TEST_SERVER_FED_URL: ${{ env.FED_SERVER_URL }}
|
||||
TEST_SERVER_FED_URL: https://federation-ocis-server
|
||||
STORAGE_DRIVER: ${{ env.STORAGE_DRIVER }}
|
||||
BEHAT_SUITES: ${{ matrix.suite }}
|
||||
BEHAT_FILTER_TAGS: "~@skip&&~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
|
||||
@@ -443,172 +376,3 @@ jobs:
|
||||
WITH_REMOTE_PHP: "false"
|
||||
K8S: ${{ env.K8S }}
|
||||
run: make test-acceptance-api
|
||||
|
||||
e2e-tests:
|
||||
name: e2e-${{ matrix.suite }}-k8s
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
|
||||
if: >-
|
||||
github.event_name == 'schedule' ||
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(github.event_name == 'pull_request' &&
|
||||
contains(github.event.pull_request.title || '', 'k8s'))
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- suite: smoke
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
# 24.16.0 breaks playwright install (yauzl zip extraction hangs); pin to last known good.
|
||||
# https://github.com/microsoft/playwright/issues/40724
|
||||
node-version: "24.15.0"
|
||||
|
||||
- name: Enable pnpm
|
||||
run: |
|
||||
corepack enable && corepack prepare pnpm@10.33.3 --activate
|
||||
pnpm config set store-dir ./.pnpm-store
|
||||
|
||||
- name: Cache Playwright Chromium
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-chromium-${{ hashFiles('web/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Download k3d
|
||||
run: |
|
||||
curl -L \
|
||||
-o k3d \
|
||||
https://github.com/k3d-io/k3d/releases/download/${{ env.K3D_VERSION }}/k3d-linux-amd64
|
||||
echo "dbaa79a76ace7f4ca230a1ff41dc7d8a5036a8ad0309e9c54f9bf3836dbe853e k3d" | sha256sum --check
|
||||
chmod +x k3d
|
||||
sudo mv k3d /usr/local/bin/
|
||||
k3d version
|
||||
|
||||
- name: Install Helm
|
||||
run: |
|
||||
curl -fsSL -o helm-${{ env.HELM_VERSION }}-linux-amd64.tar.gz https://get.helm.sh/helm-${{ env.HELM_VERSION }}-linux-amd64.tar.gz
|
||||
tar -zxvf helm-${{ env.HELM_VERSION }}-linux-amd64.tar.gz
|
||||
sudo mv linux-amd64/helm /usr/local/bin/helm
|
||||
helm version --short
|
||||
|
||||
- name: Prepare hosts
|
||||
run: |
|
||||
echo "127.0.0.1 $TEST_SERVER_DOMAIN clamav email collabora onlyoffice fakeoffice tika $FED_SERVER_DOMAIN keycloak" \
|
||||
| sudo tee -a /etc/hosts
|
||||
|
||||
- name: Spin up K3d Cluster
|
||||
run: make -C tests/config/k8s create-cluster
|
||||
|
||||
- name: Prepare Helm Charts
|
||||
run: make -C tests/config/k8s prepare-charts
|
||||
|
||||
- name: Deploy oCIS
|
||||
run: |
|
||||
cd tests/config/k8s
|
||||
kubectl get pods -n "$TEST_SERVER_DOMAIN" -Aw &
|
||||
make deploy-ocis
|
||||
|
||||
- name: Wait for oCIS to be ready
|
||||
env:
|
||||
FILE_URL: ${{ env.TEST_SERVER_URL }}/remote.php/dav/files/admin/hello1.txt
|
||||
run: |
|
||||
kubectl wait \
|
||||
--namespace "$TEST_SERVER_DOMAIN" \
|
||||
--for=condition=Available \
|
||||
deployment \
|
||||
--all \
|
||||
--timeout=10m
|
||||
|
||||
kubectl wait \
|
||||
--namespace "$TEST_SERVER_DOMAIN" \
|
||||
--for=condition=Ready \
|
||||
pod \
|
||||
--all \
|
||||
--timeout=10m
|
||||
|
||||
kubectl get pods -n "$TEST_SERVER_DOMAIN"
|
||||
|
||||
retry() {
|
||||
local label=$1
|
||||
shift
|
||||
for i in {1..30}; do
|
||||
if "$@"; then
|
||||
echo "$label succeeded"
|
||||
return 0
|
||||
fi
|
||||
echo "$label attempt $i failed, retrying in 10s..."
|
||||
sleep 10
|
||||
done
|
||||
echo "$label failed after 30 attempts"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "Creating test file in oCIS..."
|
||||
|
||||
request() {
|
||||
local method=$1
|
||||
shift
|
||||
curl -ks -o /dev/null -w "%{http_code}" \
|
||||
-X "$method" \
|
||||
-u admin:admin \
|
||||
"$@" \
|
||||
"$FILE_URL"
|
||||
}
|
||||
put_file() {
|
||||
request PUT \
|
||||
-H "Content-Type: text/plain" \
|
||||
--data "Hello from GitHub Actions!"
|
||||
}
|
||||
delete_file() {
|
||||
request DELETE
|
||||
}
|
||||
check_status() {
|
||||
local expected=$1
|
||||
shift
|
||||
status=$("$@")
|
||||
[ "$status" = "$expected" ]
|
||||
}
|
||||
echo "Creating test file..."
|
||||
retry "create file (HTTP 201)" check_status 201 put_file || exit 1
|
||||
echo "Deleting test file..."
|
||||
retry "delete file (HTTP 204)" check_status 204 delete_file || exit 1
|
||||
|
||||
- name: Run e2e ${{ matrix.suite }} tests
|
||||
env:
|
||||
E2E_ARGS: "--suites ${{ matrix.suite }}"
|
||||
K8S: ${{ env.K8S }}
|
||||
TEST_SERVER_URL: ${{ env.TEST_SERVER_URL }}
|
||||
run: python3 tests/acceptance/run-e2e.py
|
||||
|
||||
- name: Upload Playwright traces
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: playwright-traces-${{ matrix.suite }}-k8s-${{ github.run_attempt }}
|
||||
path: web/reports/e2e
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload a11y result
|
||||
if: ${{ !cancelled() }}
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: playwright-a11y-result-${{ matrix.suite }}-k8s-${{ github.run_attempt }}
|
||||
path: web/reports/e2e/a11y-report.json
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload oCIS logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: ocis-logs-${{ matrix.suite }}-k8s-${{ github.run_attempt }}
|
||||
path: tests/config/k8s/logs
|
||||
retention-days: 7
|
||||
@@ -26,10 +26,10 @@ jobs:
|
||||
working-directory: web
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: 24.15.0
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
is_prerelease: ${{ steps.info.outputs.is_prerelease }}
|
||||
docker_repos: ${{ steps.info.outputs.docker_repos }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
if: ${{ github.ref_type == 'branch' || (github.event_name == 'workflow_dispatch' && inputs.version_override == '') }}
|
||||
with:
|
||||
fetch-depth: 0
|
||||
@@ -97,11 +97,11 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
needs: [determine-release-type]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- run: npm install --silent -g yarn npx --force
|
||||
@@ -138,7 +138,7 @@ jobs:
|
||||
arch: [amd64, arm64]
|
||||
repo: ${{ fromJSON(needs.determine-release-type.outputs.docker_repos) }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: generated-code
|
||||
@@ -149,7 +149,7 @@ jobs:
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- id: goversion
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- run: |
|
||||
@@ -214,7 +214,7 @@ jobs:
|
||||
arch: [amd64]
|
||||
repo: ${{ fromJSON(needs.determine-release-type.outputs.docker_repos) }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
||||
id: trivy
|
||||
continue-on-error: true
|
||||
@@ -272,7 +272,7 @@ jobs:
|
||||
matrix:
|
||||
repo: ${{ fromJSON(needs.determine-release-type.outputs.docker_repos) }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5.0.0
|
||||
with:
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
@@ -289,12 +289,12 @@ jobs:
|
||||
matrix:
|
||||
os: [linux, darwin]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: generated-code
|
||||
path: .
|
||||
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- run: |
|
||||
@@ -313,7 +313,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
||||
with:
|
||||
scan-type: fs
|
||||
@@ -327,15 +327,15 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
needs: [determine-release-type, generate-code]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: generated-code
|
||||
path: .
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- run: npm install --silent -g yarn npx "pnpm@$PNPM_VERSION" --force
|
||||
@@ -357,10 +357,10 @@ jobs:
|
||||
timeout-minutes: 15
|
||||
needs: [determine-release-type]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- run: |
|
||||
@@ -417,7 +417,7 @@ jobs:
|
||||
- generate-changelog
|
||||
- create-github-release
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: binaries-linux
|
||||
|
||||
@@ -12,9 +12,10 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
web-changed: ${{ steps.check.outputs.web-changed }}
|
||||
full-run: ${{ steps.check.outputs.full-run }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -23,16 +24,24 @@ jobs:
|
||||
env:
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
run: |
|
||||
# full-run: push to master/stable-* or an explicit [full-ci] request always run
|
||||
# everything, unscoped - same as before Nx. A normal PR gets the affected-scoped
|
||||
# path instead (see web-build-test), since only those two cases actually need every
|
||||
# project checked.
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
echo "web-changed=true" >> "$GITHUB_OUTPUT"
|
||||
echo "full-run=true" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if echo "$PR_TITLE" | grep -qi "\[full-ci\]"; then
|
||||
echo "web-changed=true" >> "$GITHUB_OUTPUT"
|
||||
echo "full-run=true" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "full-run=false" >> "$GITHUB_OUTPUT"
|
||||
|
||||
CHANGED_FILES=$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" 2>/dev/null || git diff --name-only HEAD~1)
|
||||
|
||||
WEB_CHANGED=false
|
||||
@@ -57,7 +66,10 @@ jobs:
|
||||
working-directory: web
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
# nx affected --base=<pr-base-sha> (used below) needs that commit present locally
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
|
||||
@@ -65,7 +77,7 @@ jobs:
|
||||
version: 10.33.3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: 24.15.0
|
||||
cache: pnpm
|
||||
@@ -81,16 +93,34 @@ jobs:
|
||||
run: pnpm licenses:csv && pnpm licenses:save
|
||||
|
||||
- name: Check types
|
||||
# Whole-repo, unconditional: only 5/27 projects have a per-project typecheck target
|
||||
# (nx/vite's typecheck inference needs a project's own vite.config.ts, which most
|
||||
# web-app-* packages don't have - see docs/superpowers/specs), so `nx affected
|
||||
# -t typecheck` can't safely stand in for this yet.
|
||||
run: pnpm check:types
|
||||
|
||||
- name: Check format
|
||||
run: pnpm check:format
|
||||
|
||||
- name: Lint
|
||||
run: pnpm lint
|
||||
env:
|
||||
FULL_RUN: ${{ needs.detect-web-changes.outputs.full-run }}
|
||||
run: |
|
||||
if [[ "$FULL_RUN" == "true" ]]; then
|
||||
pnpm lint
|
||||
else
|
||||
pnpm exec nx affected -t lint --base="${{ github.event.pull_request.base.sha }}"
|
||||
fi
|
||||
|
||||
- name: Run unit tests
|
||||
run: pnpm test:unit --coverage
|
||||
env:
|
||||
FULL_RUN: ${{ needs.detect-web-changes.outputs.full-run }}
|
||||
run: |
|
||||
if [[ "$FULL_RUN" == "true" ]]; then
|
||||
pnpm test:unit --coverage
|
||||
else
|
||||
pnpm exec nx affected -t test --base="${{ github.event.pull_request.base.sha }}"
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
container: golang:1.25-alpine
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
|
||||
|
||||
- name: Run CI Reporter
|
||||
working-directory: tools/ci-reporter
|
||||
|
||||
@@ -181,17 +181,6 @@ go-mod-tidy:
|
||||
$(MAKE) --no-print-directory -C $$mod go-mod-tidy || exit 1; \
|
||||
done
|
||||
|
||||
# Opt in to vips-tagged sources: `ENABLE_VIPS=true
|
||||
# make test` compiles files behind `//go:build enable_vips` (e.g. thumbnails).
|
||||
TAGS ?=
|
||||
ifdef ENABLE_VIPS
|
||||
ifeq ($(strip $(TAGS)),)
|
||||
TAGS := enable_vips
|
||||
else
|
||||
TAGS := $(TAGS),enable_vips
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@go test -v -tags '$(TAGS)' -coverprofile coverage.out ./...
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
Bugfix: Announce status messages to screen readers
|
||||
|
||||
Status messages such as "copied to clipboard" or "file restored successfully"
|
||||
were not reliably read out by screen readers. The underlying announcement
|
||||
area was never cleared between messages, so a repeated or rapid message
|
||||
could be silently dropped, especially when combined with a focus change
|
||||
elsewhere on the page.
|
||||
|
||||
The announcement area is now cleared before each new message and refilled
|
||||
after a short delay, so status messages are announced consistently.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13024
|
||||
@@ -1,13 +0,0 @@
|
||||
Bugfix: fixed missing accessible name on button loading spinner
|
||||
|
||||
`OcButton`'s loading spinner is a `role="img"` element, but it had no
|
||||
accessible name. This tripped an axe `role-img-alt` violation on any
|
||||
page whose e2e a11y check ran while a button was in its loading state,
|
||||
such as the public link password page's "Continue" button.
|
||||
|
||||
The spinner now gets a real accessible name ("Loading") via
|
||||
`OcSpinner`'s `ariaLabel` prop, marked `aria-live="polite"` so it is
|
||||
actively announced to screen reader users instead of only being
|
||||
described if focus happens to already be on the button.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13018
|
||||
@@ -1,11 +0,0 @@
|
||||
Bugfix: Do not allow credentials for wildcard CORS origins
|
||||
|
||||
CORS responses no longer send `Access-Control-Allow-Credentials: true` when the
|
||||
configured origins permit any origin: an empty list, `*`, or a wildcard pattern
|
||||
such as `https://*`. In those cases credentials are dropped and a warning is
|
||||
logged. This applies across all CORS paths (the shared HTTP middleware, the reva
|
||||
interceptor used by the frontend and ocm services, ocdav, and the tus upload
|
||||
handler). Explicitly configured origins are unaffected and keep credentials, so
|
||||
intended cross-origin setups continue to work.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12983
|
||||
@@ -1,12 +0,0 @@
|
||||
Bugfix: fixed low color contrast on disabled danger buttons
|
||||
|
||||
Disabled buttons using the "danger" styling, such as the "Empty trash bin"
|
||||
button when there is nothing to delete, showed their label text with very
|
||||
low contrast against the button background, making the text hard to read.
|
||||
|
||||
The muted background color used for these buttons in a disabled state has
|
||||
been darkened, and the fading effect applied to disabled buttons no longer
|
||||
washes out the danger button background, restoring readable contrast
|
||||
between the label and the background.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12992
|
||||
@@ -1,11 +0,0 @@
|
||||
Bugfix: Keep keyboard focus on the trigger when a dropdown closes
|
||||
|
||||
Dropdown and context menus that close on item click (e.g. the per-file "..."
|
||||
menu) removed the clicked item from the page as they closed, so keyboard
|
||||
focus fell back to the page body. Screen readers then re-announced the
|
||||
whole page, drowning out any status message the action had just triggered.
|
||||
|
||||
The dropdown now returns focus to the button that opened it when it closes,
|
||||
unless the clicked action already moved focus somewhere else on its own.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13025
|
||||
@@ -1,12 +0,0 @@
|
||||
Bugfix: fixed low color contrast on dropdown menu item hover text
|
||||
|
||||
Items in dropdown menus, such as the "New" file/folder menu, changed
|
||||
their text to a color meant for use as a background rather than as
|
||||
text when hovered. On top of the generic hover background used
|
||||
across the app, this produced poor contrast in some themes.
|
||||
|
||||
Hovered menu items now keep the same text color already used before
|
||||
hovering, which reads correctly against the hover background in
|
||||
every theme.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12994
|
||||
@@ -1,11 +0,0 @@
|
||||
Bugfix: fixed low color contrast on file name in editor topbar
|
||||
|
||||
The file name and extension shown in the topbar when a file is open,
|
||||
for example in an editor, were displayed in white on top of a light
|
||||
brand-colored background in some theme variants, making the text
|
||||
hard to read.
|
||||
|
||||
The text now uses a dark color instead, restoring readable contrast
|
||||
against that background.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12997
|
||||
@@ -1,12 +0,0 @@
|
||||
Bugfix: fixed low color contrast on disabled danger button text
|
||||
|
||||
Disabled filled danger buttons, such as the "Empty trash bin" button
|
||||
in the deleted files view, displayed their text and icon in a color
|
||||
too close to the background fill, making them hard to read.
|
||||
|
||||
The disabled text and icon color is now forced to white, restoring
|
||||
readable contrast against the button's background. The vault light
|
||||
theme's muted danger color was also darkened, since it was too light
|
||||
to meet contrast requirements against white text.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12998
|
||||
@@ -1,12 +0,0 @@
|
||||
Bugfix: fixed low color contrast on nav and primary button hover states
|
||||
|
||||
Non-active sidebar navigation items, as well as buttons using the
|
||||
"primary" styling, showed their text and icons in black on top of a
|
||||
dark hover background in some themes, making them hard to read while
|
||||
hovering.
|
||||
|
||||
The hover state for these elements now switches to a light color
|
||||
instead of always using black, restoring readable contrast between
|
||||
the text and the background while hovering.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12993
|
||||
@@ -1,11 +0,0 @@
|
||||
Bugfix: fixed low color contrast on notification bell badge
|
||||
|
||||
The unread notification count badge on the notification bell used a
|
||||
hardcoded red background with white text, which fell below the
|
||||
WCAG AA contrast requirement for text that size.
|
||||
|
||||
The badge now uses the design system's danger color tokens instead,
|
||||
which are already tuned to keep sufficient contrast with their
|
||||
paired text color across all theme variants.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13000
|
||||
@@ -1,12 +0,0 @@
|
||||
Bugfix: notification bell now announces the unread count
|
||||
|
||||
The notification bell's accessible name was a static "Notifications"
|
||||
string regardless of how many unread notifications there were. Since
|
||||
that label overrides all other content for assistive technology, screen
|
||||
reader users never heard the unread count that sighted users see on the
|
||||
bell's badge.
|
||||
|
||||
The bell's accessible name and tooltip now include the exact unread
|
||||
count, with correct singular/plural wording.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13003
|
||||
@@ -1,12 +0,0 @@
|
||||
Bugfix: fixed arrow-key navigation in the notification dropdown
|
||||
|
||||
Opening the notification bell's dropdown did not move keyboard focus into
|
||||
it. Arrow-key navigation only started working after an extra, unrelated
|
||||
Tab press, and pressing an arrow key too early scrolled the page instead,
|
||||
which looked like the dropdown had closed.
|
||||
|
||||
The dropdown now moves focus to its first item as soon as it opens, so
|
||||
arrow keys work immediately, matching the behavior of other click-triggered
|
||||
dropdowns in the application.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13002
|
||||
@@ -1,12 +0,0 @@
|
||||
Bugfix: fixed low color contrast on share permission dropdown hover text
|
||||
|
||||
The share permission dropdown's role options, such as "Can view" or
|
||||
"Can edit", showed their hovered text in a color too close in
|
||||
lightness to the hover background in the dark theme, making it hard
|
||||
to read.
|
||||
|
||||
The hover text color has been lightened slightly, restoring
|
||||
readable contrast between the text and the background while
|
||||
hovering.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12995
|
||||
@@ -1,14 +0,0 @@
|
||||
Bugfix: added a keyboard shortcut to move focus out of the text editor
|
||||
|
||||
Opening the text/markdown editor moved keyboard focus straight into the
|
||||
edit area, but Tab is bound to indenting rather than moving focus, so
|
||||
there was no reliable way to reach the toolbar without leaving the file
|
||||
entirely. The editor's own built-in escape hatch for this doesn't work
|
||||
on a standard Mac keyboard, since the key combo it relies on is consumed
|
||||
by macOS as a diacritic shortcut before it reaches the page.
|
||||
|
||||
Pressing Ctrl+M now moves focus from the edit area to the toolbar, the
|
||||
same way on every platform. The editor's accessible description also
|
||||
announces this shortcut for assistive technology users.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13004
|
||||
@@ -1,7 +0,0 @@
|
||||
Bugfix: Text and BMP file previews failed where libvips has no ImageMagick
|
||||
|
||||
Downloading the preview of a text or BMP file failed with a `500 could not get thumbnail` error on systems where libvips comes without ImageMagick support, such as minimal container images. The rendered text image was passed through a BMP encoding round-trip first, and uploaded BMP files were handed to libvips as bytes; libvips can only load BMP images via ImageMagick.
|
||||
|
||||
The rendered text image is now handed over to libvips directly from memory, and BMP files are decoded in Go before the handover, so both no longer depend on ImageMagick being installed alongside libvips.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12961
|
||||
@@ -1,12 +0,0 @@
|
||||
Bugfix: Return a retryable 503 when the OIDC userinfo call fails transiently
|
||||
|
||||
A transient failure of the OIDC userinfo call (a timeout, a network error or a
|
||||
5xx/429 from the IdP) was mapped to HTTP 401. Clients read the 401 as an invalid
|
||||
session and logged the user out on a brief IdP slowdown.
|
||||
|
||||
The proxy now distinguishes a transient IdP failure from an authentication
|
||||
failure and returns a retryable 503 (with Retry-After) for the former, so clients
|
||||
retry and keep their session. A genuinely invalid or expired token still returns
|
||||
401.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12999
|
||||
@@ -1,15 +0,0 @@
|
||||
Bugfix: Open Safe permanent links from outside the Safe
|
||||
|
||||
A permanent link to a file in the Safe, opened in a regular Drive tab, showed
|
||||
"An error occurred while resolving the private link" instead of the file. The
|
||||
Web frontend recognized Safe files by a storage provider id that the server
|
||||
only sends to sessions already inside the Safe, so a Drive tab never redirected
|
||||
the link into the Safe.
|
||||
|
||||
The Safe storage provider id is fixed, so the frontend now uses it as a
|
||||
constant, like the share jail and OCM ids. This also keeps Safe notifications
|
||||
out of the Drive view and lets the invite form recognize Safe resources in
|
||||
Drive mode. The `vaultStorageProvider` getter of the web-pkg capability store
|
||||
is removed; use `VAULT_STORAGE_PROVIDER_ID` from web-client instead.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13001
|
||||
@@ -1,17 +0,0 @@
|
||||
Bugfix: Hide "Shared via link" when public sharing is disabled
|
||||
|
||||
The Shares navigation (the desktop tab list and the mobile drop-down) always
|
||||
offered a "Shared via link" entry, even when public link sharing was disabled
|
||||
for the account — for example in the Vault, where the backend rejects public
|
||||
link creation and the capability `files_sharing.public.enabled` reported
|
||||
`false`. The entry led to a page that could never contain anything.
|
||||
|
||||
The Shares navigation was changed to hide the "Shared via link" entry
|
||||
whenever `files_sharing.public.enabled` is `false`. Anyone who still reached
|
||||
the via-link route directly, including through the legacy
|
||||
`/list/shared-via-link` redirect, was redirected to "Shared with me" at
|
||||
navigation time, keeping the current route scope (e.g. `vault`) intact. When
|
||||
public sharing was enabled, all three Shares navigation entries continued to
|
||||
behave exactly as before.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/13005
|
||||
@@ -10,7 +10,7 @@ require (
|
||||
github.com/MicahParks/keyfunc/v2 v2.1.0
|
||||
github.com/Nerzal/gocloak/v13 v13.9.0
|
||||
github.com/bbalet/stopwords v1.0.0
|
||||
github.com/beevik/etree v1.8.1
|
||||
github.com/beevik/etree v1.7.1
|
||||
github.com/blevesearch/bleve/v2 v2.6.0
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible
|
||||
github.com/cenkalti/backoff/v5 v5.0.3
|
||||
@@ -35,7 +35,7 @@ require (
|
||||
github.com/go-micro/plugins/v4/store/nats-js-kv v0.0.0-20240726082623-6831adfdcdc4
|
||||
github.com/go-micro/plugins/v4/wrapper/monitoring/prometheus v1.2.0
|
||||
github.com/go-micro/plugins/v4/wrapper/trace/opentelemetry v1.2.0
|
||||
github.com/go-playground/validator/v10 v10.30.5
|
||||
github.com/go-playground/validator/v10 v10.30.4
|
||||
github.com/gofrs/uuid v4.4.0+incompatible
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1
|
||||
github.com/golang/protobuf v1.5.4
|
||||
@@ -58,16 +58,16 @@ 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.15.0
|
||||
github.com/nats-io/nats.go v1.54.0
|
||||
github.com/nats-io/nats-server/v2 v2.14.6
|
||||
github.com/nats-io/nats.go v1.53.1
|
||||
github.com/olekukonko/tablewriter v1.1.4
|
||||
github.com/onsi/ginkgo v1.16.5
|
||||
github.com/onsi/ginkgo/v2 v2.33.0
|
||||
github.com/onsi/gomega v1.44.0
|
||||
github.com/onsi/ginkgo/v2 v2.32.1
|
||||
github.com/onsi/gomega v1.43.0
|
||||
github.com/open-policy-agent/opa v1.19.0
|
||||
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-20261006130333-e8a7c20b6b93
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260917145219-ba14a94a3c7a
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/xattr v0.4.12
|
||||
github.com/prometheus/client_golang v1.24.1
|
||||
@@ -83,7 +83,7 @@ require (
|
||||
github.com/test-go/testify v1.1.4
|
||||
github.com/thejerf/suture/v4 v4.0.6
|
||||
github.com/tidwall/gjson v1.19.0
|
||||
github.com/tus/tusd/v2 v2.10.1
|
||||
github.com/tus/tusd/v2 v2.10.0
|
||||
github.com/unrolled/secure v1.17.0
|
||||
github.com/urfave/cli/v2 v2.27.7
|
||||
github.com/xhit/go-simple-mail/v2 v2.16.0
|
||||
@@ -97,16 +97,16 @@ require (
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.46.0
|
||||
go.opentelemetry.io/otel/sdk v1.46.0
|
||||
go.opentelemetry.io/otel/trace v1.46.0
|
||||
golang.org/x/crypto v0.57.0
|
||||
golang.org/x/exp v0.0.0-20260611194520-c48552f49976
|
||||
golang.org/x/crypto v0.56.0
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
|
||||
golang.org/x/image v0.45.0
|
||||
golang.org/x/net v0.58.0
|
||||
golang.org/x/oauth2 v0.37.0
|
||||
golang.org/x/sync v0.23.0
|
||||
golang.org/x/term v0.46.0
|
||||
golang.org/x/text v0.42.0
|
||||
golang.org/x/oauth2 v0.36.0
|
||||
golang.org/x/sync v0.22.0
|
||||
golang.org/x/term v0.45.0
|
||||
golang.org/x/text v0.41.0
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260819154853-08b0e4226688
|
||||
google.golang.org/grpc v1.84.0
|
||||
google.golang.org/grpc v1.83.2
|
||||
google.golang.org/protobuf v1.36.12
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gotest.tools/v3 v3.5.2
|
||||
@@ -128,7 +128,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.8.0-default-no-op // indirect
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.2-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
|
||||
@@ -199,7 +199,7 @@ require (
|
||||
github.com/go-micro/plugins/v4/store/nats-js v1.2.1 // indirect
|
||||
github.com/go-micro/plugins/v4/store/redis v1.2.1 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.2 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
||||
github.com/go-resty/resty/v2 v2.17.2 // indirect
|
||||
github.com/go-sql-driver/mysql v1.10.1 // indirect
|
||||
@@ -220,7 +220,7 @@ require (
|
||||
github.com/gomodule/redigo v1.9.3 // indirect
|
||||
github.com/google/go-querystring v1.2.0 // indirect
|
||||
github.com/google/go-tpm v0.9.8 // indirect
|
||||
github.com/google/pprof v0.0.0-20260604005048-7023385849c0 // indirect
|
||||
github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 // indirect
|
||||
github.com/google/renameio/v2 v2.0.2 // indirect
|
||||
github.com/gookit/goutil v0.8.0 // indirect
|
||||
github.com/gorilla/handlers v1.5.1 // indirect
|
||||
@@ -228,7 +228,7 @@ require (
|
||||
github.com/hashicorp/go-hclog v1.6.3 // indirect
|
||||
github.com/hashicorp/go-plugin v1.8.0 // indirect
|
||||
github.com/hashicorp/yamux v0.1.2 // indirect
|
||||
github.com/huandu/xstrings v1.6.1 // indirect
|
||||
github.com/huandu/xstrings v1.5.0 // indirect
|
||||
github.com/iancoleman/strcase v0.3.0 // indirect
|
||||
github.com/imdario/mergo v0.3.15 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
@@ -238,7 +238,7 @@ require (
|
||||
github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 // indirect
|
||||
github.com/juliangruber/go-intersect v1.1.0 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.20.0 // indirect
|
||||
github.com/klauspost/compress v1.19.2 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.4.0 // indirect
|
||||
github.com/klauspost/crc32 v1.3.0 // indirect
|
||||
github.com/kovidgoyal/go-parallel v1.1.1 // indirect
|
||||
@@ -255,10 +255,10 @@ require (
|
||||
github.com/longsleep/go-metrics v1.0.0 // indirect
|
||||
github.com/longsleep/rndm v1.2.0 // indirect
|
||||
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.15 // indirect
|
||||
github.com/mattn/go-isatty v0.0.22 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.21 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.23 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.52 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.50 // indirect
|
||||
github.com/maxymania/go-system v0.0.0-20170110133659-647cc364bf0b // indirect
|
||||
github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103 // indirect
|
||||
github.com/miekg/dns v1.1.72 // indirect
|
||||
@@ -290,7 +290,7 @@ require (
|
||||
github.com/pierrec/lz4/v4 v4.1.26 // indirect
|
||||
github.com/pjbgf/sha1cd v0.6.0 // indirect
|
||||
github.com/pquerna/cachecontrol v0.2.0 // indirect
|
||||
github.com/prometheus/alertmanager v0.34.1 // indirect
|
||||
github.com/prometheus/alertmanager v0.34.0 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.70.1 // indirect
|
||||
github.com/prometheus/procfs v0.21.1 // indirect
|
||||
@@ -326,9 +326,9 @@ require (
|
||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
|
||||
github.com/yashtewari/glob-intersection v0.2.0 // indirect
|
||||
github.com/zeebo/xxh3 v1.1.0 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.7.2 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.7.2 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.7.2 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.7.1 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.7.1 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.7.1 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.46.0 // indirect
|
||||
@@ -338,11 +338,11 @@ require (
|
||||
go.uber.org/zap v1.27.1 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.4 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.5 // indirect
|
||||
golang.org/x/mod v0.41.0 // indirect
|
||||
golang.org/x/sys v0.48.0 // indirect
|
||||
golang.org/x/time v0.16.0 // indirect
|
||||
golang.org/x/mod v0.40.0 // indirect
|
||||
golang.org/x/sys v0.47.0 // indirect
|
||||
golang.org/x/time v0.15.0 // indirect
|
||||
golang.org/x/tools v0.49.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20260622175928-b703f567277d // indirect
|
||||
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5 // indirect
|
||||
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.3 // indirect
|
||||
|
||||
@@ -90,8 +90,8 @@ github.com/amoghe/go-crypt v0.0.0-20220222110647-20eada5f5964 h1:I9YN9WMo3SUh7p/
|
||||
github.com/amoghe/go-crypt v0.0.0-20220222110647-20eada5f5964/go.mod h1:eFiR01PwTcpbzXtdMces7zxg6utvFM5puiWHpWB8D/k=
|
||||
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.8.0-default-no-op h1:1BOWQJweNyvZMlpAHXGLiZQn9S+QXGcz3xh94lC0w6E=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.8.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.2-default-no-op h1:p2zFsAzvhIpFya8AIOHIbWf7NGvO34QpLGclyf7nXj8=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.2-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
|
||||
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=
|
||||
@@ -104,8 +104,8 @@ github.com/aws/aws-sdk-go v1.55.8 h1:JRmEUbU52aJQZ2AjX4q4Wu7t4uZjOu71uyNmaWlUkJQ
|
||||
github.com/aws/aws-sdk-go v1.55.8/go.mod h1:ZkViS9AqA6otK+JBBNH2++sx1sgxrPKcSzPPvQkUtXk=
|
||||
github.com/bbalet/stopwords v1.0.0 h1:0TnGycCtY0zZi4ltKoOGRFIlZHv0WqpoIGUsObjztfo=
|
||||
github.com/bbalet/stopwords v1.0.0/go.mod h1:sAWrQoDMfqARGIn4s6dp7OW7ISrshUD8IP2q3KoqPjc=
|
||||
github.com/beevik/etree v1.8.1 h1:MchsAnqPGCGsfQezhwcouHPlAHlcAOqWpyCVZoyWfjU=
|
||||
github.com/beevik/etree v1.8.1/go.mod h1:bh4zJxiIr62SOf9pRzN7UUYaEDa9HEKafK25+sLc0Gc=
|
||||
github.com/beevik/etree v1.7.1 h1:xBlSFAjlMfZkrCNKCEdZ2MSN9pfQYeRBaISDnAVi4Ek=
|
||||
github.com/beevik/etree v1.7.1/go.mod h1:bh4zJxiIr62SOf9pRzN7UUYaEDa9HEKafK25+sLc0Gc=
|
||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
@@ -357,10 +357,10 @@ github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lY
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.2 h1:LCsMLC9RzmbUMNUPVYD15dmcjwYAJhmX8mPZRW4rAVU=
|
||||
github.com/go-playground/universal-translator v0.18.2/go.mod h1:67VZIMp5lQpDWlnStOct22q1bkdJGJqHghbOtmkawxk=
|
||||
github.com/go-playground/validator/v10 v10.30.5 h1:YyCXvVShZbs2Sm3Mb53eNOlhRXctSOzW5QJAouCTZL4=
|
||||
github.com/go-playground/validator/v10 v10.30.5/go.mod h1:wEqiaov48pXX1kjhc3Da8y0M0Dtg/BK7gurFBLgwFrQ=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.30.4 h1:9Rcod2ZPO6mOEG6b4GqyoHE/H6//Ze0RuhOo1hT1x0w=
|
||||
github.com/go-playground/validator/v10 v10.30.4/go.mod h1:numpT+RPLE91R9oYWMY/R9zRgJBewr3IXHko4OISPpk=
|
||||
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
|
||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||
github.com/go-resty/resty/v2 v2.17.2 h1:FQW5oHYcIlkCNrMD2lloGScxcHJ0gkjshV3qcQAyHQk=
|
||||
@@ -475,8 +475,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf
|
||||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20260604005048-7023385849c0 h1:h1QTMDl6q9wDvDCJVpKQSjgleGFYnd2fOxmg2K+6BGE=
|
||||
github.com/google/pprof v0.0.0-20260604005048-7023385849c0/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI=
|
||||
github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 h1:EwtI+Al+DeppwYX2oXJCETMO23COyaKGP6fHVpkpWpg=
|
||||
github.com/google/pprof v0.0.0-20260402051712-545e8a4df936/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/renameio/v2 v2.0.2 h1:qKZs+tfn+arruZZhQ7TKC/ergJunuJicWS6gLDt/dGw=
|
||||
github.com/google/renameio/v2 v2.0.2/go.mod h1:OX+G6WHHpHq3NVj7cAOleLOwJfcQ1s3uUJQCrr78SWo=
|
||||
@@ -512,8 +512,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
|
||||
github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8=
|
||||
github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/huandu/xstrings v1.6.1 h1:yYdKSd6Sjv3fNZt9BDjl1FDsPNfQEaYi19L5LzK2JKs=
|
||||
github.com/huandu/xstrings v1.6.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
|
||||
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
|
||||
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
@@ -573,8 +573,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.20.0 h1:a3C1ke2ohxFymNlb2HWAHjDeKCI90scRskErZkR0ezA=
|
||||
github.com/klauspost/compress v1.20.0/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
|
||||
github.com/klauspost/compress v1.19.2 h1:hMRETovs/pu/dVWN7zIT1PGG8t509MwT6bO7XSi26R8=
|
||||
github.com/klauspost/compress v1.19.2/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw=
|
||||
github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU=
|
||||
@@ -641,16 +641,16 @@ github.com/mattermost/xml-roundtrip-validator v0.1.0 h1:RXbVD2UAl7A7nOTR4u7E3ILa
|
||||
github.com/mattermost/xml-roundtrip-validator v0.1.0/go.mod h1:qccnGMcpgwcNaBnxqpJpWWUiPNr5H3O8eDgGV9gT5To=
|
||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
|
||||
github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
|
||||
github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
|
||||
github.com/mattn/go-isatty v0.0.21 h1:xYae+lCNBP7QuW4PUnNG61ffM4hVIfm+zUzDuSzYLGs=
|
||||
github.com/mattn/go-isatty v0.0.21/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
|
||||
github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw=
|
||||
github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
||||
github.com/mattn/go-sqlite3 v1.14.52 h1:wVbm2Qnf4OXkqhBTSPuCRZDRnxfbVrrmiCEroVdog8U=
|
||||
github.com/mattn/go-sqlite3 v1.14.52/go.mod h1:6JTjA44L93a0QCyJef5YvlPoKXntQPjzWv5gtm9sB6w=
|
||||
github.com/mattn/go-sqlite3 v1.14.50 h1:dmdFvo1XG4MPzA4IkAmE9upVz/Nj31uRoM5+jC8hYbY=
|
||||
github.com/mattn/go-sqlite3 v1.14.50/go.mod h1:6JTjA44L93a0QCyJef5YvlPoKXntQPjzWv5gtm9sB6w=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/maxymania/go-system v0.0.0-20170110133659-647cc364bf0b h1:Q53idHrTuQDDHyXaxZ6pUl0I9uyD6Z6uKFK3ocX6LzI=
|
||||
github.com/maxymania/go-system v0.0.0-20170110133659-647cc364bf0b/go.mod h1:KirJrATYGbTyUwVR26xIkaipRqRcMRXBf8N5dacvGus=
|
||||
@@ -696,10 +696,10 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nats-io/jwt/v2 v2.8.2 h1:XXRgB60MSTnqsRwejQurVDs/hcv2dkt+86GjI+I/bMc=
|
||||
github.com/nats-io/jwt/v2 v2.8.2/go.mod h1:Ag/56sq9OblL4JgdYufDd16Egb17Kr/8WwwuO/forVc=
|
||||
github.com/nats-io/nats-server/v2 v2.15.0 h1:M99yf0y05rTr46/qc/Is6ZAowI58Ryp2SjufLCUeVJc=
|
||||
github.com/nats-io/nats-server/v2 v2.15.0/go.mod h1:5qLF4CDGzZVFt//3fUrY1ePpwbi05r7QHPNroSUtolk=
|
||||
github.com/nats-io/nats.go v1.54.0 h1:vsXoOxjHp/GmPUN+EcI7uOf/uB+iAP+kEsAFNQN0yzA=
|
||||
github.com/nats-io/nats.go v1.54.0/go.mod h1:y+DZoD1oBOYfZTU681eTUiUjI0vbqYGixNVFHcjHJ0k=
|
||||
github.com/nats-io/nats-server/v2 v2.14.6 h1:dHjEHa49lUTxIb5jrsk5kz/AmOyOQ4T9ti8djcBumDQ=
|
||||
github.com/nats-io/nats-server/v2 v2.14.6/go.mod h1:u/0bNBzN/m5orQGz7q2NNzxCQ6PWdwaOSwPNDADZn/A=
|
||||
github.com/nats-io/nats.go v1.53.1 h1:Otsq3uLc/kLdjmkNHkXH0jBqwUquwdKFoe3fq6/3/Xo=
|
||||
github.com/nats-io/nats.go v1.53.1/go.mod h1:26HypzazeOkyO3/mqd1zZd53STJN0EjCYF9Uy2ZOBno=
|
||||
github.com/nats-io/nkeys v0.4.16 h1:rd5oAuLOb8mnAycB0xleuEBNS1pVVnN0fv/FF34Eypg=
|
||||
github.com/nats-io/nkeys v0.4.16/go.mod h1:llLgWoI0o4z/Q57q2R1kHfmocyhGV6VG/U18Glg1Afs=
|
||||
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
||||
@@ -721,12 +721,12 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
|
||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
||||
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
|
||||
github.com/onsi/ginkgo/v2 v2.33.0 h1:C8gBA6Uc2ZEubiV+SXiu5tZnMTwEmXHgkJwGozKtZf8=
|
||||
github.com/onsi/ginkgo/v2 v2.33.0/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44=
|
||||
github.com/onsi/ginkgo/v2 v2.32.1 h1:6tlvcDm/3sE8lGJbZ4+d4mO3RLy24/tQWOFzVSQNIfw=
|
||||
github.com/onsi/ginkgo/v2 v2.32.1/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.44.0 h1:eAiGl3Pw5jz5GQdDff0BcxYpAX1JxW8xD7mFUuwNfZQ=
|
||||
github.com/onsi/gomega v1.44.0/go.mod h1:e/C2HwaZ1DhvjzXXuFhcR7hY7Sh9pl7MmoWKEjzwcdA=
|
||||
github.com/onsi/gomega v1.43.0 h1:VlG/1FxqNxhSO+lq/OHBNaaqwiBK/mO8JbVkX9Y+FeU=
|
||||
github.com/onsi/gomega v1.43.0/go.mod h1:REff/hsDsodHoKlWsP2mAPhu1+5/6hVYNf9rIEBpeSg=
|
||||
github.com/open-policy-agent/opa v1.19.0 h1:+j2OCsjMezZEML2T1lI9giJdGJS/PL1XFKgkHPGIhpo=
|
||||
github.com/open-policy-agent/opa v1.19.0/go.mod h1:pb6Y6klyf7X7X8uXNDflruA9dQC2gMqWROXI5w/kvv0=
|
||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
@@ -736,8 +736,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-20261006130333-e8a7c20b6b93 h1:oq264ouHPdZkMkAVlApVncbY+9uK5pIlwlD5XmNl2FA=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20261006130333-e8a7c20b6b93/go.mod h1:lr0ehPvNrODohFll0kJa/sIi2T6YskJLPjmR2tC2q2U=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260917145219-ba14a94a3c7a h1:QnKAz6PPmeMgF+w5UJ70InpsrtUeW/6GX+ikkb61XVs=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260917145219-ba14a94a3c7a/go.mod h1:VohDRQV33rVDiofWNngHqQK7tsgtYJpQBNWsn41j/LM=
|
||||
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.12 h1:DVJJTFMDlSAdO46yisPF2vzozs/r+4k6ih8MVghq78M=
|
||||
@@ -767,8 +767,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pquerna/cachecontrol v0.2.0 h1:vBXSNuE5MYP9IJ5kjsdo8uq+w41jSPgvba2DEnkRx9k=
|
||||
github.com/pquerna/cachecontrol v0.2.0/go.mod h1:NrUG3Z7Rdu85UNR3vm7SOsl1nFIeSiQnrHV5K9mBcUI=
|
||||
github.com/prometheus/alertmanager v0.34.1 h1:qtIIP4s20duq2fbafHIti5NYJGaZNh7irXKbJwe/W/E=
|
||||
github.com/prometheus/alertmanager v0.34.1/go.mod h1:XlyJZycGA13e2hrjPMNrrB4C2tzsenmpt2Prya4taws=
|
||||
github.com/prometheus/alertmanager v0.34.0 h1:z75n0NoypggESmt3HD4JlTXOaOZj1EBz1ACHO4Z6EUk=
|
||||
github.com/prometheus/alertmanager v0.34.0/go.mod h1:/qF39A6Vb1MMoDM1SxcySobb7wmpBZha8COwULiKUUo=
|
||||
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
@@ -909,8 +909,8 @@ github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 h1:PM5hJF7HVfNWmCjM
|
||||
github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208/go.mod h1:BzWtXXrXzZUvMacR0oF/fbDDgUPO8L36tDMmRAf14ns=
|
||||
github.com/trustelem/zxcvbn v1.0.1 h1:mp4JFtzdDYGj9WYSD3KQSkwwUumWNFzXaAjckaTYpsc=
|
||||
github.com/trustelem/zxcvbn v1.0.1/go.mod h1:zonUyKeh7sw6psPf/e3DtRqkRyZvAbOfjNz/aO7YQ5s=
|
||||
github.com/tus/tusd/v2 v2.10.1 h1:hO312j4rT0unhaF4Ga7izNaYGbPOKI2kVIXbKgtv1W8=
|
||||
github.com/tus/tusd/v2 v2.10.1/go.mod h1:33RsdwtbXdqb3esrge+95TT7XUHl45uSO1vvA96fNbc=
|
||||
github.com/tus/tusd/v2 v2.10.0 h1:2yOGmkrDl9RQmRIt/00DR2WvYWOoiEu3CoygILb+WRw=
|
||||
github.com/tus/tusd/v2 v2.10.0/go.mod h1:T/OuJHIAC2NHpkEUyQyyaoWyDNRDcQVpJzWl8tX5GY4=
|
||||
github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU=
|
||||
github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4=
|
||||
github.com/valyala/fastjson v1.6.10 h1:/yjJg8jaVQdYR3arGxPE2X5z89xrlhS0eGXdv+ADTh4=
|
||||
@@ -950,12 +950,12 @@ github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
|
||||
github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s=
|
||||
go.etcd.io/bbolt v1.5.0 h1:S7GAl7Fxv12yohbwFfIbQCGDWbQbtDGPET4P/bD4lxU=
|
||||
go.etcd.io/bbolt v1.5.0/go.mod h1:mkltfYE5aUHQxUct9N9V+Kp7aSjFqjgrhcXIS70Lrdk=
|
||||
go.etcd.io/etcd/api/v3 v3.7.2 h1:xgt/6el1LsPWWYNLkhMAK4tZm6dF+1sCqDecpE5gdbk=
|
||||
go.etcd.io/etcd/api/v3 v3.7.2/go.mod h1:RoRCBRt9BfBff1pIGZLUVMiz7wu3bY+b2qLysGu1HY4=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.7.2 h1:SVtlR7tiSVAYOQ4nWPIyFXb4RMgEcnzeAG9RQ8MoNDU=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.7.2/go.mod h1:HsSux/B3ahgyw/D5+d4YbZqicOi0mEbuxm6lIUdjAoI=
|
||||
go.etcd.io/etcd/client/v3 v3.7.2 h1:Z66GqDQDI7zPDfVSsIBqGSK4mJYLtv8ESwXa4mPf+wY=
|
||||
go.etcd.io/etcd/client/v3 v3.7.2/go.mod h1:x03t1qMs4tGZirCDJlMuzPBJdQffXJImIyEjLhNBCsY=
|
||||
go.etcd.io/etcd/api/v3 v3.7.1 h1:KJG0/DcWGfe3Y1otDf/fsBf0TSSgpxZ5RO/L8SFt73E=
|
||||
go.etcd.io/etcd/api/v3 v3.7.1/go.mod h1:8bXIpCMeV7E3/XL0Ix123ATn3dB+0V7d9zklHbB0m78=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.7.1 h1:rKYsj3pRkR0eK3yjT3XOgrhqfmIfj9pzNgxjh7mfFv4=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.7.1/go.mod h1:cnzZGIUzSfjEwLC6UBVsSXlEK1eepS/JUD7wE6PLRT0=
|
||||
go.etcd.io/etcd/client/v3 v3.7.1 h1:0PEMMC0KuZmVIN+RAbdqfkZ45pYTgKVtmBEbRCvZFUg=
|
||||
go.etcd.io/etcd/client/v3 v3.7.1/go.mod h1:ffNqALa8tRCYhYo1F9oR489y23K39Gz+BSR3ApAGYq0=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
@@ -1016,8 +1016,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0
|
||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||
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.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M=
|
||||
golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA=
|
||||
golang.org/x/crypto v0.56.0 h1:GUh5Ii4J5jtcseSMiRqr1jXCNHoxjeV9Fmekc2oLy6Y=
|
||||
golang.org/x/crypto v0.56.0/go.mod h1:OMW5y6CY9l38uPLmxU6l6pwcXp1obtLo3e6gT7gQR2I=
|
||||
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=
|
||||
@@ -1028,8 +1028,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20260611194520-c48552f49976 h1:X8Hz2ImujgbmetVuW+w2YkyZChE3cBpZi2P158rTG9M=
|
||||
golang.org/x/exp v0.0.0-20260611194520-c48552f49976/go.mod h1:vnf4pv9iKZXY58sQE1L86zmNWJ4159e1RkcWiLCkeEY=
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM=
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80=
|
||||
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.45.0 h1:FMb1nTbH5H9vF55SriQHgFw5GnNL9Jg6L25BwXKzhB0=
|
||||
@@ -1055,8 +1055,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c=
|
||||
golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o=
|
||||
golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs=
|
||||
golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE=
|
||||
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=
|
||||
@@ -1109,8 +1109,8 @@ golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4Iltr
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||
golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98=
|
||||
golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58=
|
||||
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
|
||||
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -1125,8 +1125,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk=
|
||||
golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
|
||||
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
|
||||
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
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=
|
||||
@@ -1189,8 +1189,8 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
|
||||
golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
|
||||
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
|
||||
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
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=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
@@ -1198,8 +1198,8 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
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.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE=
|
||||
golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc=
|
||||
golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0=
|
||||
golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w=
|
||||
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=
|
||||
@@ -1211,13 +1211,13 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
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.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI=
|
||||
golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E=
|
||||
golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
|
||||
golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
|
||||
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.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE=
|
||||
golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s=
|
||||
golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
|
||||
golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
|
||||
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=
|
||||
@@ -1325,8 +1325,8 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
|
||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20260622175928-b703f567277d h1:CP5omUq8AJTiWMrPKM1WRLJ7zZeXd9OPcQD3TbBNAyY=
|
||||
google.golang.org/genproto v0.0.0-20260622175928-b703f567277d/go.mod h1:DrwuGJgFSEVNpv3S5Q5VxhRTvdnjauw9GtvwVOEARfA=
|
||||
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgnawEVsOn6OFsnpyxNPRY9QV01dNB0=
|
||||
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260819154853-08b0e4226688 h1:ax2KzoSRIZU/M0cIxri3pKxy99vniH1PVxWC6si/eZI=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260819154853-08b0e4226688/go.mod h1:1RJ9BQGyNdZwkGc1eTqkErfRZ6RJyYPHZo73BZ1vQqI=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5 h1:1VUiZAXyC+zmiFYi+WLtBzr68Cj8wOofHjjrA/kkizc=
|
||||
@@ -1344,8 +1344,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.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0=
|
||||
google.golang.org/grpc v1.84.0/go.mod h1:ljCht0DrxQrXBDRTZp52Qxh3Ffk8CdYm2sj4O2QN2C0=
|
||||
google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU=
|
||||
google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
|
||||
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=
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package cors
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
)
|
||||
|
||||
@@ -68,18 +66,3 @@ func AllowCredentials(allow bool) Option {
|
||||
o.AllowCredentials = allow
|
||||
}
|
||||
}
|
||||
|
||||
// AllowsAnyOrigin reports whether the origins permit any origin: an empty list,
|
||||
// a bare "*", or any wildcard-pattern entry (e.g. "https://*"). Such origins must
|
||||
// not be combined with credentials. Matching is lower-cased and trimmed.
|
||||
func AllowsAnyOrigin(origins []string) bool {
|
||||
if len(origins) == 0 {
|
||||
return true
|
||||
}
|
||||
for _, o := range origins {
|
||||
if strings.Contains(strings.ToLower(strings.TrimSpace(o)), "*") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package cors
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestAllowsAnyOrigin(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
origins []string
|
||||
want bool
|
||||
}{
|
||||
{"nil list", nil, true},
|
||||
{"empty list", []string{}, true},
|
||||
{"bare wildcard", []string{"*"}, true},
|
||||
{"padded wildcard", []string{"* "}, true},
|
||||
{"wildcard scheme pattern", []string{"https://*"}, true},
|
||||
{"wildcard subdomain pattern", []string{"*.example.com"}, true},
|
||||
{"wildcard among concrete origins", []string{"https://a.example", "https://*"}, true},
|
||||
{"single concrete origin", []string{"https://a.example"}, false},
|
||||
{"multiple concrete origins", []string{"https://a.example", "https://b.example"}, false},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if got := AllowsAnyOrigin(tc.origins); got != tc.want {
|
||||
t.Errorf("AllowsAnyOrigin(%q) = %v, want %v", tc.origins, got, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -25,27 +25,17 @@ func NoCache(next http.Handler) http.Handler {
|
||||
func Cors(opts ...cors.Option) func(http.Handler) http.Handler {
|
||||
options := cors.NewOptions(opts...)
|
||||
logger := options.Logger
|
||||
|
||||
allowCredentials := options.AllowCredentials
|
||||
// A wildcard origin must not be combined with credentials.
|
||||
if allowCredentials && cors.AllowsAnyOrigin(options.AllowedOrigins) {
|
||||
logger.Warn().
|
||||
Strs("allowed_origins", options.AllowedOrigins).
|
||||
Msg("cors: refusing to allow credentials together with a wildcard origin, disabling allow_credentials")
|
||||
allowCredentials = false
|
||||
}
|
||||
|
||||
logger.Debug().
|
||||
Str("allowed_origins", strings.Join(options.AllowedOrigins, ", ")).
|
||||
Str("allowed_methods", strings.Join(options.AllowedMethods, ", ")).
|
||||
Str("allowed_headers", strings.Join(options.AllowedHeaders, ", ")).
|
||||
Bool("allow_credentials", allowCredentials).
|
||||
Bool("allow_credentials", options.AllowCredentials).
|
||||
Msg("setup cors middleware")
|
||||
c := rscors.New(rscors.Options{
|
||||
AllowedOrigins: options.AllowedOrigins,
|
||||
AllowedMethods: options.AllowedMethods,
|
||||
AllowedHeaders: options.AllowedHeaders,
|
||||
AllowCredentials: allowCredentials,
|
||||
AllowCredentials: options.AllowCredentials,
|
||||
})
|
||||
return c.Handler
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/cors"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
)
|
||||
|
||||
// TestCorsWildcardOriginDropsCredentials verifies that a wildcard/allow-all
|
||||
// origin is never combined with Access-Control-Allow-Credentials: true.
|
||||
func TestCorsWildcardOriginDropsCredentials(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
allowedOrigins []string
|
||||
allowCredentials bool
|
||||
requestOrigin string
|
||||
wantAllowOrigin string
|
||||
wantCredentials bool
|
||||
}{
|
||||
{
|
||||
name: "wildcard origin with credentials drops credentials",
|
||||
allowedOrigins: []string{"*"},
|
||||
allowCredentials: true,
|
||||
requestOrigin: "https://other.example",
|
||||
wantAllowOrigin: "*",
|
||||
wantCredentials: false,
|
||||
},
|
||||
{
|
||||
name: "empty origins (allow all) with credentials drops credentials",
|
||||
allowedOrigins: []string{},
|
||||
allowCredentials: true,
|
||||
requestOrigin: "https://other.example",
|
||||
wantAllowOrigin: "*",
|
||||
wantCredentials: false,
|
||||
},
|
||||
{
|
||||
// Wildcard-pattern origins are reflected verbatim rather than answered with "*".
|
||||
name: "wildcard-pattern origin with credentials drops credentials",
|
||||
allowedOrigins: []string{"https://*"},
|
||||
allowCredentials: true,
|
||||
requestOrigin: "https://other.example",
|
||||
wantAllowOrigin: "https://other.example",
|
||||
wantCredentials: false,
|
||||
},
|
||||
{
|
||||
name: "wildcard origin without credentials stays wildcard",
|
||||
allowedOrigins: []string{"*"},
|
||||
allowCredentials: false,
|
||||
requestOrigin: "https://other.example",
|
||||
wantAllowOrigin: "*",
|
||||
wantCredentials: false,
|
||||
},
|
||||
{
|
||||
name: "explicit whitelisted origin keeps credentials",
|
||||
allowedOrigins: []string{"https://cloud.example.com"},
|
||||
allowCredentials: true,
|
||||
requestOrigin: "https://cloud.example.com",
|
||||
wantAllowOrigin: "https://cloud.example.com",
|
||||
wantCredentials: true,
|
||||
},
|
||||
{
|
||||
name: "non-whitelisted origin is not reflected",
|
||||
allowedOrigins: []string{"https://cloud.example.com"},
|
||||
allowCredentials: true,
|
||||
requestOrigin: "https://other.example",
|
||||
wantAllowOrigin: "",
|
||||
wantCredentials: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
handler := Cors(
|
||||
cors.Logger(log.NewLogger()),
|
||||
cors.AllowedOrigins(tc.allowedOrigins),
|
||||
cors.AllowedMethods([]string{"GET", "OPTIONS"}),
|
||||
cors.AllowedHeaders([]string{"Authorization"}),
|
||||
cors.AllowCredentials(tc.allowCredentials),
|
||||
)(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}))
|
||||
|
||||
// Exercise the actual (non-preflight) request path.
|
||||
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
req.Header.Set("Origin", tc.requestOrigin)
|
||||
rec := httptest.NewRecorder()
|
||||
handler.ServeHTTP(rec, req)
|
||||
|
||||
gotOrigin := rec.Header().Get("Access-Control-Allow-Origin")
|
||||
if gotOrigin != tc.wantAllowOrigin {
|
||||
t.Errorf("Access-Control-Allow-Origin = %q, want %q", gotOrigin, tc.wantAllowOrigin)
|
||||
}
|
||||
|
||||
gotCredentials := rec.Header().Get("Access-Control-Allow-Credentials") == "true"
|
||||
if gotCredentials != tc.wantCredentials {
|
||||
t.Errorf("Access-Control-Allow-Credentials = %v, want %v", gotCredentials, tc.wantCredentials)
|
||||
}
|
||||
|
||||
if gotOrigin == "*" && gotCredentials {
|
||||
t.Error("insecure CORS: wildcard origin combined with credentials")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
+14
-29
@@ -115,21 +115,17 @@ func (c *oidcClient) lookupWellKnownOpenidConfiguration(ctx context.Context) err
|
||||
}
|
||||
resp, err := c.httpClient.Do(req.WithContext(ctx))
|
||||
if err != nil {
|
||||
return classifyTransport(err)
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return classifyTransport(err)
|
||||
return fmt.Errorf("unable to read response body: %v", err)
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
err := fmt.Errorf("%s: %s", resp.Status, body)
|
||||
if statusIsTransient(resp.StatusCode) {
|
||||
return errors.Join(ErrTemporarilyUnavailable, err)
|
||||
}
|
||||
return err
|
||||
return fmt.Errorf("%s: %s", resp.Status, body)
|
||||
}
|
||||
|
||||
var p ProviderMetadata
|
||||
@@ -154,7 +150,7 @@ func (c *oidcClient) lookupWellKnownOpenidConfiguration(ctx context.Context) err
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *oidcClient) getKeyfunc() (*keyfunc.JWKS, error) {
|
||||
func (c *oidcClient) getKeyfunc() *keyfunc.JWKS {
|
||||
c.jwksLock.Lock()
|
||||
defer c.jwksLock.Unlock()
|
||||
if c.JWKS == nil {
|
||||
@@ -174,10 +170,10 @@ func (c *oidcClient) getKeyfunc() (*keyfunc.JWKS, error) {
|
||||
if err != nil {
|
||||
c.JWKS = nil
|
||||
c.Logger.Error().Err(err).Msg("Failed to create JWKS from resource at the given URL.")
|
||||
return nil, err
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return c.JWKS, nil
|
||||
return c.JWKS
|
||||
}
|
||||
|
||||
type stringAsBool bool
|
||||
@@ -243,19 +239,15 @@ func (c *oidcClient) UserInfo(ctx context.Context, tokenSource oauth2.TokenSourc
|
||||
|
||||
resp, err := c.httpClient.Do(req.WithContext(ctx))
|
||||
if err != nil {
|
||||
return nil, classifyTransport(err)
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, classifyTransport(err)
|
||||
return nil, err
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
err := fmt.Errorf("%s: %s", resp.Status, body)
|
||||
if statusIsTransient(resp.StatusCode) {
|
||||
return nil, errors.Join(ErrTemporarilyUnavailable, err)
|
||||
}
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("%s: %s", resp.Status, body)
|
||||
}
|
||||
|
||||
ct := resp.Header.Get("Content-Type")
|
||||
@@ -301,11 +293,7 @@ func (c *oidcClient) VerifyAccessToken(ctx context.Context, token string) (RegCl
|
||||
func (c *oidcClient) verifyAccessTokenJWT(token string) (RegClaimsWithSID, jwt.MapClaims, error) {
|
||||
var claims RegClaimsWithSID
|
||||
mapClaims := jwt.MapClaims{}
|
||||
jwks, err := c.getKeyfunc()
|
||||
if err != nil {
|
||||
// A JWKS fetch timeout/network error is transient (503), not a bad token (401).
|
||||
return claims, mapClaims, classifyTransport(err)
|
||||
}
|
||||
jwks := c.getKeyfunc()
|
||||
if jwks == nil {
|
||||
return claims, mapClaims, errors.New("error initializing jwks keyfunc")
|
||||
}
|
||||
@@ -317,9 +305,9 @@ func (c *oidcClient) verifyAccessTokenJWT(token string) (RegClaimsWithSID, jwt.M
|
||||
issuer = c.provider.AccessTokenIssuer
|
||||
}
|
||||
|
||||
_, err = jwt.ParseWithClaims(token, &claims, jwks.Keyfunc, jwt.WithIssuer(issuer))
|
||||
_, err := jwt.ParseWithClaims(token, &claims, jwks.Keyfunc, jwt.WithIssuer(issuer))
|
||||
if err != nil {
|
||||
return claims, mapClaims, classifyTransport(err)
|
||||
return claims, mapClaims, err
|
||||
}
|
||||
_, _, err = new(jwt.Parser).ParseUnverified(token, mapClaims)
|
||||
// TODO: decode mapClaims to sth readable
|
||||
@@ -370,10 +358,7 @@ func (c *oidcClient) VerifyLogoutToken(ctx context.Context, rawToken string) (*L
|
||||
if err := c.lookupWellKnownOpenidConfiguration(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
jwks, err := c.getKeyfunc()
|
||||
if err != nil {
|
||||
return nil, classifyTransport(err)
|
||||
}
|
||||
jwks := c.getKeyfunc()
|
||||
if jwks == nil {
|
||||
return nil, errors.New("error initializing jwks keyfunc")
|
||||
}
|
||||
@@ -388,7 +373,7 @@ func (c *oidcClient) VerifyLogoutToken(ctx context.Context, rawToken string) (*L
|
||||
supportedSigAlgs = []string{RS256}
|
||||
}
|
||||
|
||||
_, err = jwt.ParseWithClaims(rawToken, &claims, jwks.Keyfunc, jwt.WithValidMethods(supportedSigAlgs), jwt.WithIssuer(c.issuer))
|
||||
_, err := jwt.ParseWithClaims(rawToken, &claims, jwks.Keyfunc, jwt.WithValidMethods(supportedSigAlgs), jwt.WithIssuer(c.issuer))
|
||||
if err != nil {
|
||||
c.Logger.Debug().Err(err).Msg("Failed to parse logout token")
|
||||
return nil, err
|
||||
|
||||
@@ -4,16 +4,12 @@ import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/MicahParks/keyfunc/v2"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
|
||||
"github.com/owncloud/ocis/v2/services/proxy/pkg/config"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
type signingKey struct {
|
||||
@@ -305,68 +301,6 @@ func TestVerifyAccessTokenAudience(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A userinfo call that returns a transient status (429/5xx) must be classified as
|
||||
// temporarily unavailable so the proxy answers 503, not 401 (#12999). A genuine
|
||||
// auth status (401/403) must stay a plain error that maps to 401.
|
||||
func TestUserInfoStatusClassification(t *testing.T) {
|
||||
tests := []struct {
|
||||
status int
|
||||
transient bool
|
||||
}{
|
||||
{http.StatusUnauthorized, false},
|
||||
{http.StatusForbidden, false},
|
||||
{http.StatusInternalServerError, true},
|
||||
{http.StatusBadGateway, true},
|
||||
{http.StatusServiceUnavailable, true},
|
||||
{http.StatusTooManyRequests, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(http.StatusText(tt.status), func(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(tt.status)
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
c := oidc.NewOIDCClient(
|
||||
oidc.WithProviderMetadata(&oidc.ProviderMetadata{UserinfoEndpoint: srv.URL}),
|
||||
oidc.WithHTTPClient(srv.Client()),
|
||||
)
|
||||
|
||||
_, err := c.UserInfo(context.Background(),
|
||||
oauth2.StaticTokenSource(&oauth2.Token{AccessToken: "t"}))
|
||||
if err == nil {
|
||||
t.Fatalf("expected an error for status %d", tt.status)
|
||||
}
|
||||
if got := errors.Is(err, oidc.ErrTemporarilyUnavailable); got != tt.transient {
|
||||
t.Fatalf("status %d: transient = %v, want %v (err=%v)", tt.status, got, tt.transient, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// A transient failure while discovering the IdP (well-known/JWKS) during access-token
|
||||
// verification must be classified as temporarily unavailable, not surfaced as a 401 (#12999).
|
||||
func TestVerifyAccessTokenTransientDiscovery(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
c := oidc.NewOIDCClient(
|
||||
oidc.WithOidcIssuer(srv.URL),
|
||||
oidc.WithHTTPClient(srv.Client()),
|
||||
oidc.WithAccessTokenVerifyMethod(config.AccessTokenVerificationJWT),
|
||||
)
|
||||
|
||||
_, _, err := c.VerifyAccessToken(context.Background(), "any.token.here")
|
||||
if err == nil {
|
||||
t.Fatal("expected an error for a 503 during discovery")
|
||||
}
|
||||
if !errors.Is(err, oidc.ErrTemporarilyUnavailable) {
|
||||
t.Fatalf("discovery 503 must be transient, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func newRSAKey(t testing.TB) *signingKey {
|
||||
priv, err := rsa.GenerateKey(rand.Reader, 1028)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package oidc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ErrTemporarilyUnavailable marks a transient IdP failure (timeout, network error
|
||||
// or 5xx/429), which callers should treat as retryable (503) rather than as an
|
||||
// authentication failure (401).
|
||||
var ErrTemporarilyUnavailable = errors.New("oidc: identity provider temporarily unavailable")
|
||||
|
||||
func classifyTransport(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
// context.Canceled means the caller hung up or the server is shutting down, not an IdP outage.
|
||||
var netErr net.Error
|
||||
if errors.Is(err, context.DeadlineExceeded) || errors.As(err, &netErr) {
|
||||
return errors.Join(ErrTemporarilyUnavailable, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// statusIsTransient lists the retryable statuses explicitly so a permanent 5xx
|
||||
// (501, 505) fails fast instead of being retried forever.
|
||||
func statusIsTransient(status int) bool {
|
||||
switch status {
|
||||
case http.StatusTooManyRequests,
|
||||
http.StatusInternalServerError,
|
||||
http.StatusBadGateway,
|
||||
http.StatusServiceUnavailable,
|
||||
http.StatusGatewayTimeout:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package oidc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type timeoutErr struct{}
|
||||
|
||||
func (timeoutErr) Error() string { return "i/o timeout" }
|
||||
func (timeoutErr) Timeout() bool { return true }
|
||||
func (timeoutErr) Temporary() bool { return true }
|
||||
|
||||
var _ net.Error = timeoutErr{}
|
||||
|
||||
func TestClassifyTransport(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
err error
|
||||
transient bool
|
||||
}{
|
||||
{"nil", nil, false},
|
||||
{"deadline exceeded", context.DeadlineExceeded, true},
|
||||
{"canceled", context.Canceled, false},
|
||||
{"wrapped deadline", errors.Join(errors.New("get userinfo"), context.DeadlineExceeded), true},
|
||||
{"net error", timeoutErr{}, true},
|
||||
{"plain error", errors.New("token revoked"), false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := classifyTransport(tt.err)
|
||||
if tt.err == nil {
|
||||
if got != nil {
|
||||
t.Fatalf("expected nil, got %v", got)
|
||||
}
|
||||
return
|
||||
}
|
||||
if errors.Is(got, ErrTemporarilyUnavailable) != tt.transient {
|
||||
t.Fatalf("transient = %v, want %v (err=%v)", !tt.transient, tt.transient, got)
|
||||
}
|
||||
if !errors.Is(got, tt.err) {
|
||||
t.Fatalf("classifyTransport dropped the underlying error: %v", got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestStatusIsTransient(t *testing.T) {
|
||||
tests := map[int]bool{
|
||||
http.StatusUnauthorized: false,
|
||||
http.StatusForbidden: false,
|
||||
http.StatusNotFound: false,
|
||||
http.StatusTooManyRequests: true,
|
||||
http.StatusInternalServerError: true,
|
||||
http.StatusBadGateway: true,
|
||||
http.StatusServiceUnavailable: true,
|
||||
http.StatusGatewayTimeout: true,
|
||||
http.StatusNotImplemented: false,
|
||||
http.StatusHTTPVersionNotSupported: false,
|
||||
}
|
||||
for status, want := range tests {
|
||||
if got := statusIsTransient(status); got != want {
|
||||
t.Errorf("statusIsTransient(%d) = %v, want %v", status, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ func DefaultConfig() *config.Config {
|
||||
Driver: "",
|
||||
Drivers: config.Drivers{
|
||||
WOPI: config.WOPIDriver{
|
||||
WopiFolderURLBaseURL: "https://localhost:9200",
|
||||
WopiFolderURLBaseURL: "https://localhost:9200/",
|
||||
WopiFolderURLPathTemplate: "/f/{{.ResourceID}}",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
package revaconfig
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/v2/services/app-provider/pkg/config"
|
||||
)
|
||||
|
||||
@@ -40,7 +38,7 @@ func AppProviderConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
"iop_secret": cfg.Drivers.WOPI.IopSecret,
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
"wopi_url": cfg.Drivers.WOPI.WopiURL,
|
||||
"wopi_folder_url_base_url": strings.TrimRight(cfg.Drivers.WOPI.WopiFolderURLBaseURL, "/") + "/", // ensure it ends with "/"
|
||||
"wopi_folder_url_base_url": cfg.Drivers.WOPI.WopiFolderURLBaseURL,
|
||||
"wopi_folder_url_path_template": cfg.Drivers.WOPI.WopiFolderURLPathTemplate,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -61,14 +61,14 @@ func DefaultConfig() *config.Config {
|
||||
PoolSize: 5,
|
||||
PoolCheckoutTimeout: 30 * time.Second,
|
||||
UserSchema: config.LDAPUserSchema{
|
||||
ID: "ownCloudUUID",
|
||||
ID: "ownclouduuid",
|
||||
Mail: "mail",
|
||||
DisplayName: "displayName",
|
||||
DisplayName: "displayname",
|
||||
Username: "uid",
|
||||
Enabled: "ownCloudUserEnabled",
|
||||
},
|
||||
GroupSchema: config.LDAPGroupSchema{
|
||||
ID: "ownCloudUUID",
|
||||
ID: "ownclouduuid",
|
||||
Mail: "mail",
|
||||
DisplayName: "cn",
|
||||
Groupname: "cn",
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/capabilities"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/config/defaults"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/cors"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/v2/services/frontend/pkg/config"
|
||||
@@ -88,14 +87,6 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string
|
||||
changePasswordDisabled = true
|
||||
}
|
||||
|
||||
corsAllowCredentials := cfg.HTTP.CORS.AllowCredentials
|
||||
if corsAllowCredentials && cors.AllowsAnyOrigin(cfg.HTTP.CORS.AllowedOrigins) {
|
||||
logger.Warn().
|
||||
Strs("allowed_origins", cfg.HTTP.CORS.AllowedOrigins).
|
||||
Msg("cors: refusing to allow credentials together with a wildcard origin, disabling allow_credentials")
|
||||
corsAllowCredentials = false
|
||||
}
|
||||
|
||||
return map[string]interface{}{
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
@@ -111,7 +102,7 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string
|
||||
"allowed_origins": cfg.HTTP.CORS.AllowedOrigins,
|
||||
"allowed_methods": cfg.HTTP.CORS.AllowedMethods,
|
||||
"allowed_headers": cfg.HTTP.CORS.AllowedHeaders,
|
||||
"allow_credentials": corsAllowCredentials,
|
||||
"allow_credentials": cfg.HTTP.CORS.AllowCredentials,
|
||||
// currently unused
|
||||
//"options_passthrough": ,
|
||||
//"debug": ,
|
||||
|
||||
@@ -105,7 +105,7 @@ func DefaultConfig() *config.Config {
|
||||
UserNameAttribute: "uid",
|
||||
// FIXME: switch this to some more widely available attribute by default
|
||||
// ideally this needs to be constant for the lifetime of a users
|
||||
UserIDAttribute: "ownCloudUUID",
|
||||
UserIDAttribute: "owncloudUUID",
|
||||
UserTypeAttribute: "ownCloudUserType",
|
||||
UserEnabledAttribute: "ownCloudUserEnabled",
|
||||
ExternalIDAttribute: "owncloudExternalID",
|
||||
@@ -117,7 +117,7 @@ func DefaultConfig() *config.Config {
|
||||
GroupObjectClass: "groupOfNames",
|
||||
GroupNameAttribute: "cn",
|
||||
GroupMemberAttribute: "member",
|
||||
GroupIDAttribute: "ownCloudUUID",
|
||||
GroupIDAttribute: "owncloudUUID",
|
||||
EducationResourcesEnabled: false,
|
||||
// 1 minute
|
||||
InstanceMapperCacheTTL: 60,
|
||||
|
||||
@@ -105,7 +105,7 @@ func newSchoolAttributeMap() schoolAttributeMap {
|
||||
return schoolAttributeMap{
|
||||
displayName: "ou",
|
||||
schoolNumber: "ocEducationSchoolNumber",
|
||||
id: "ownCloudUUID",
|
||||
id: "owncloudUUID",
|
||||
terminationDate: "ocEducationSchoolTerminationTimestamp",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,21 +45,21 @@ var schoolEntry = ldap.NewEntry("ou=Test School",
|
||||
map[string][]string{
|
||||
"ou": {"Test School"},
|
||||
"ocEducationSchoolNumber": {"0123"},
|
||||
"ownCloudUUID": {"abcd-defg"},
|
||||
"owncloudUUID": {"abcd-defg"},
|
||||
})
|
||||
|
||||
var schoolEntry1 = ldap.NewEntry("ou=Test School1",
|
||||
map[string][]string{
|
||||
"ou": {"Test School1"},
|
||||
"ocEducationSchoolNumber": {"0042"},
|
||||
"ownCloudUUID": {"hijk-defg"},
|
||||
"owncloudUUID": {"hijk-defg"},
|
||||
})
|
||||
|
||||
var (
|
||||
filterSchoolSearchByIdExisting = "(&(objectClass=ocEducationSchool)(|(ownCloudUUID=abcd-defg)(ocEducationSchoolNumber=abcd-defg)))"
|
||||
filterSchoolSearchByIdNonexistant = "(&(objectClass=ocEducationSchool)(|(ownCloudUUID=xxxx-xxxx)(ocEducationSchoolNumber=xxxx-xxxx)))"
|
||||
filterSchoolSearchByNumberExisting = "(&(objectClass=ocEducationSchool)(|(ownCloudUUID=0123)(ocEducationSchoolNumber=0123)))"
|
||||
filterSchoolSearchByNumberNonexistant = "(&(objectClass=ocEducationSchool)(|(ownCloudUUID=3210)(ocEducationSchoolNumber=3210)))"
|
||||
filterSchoolSearchByIdExisting = "(&(objectClass=ocEducationSchool)(|(owncloudUUID=abcd-defg)(ocEducationSchoolNumber=abcd-defg)))"
|
||||
filterSchoolSearchByIdNonexistant = "(&(objectClass=ocEducationSchool)(|(owncloudUUID=xxxx-xxxx)(ocEducationSchoolNumber=xxxx-xxxx)))"
|
||||
filterSchoolSearchByNumberExisting = "(&(objectClass=ocEducationSchool)(|(owncloudUUID=0123)(ocEducationSchoolNumber=0123)))"
|
||||
filterSchoolSearchByNumberNonexistant = "(&(objectClass=ocEducationSchool)(|(owncloudUUID=3210)(ocEducationSchoolNumber=3210)))"
|
||||
)
|
||||
|
||||
func TestCreateEducationSchool(t *testing.T) {
|
||||
@@ -119,7 +119,7 @@ func TestCreateEducationSchool(t *testing.T) {
|
||||
Scope: 2,
|
||||
SizeLimit: 1,
|
||||
Filter: "(&(objectClass=ocEducationSchool)(ocEducationSchoolNumber=0123))",
|
||||
Attributes: []string{"ou", "ownCloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Attributes: []string{"ou", "owncloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Controls: []ldap.Control(nil),
|
||||
}
|
||||
lm.On("Search", schoolNumberSearchRequest).
|
||||
@@ -133,7 +133,7 @@ func TestCreateEducationSchool(t *testing.T) {
|
||||
Scope: 2,
|
||||
SizeLimit: 1,
|
||||
Filter: "(&(objectClass=ocEducationSchool)(ocEducationSchoolNumber=0666))",
|
||||
Attributes: []string{"ou", "ownCloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Attributes: []string{"ou", "owncloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Controls: []ldap.Control(nil),
|
||||
}
|
||||
lm.On("Search", existingSchoolNumberSearchRequest).
|
||||
@@ -147,7 +147,7 @@ func TestCreateEducationSchool(t *testing.T) {
|
||||
Scope: 2,
|
||||
SizeLimit: 1,
|
||||
Filter: "(&(objectClass=ocEducationSchool)(ocEducationSchoolNumber=1111))",
|
||||
Attributes: []string{"ou", "ownCloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Attributes: []string{"ou", "owncloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Controls: []ldap.Control(nil),
|
||||
}
|
||||
lm.On("Search", schoolNumberSearchRequestError).
|
||||
@@ -161,7 +161,7 @@ func TestCreateEducationSchool(t *testing.T) {
|
||||
Scope: 0,
|
||||
SizeLimit: 1,
|
||||
Filter: "(objectClass=ocEducationSchool)",
|
||||
Attributes: []string{"ou", "ownCloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Attributes: []string{"ou", "owncloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Controls: []ldap.Control(nil),
|
||||
}
|
||||
lm.On("Search", schoolLookupAfterCreate).
|
||||
@@ -347,7 +347,7 @@ func TestDeleteEducationSchool(t *testing.T) {
|
||||
Scope: 2,
|
||||
SizeLimit: 1,
|
||||
Filter: tt.filter,
|
||||
Attributes: []string{"ou", "ownCloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Attributes: []string{"ou", "owncloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Controls: []ldap.Control(nil),
|
||||
}
|
||||
if tt.expectedItemNotFound {
|
||||
@@ -416,7 +416,7 @@ func TestGetEducationSchool(t *testing.T) {
|
||||
Scope: 2,
|
||||
SizeLimit: 1,
|
||||
Filter: tt.filter,
|
||||
Attributes: []string{"ou", "ownCloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Attributes: []string{"ou", "owncloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Controls: []ldap.Control(nil),
|
||||
}
|
||||
if tt.expectedItemNotFound {
|
||||
@@ -450,7 +450,7 @@ func TestGetEducationSchools(t *testing.T) {
|
||||
Scope: 2,
|
||||
SizeLimit: 0,
|
||||
Filter: "(objectClass=ocEducationSchool)",
|
||||
Attributes: []string{"ou", "ownCloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Attributes: []string{"ou", "owncloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Controls: []ldap.Control(nil),
|
||||
}
|
||||
lm.On("Search", sr1).Return(&ldap.SearchResult{Entries: []*ldap.Entry{schoolEntry, schoolEntry1}}, nil)
|
||||
@@ -467,7 +467,7 @@ var schoolByIDSearch1 *ldap.SearchRequest = &ldap.SearchRequest{
|
||||
Scope: 2,
|
||||
SizeLimit: 1,
|
||||
Filter: filterSchoolSearchByIdExisting,
|
||||
Attributes: []string{"ou", "ownCloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Attributes: []string{"ou", "owncloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Controls: []ldap.Control(nil),
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ var schoolByNumberSearch *ldap.SearchRequest = &ldap.SearchRequest{
|
||||
Scope: 2,
|
||||
SizeLimit: 1,
|
||||
Filter: filterSchoolSearchByNumberExisting,
|
||||
Attributes: []string{"ou", "ownCloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Attributes: []string{"ou", "owncloudUUID", "ocEducationSchoolNumber", "ocEducationSchoolTerminationTimestamp"},
|
||||
Controls: []ldap.Control(nil),
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ func TestCreateGroupSynthesizesWhenNotServerUUID(t *testing.T) {
|
||||
// synthesized entry must carry the id under that attribute for the model builder.
|
||||
c := lconfig
|
||||
c.UseServerUUID = false
|
||||
c.GroupIDAttribute = "ownCloudUUID"
|
||||
c.GroupIDAttribute = "owncloudUUID"
|
||||
|
||||
var written *ldap.AddRequest
|
||||
l := &mocks.Client{}
|
||||
@@ -446,7 +446,7 @@ func TestCreateEducationClassSynthesizesWhenNotServerUUID(t *testing.T) {
|
||||
|
||||
c := eduConfig
|
||||
c.UseServerUUID = false
|
||||
c.GroupIDAttribute = "ownCloudUUID"
|
||||
c.GroupIDAttribute = "owncloudUUID"
|
||||
|
||||
var written *ldap.AddRequest
|
||||
l := &mocks.Client{}
|
||||
@@ -603,7 +603,7 @@ func TestUpdateEducationSchoolFoldsNoReadBack(t *testing.T) {
|
||||
preRead := ldap.NewEntry("ou=Test School", map[string][]string{
|
||||
"ou": {"Test School"},
|
||||
"ocEducationSchoolNumber": {"0123"},
|
||||
"ownCloudUUID": {"abcd-defg"},
|
||||
"owncloudUUID": {"abcd-defg"},
|
||||
})
|
||||
|
||||
l := &mocks.Client{}
|
||||
@@ -668,7 +668,7 @@ func TestUpdateEducationClassFoldPreservesClassificationAndExternalID(t *testing
|
||||
}
|
||||
|
||||
// TestCreateGroupSynthesizesWithNonDefaultIDAttribute guards the fix for the
|
||||
// hardcoded "ownCloudUUID" id write: the generated id must be stored under the
|
||||
// hardcoded "owncloudUUID" id write: the generated id must be stored under the
|
||||
// configured GroupIDAttribute, otherwise the synthesized model has no id and
|
||||
// createGroupModelFromLDAP returns nil (CreateGroup would return (nil, nil)).
|
||||
func TestCreateGroupSynthesizesWithNonDefaultIDAttribute(t *testing.T) {
|
||||
@@ -676,7 +676,7 @@ func TestCreateGroupSynthesizesWithNonDefaultIDAttribute(t *testing.T) {
|
||||
|
||||
c := lconfig
|
||||
c.UseServerUUID = false
|
||||
c.GroupIDAttribute = "entryUUID" // non-default: previously the id was written to ownCloudUUID only
|
||||
c.GroupIDAttribute = "entryUUID" // non-default: previously the id was written to owncloudUUID only
|
||||
|
||||
var written *ldap.AddRequest
|
||||
l := &mocks.Client{}
|
||||
@@ -697,7 +697,7 @@ func TestCreateGroupSynthesizesWithNonDefaultIDAttribute(t *testing.T) {
|
||||
// the id was written under the configured attribute and survives synthesis
|
||||
assert.NotEmpty(t, newGroup.GetId())
|
||||
assert.NotEmpty(t, written.Attributes)
|
||||
// the AddRequest carries the id under the configured attribute, not "ownCloudUUID"
|
||||
// the AddRequest carries the id under the configured attribute, not "owncloudUUID"
|
||||
var idFromConfigured, idFromHardcoded string
|
||||
for _, a := range written.Attributes {
|
||||
switch a.Type {
|
||||
@@ -705,14 +705,14 @@ func TestCreateGroupSynthesizesWithNonDefaultIDAttribute(t *testing.T) {
|
||||
if len(a.Vals) > 0 {
|
||||
idFromConfigured = a.Vals[0]
|
||||
}
|
||||
case "ownCloudUUID":
|
||||
case "owncloudUUID":
|
||||
if len(a.Vals) > 0 {
|
||||
idFromHardcoded = a.Vals[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
assert.NotEmpty(t, idFromConfigured, "id must be written under the configured GroupIDAttribute")
|
||||
assert.Empty(t, idFromHardcoded, "id must not be written under a hardcoded ownCloudUUID")
|
||||
assert.Empty(t, idFromHardcoded, "id must not be written under a hardcoded owncloudUUID")
|
||||
assert.Equal(t, idFromConfigured, newGroup.GetId())
|
||||
l.AssertNotCalled(t, "Search", mock.Anything)
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ var _ = Describe("Users changing their own password", func() {
|
||||
UserDisplayNameAttribute: "displayName",
|
||||
UserNameAttribute: "uid",
|
||||
UserEmailAttribute: "mail",
|
||||
UserIDAttribute: "ownCloudUUID",
|
||||
UserIDAttribute: "ownclouduuid",
|
||||
UserSearchScope: "sub",
|
||||
GroupNameAttribute: "cn",
|
||||
GroupIDAttribute: "ownCloudUUID",
|
||||
GroupIDAttribute: "ownclouduuid",
|
||||
GroupSearchScope: "sub",
|
||||
}
|
||||
loggger := log.NewLogger()
|
||||
|
||||
@@ -9,14 +9,8 @@ import (
|
||||
settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0"
|
||||
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
|
||||
"github.com/owncloud/reva/v2/pkg/permission"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
// maxConcurrentVaultEligibilityChecks bounds how many per-user role assignment lookups
|
||||
// applyFilterVaultEligible runs at once, so a large search result doesn't fan out into an
|
||||
// unbounded number of concurrent settings service calls.
|
||||
const maxConcurrentVaultEligibilityChecks = 10
|
||||
|
||||
const (
|
||||
appRoleID = "appRoleId"
|
||||
appRoleAssignments = "appRoleAssignments"
|
||||
@@ -265,76 +259,64 @@ func (g Graph) applyFilterEq(ctx context.Context, req *godata.GoDataRequest, ope
|
||||
// applyFilterVaultEligible resolves `vaultEligible eq true`, the filter the share recipient
|
||||
// picker sends while sharing a vault resource. Only `true` is accepted: enumerating the users
|
||||
// who may not enter the vault is not a use case the picker has.
|
||||
//
|
||||
// Eligibility is checked only for the users the directory search actually returned, not for
|
||||
// every account in the system: the search runs first, and a per-user role assignment lookup
|
||||
// follows only for the (usually few) users it matched. This keeps the cost proportional to the
|
||||
// search result instead of the number of accounts in the whole deployment.
|
||||
func (g Graph) applyFilterVaultEligible(ctx context.Context, req *godata.GoDataRequest, operand *godata.ParseNode) ([]*libregraph.User, error) {
|
||||
if operand.Token.Type != godata.ExpressionTokenBoolean || operand.Token.Value != "true" {
|
||||
return nil, unsupportedFilterError()
|
||||
}
|
||||
|
||||
// This is the share recipient search, and clients only send it once a few characters have
|
||||
// been typed (FRONTEND_SEARCH_MIN_LENGTH). We therefore expect a handful of matching users here,
|
||||
// not the whole directory, which is what makes checking each of them individually below cheap.
|
||||
users, err := g.identityBackend.GetUsers(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(users) == 0 {
|
||||
return users, nil
|
||||
|
||||
eligible, err := g.vaultEligibleAccountIDs(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
filteredUsers := make([]*libregraph.User, 0, len(users))
|
||||
for _, user := range users {
|
||||
if _, ok := eligible[user.GetId()]; ok {
|
||||
filteredUsers = append(filteredUsers, user)
|
||||
}
|
||||
}
|
||||
return filteredUsers, nil
|
||||
}
|
||||
|
||||
// vaultEligibleAccountIDs returns the accounts holding the vault mode permission, found by
|
||||
// inverting the assignments of every role that grants it. That is one call per granting role,
|
||||
// rather than one permission check per user the search returned.
|
||||
func (g Graph) vaultEligibleAccountIDs(ctx context.Context) (map[string]struct{}, error) {
|
||||
roles, err := g.roleService.ListRoles(ctx, &settingssvc.ListBundlesRequest{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
vaultGrantingRoles := make(map[string]struct{})
|
||||
accounts := make(map[string]struct{})
|
||||
for _, role := range roles.GetBundles() {
|
||||
if roleGrantsVaultMode(role) {
|
||||
vaultGrantingRoles[role.GetId()] = struct{}{}
|
||||
if !roleGrantsVaultMode(role) {
|
||||
continue
|
||||
}
|
||||
|
||||
assignments, err := g.roleService.ListRoleAssignmentsFiltered(
|
||||
ctx,
|
||||
&settingssvc.ListRoleAssignmentsFilteredRequest{
|
||||
Filters: []*settingsmsg.UserRoleAssignmentFilter{
|
||||
{
|
||||
Type: settingsmsg.UserRoleAssignmentFilter_TYPE_ROLE,
|
||||
Term: &settingsmsg.UserRoleAssignmentFilter_RoleId{RoleId: role.GetId()},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, assignment := range assignments.GetAssignments() {
|
||||
accounts[assignment.GetAccountUuid()] = struct{}{}
|
||||
}
|
||||
}
|
||||
if len(vaultGrantingRoles) == 0 {
|
||||
return []*libregraph.User{}, nil
|
||||
}
|
||||
|
||||
// eligible preserves the directory search's order: each slot is written at most once, by
|
||||
// the goroutine checking that same index, so concurrent execution cannot reorder the result.
|
||||
eligible := make([]bool, len(users))
|
||||
|
||||
eg, egCtx := errgroup.WithContext(ctx)
|
||||
eg.SetLimit(maxConcurrentVaultEligibilityChecks)
|
||||
for i, user := range users {
|
||||
eg.Go(func() error {
|
||||
assignments, err := g.roleService.ListRoleAssignments(egCtx, &settingssvc.ListRoleAssignmentsRequest{
|
||||
AccountUuid: user.GetId(),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, assignment := range assignments.GetAssignments() {
|
||||
if _, ok := vaultGrantingRoles[assignment.GetRoleId()]; ok {
|
||||
eligible[i] = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
if err := eg.Wait(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
filteredUsers := make([]*libregraph.User, 0, len(users))
|
||||
for i, user := range users {
|
||||
if eligible[i] {
|
||||
filteredUsers = append(filteredUsers, user)
|
||||
}
|
||||
}
|
||||
return filteredUsers, nil
|
||||
return accounts, nil
|
||||
}
|
||||
|
||||
// roleGrantsVaultMode reports whether a role bundle carries the vault mode permission.
|
||||
|
||||
@@ -707,7 +707,6 @@ var _ = Describe("Users", func() {
|
||||
vaultLessRole = "ordinary-role-ID"
|
||||
eligibleUser = "25cb7bc0-3168-4a0c-adbe-396f478ad494"
|
||||
otherUser = "2713f1d5-6822-42bd-ad56-9f6c55a3a8fa"
|
||||
thirdUser = "3a6e6e0e-3f8b-4e3e-9f8b-1a2b3c4d5e6f"
|
||||
)
|
||||
|
||||
// expectRoles makes the settings service report both roles, only one of which
|
||||
@@ -739,32 +738,6 @@ var _ = Describe("Users", func() {
|
||||
}, nil)
|
||||
}
|
||||
|
||||
// expectAssignments stubs ListRoleAssignments (the per-account assignment lookup)
|
||||
// for a single account.
|
||||
expectAssignments := func(accountUUID string, assignments []*settingsmsg.UserRoleAssignment, err error) {
|
||||
roleService.On("ListRoleAssignments", mock.Anything, mock.MatchedBy(
|
||||
func(in *settings.ListRoleAssignmentsRequest) bool {
|
||||
return in.GetAccountUuid() == accountUUID
|
||||
}), mock.Anything).Return(&settings.ListRoleAssignmentsResponse{Assignments: assignments}, err)
|
||||
}
|
||||
|
||||
// requestVaultEligibleUsers builds a GetUsers request for filter, executes it against
|
||||
// svc, and unmarshals a successful response body into a userList. It fails the test
|
||||
// if the response isn't 200.
|
||||
requestVaultEligibleUsers := func(filter string) userList {
|
||||
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/users?$filter="+url.QueryEscape(filter), nil)
|
||||
r = r.WithContext(revactx.SetMFA(r.Context()))
|
||||
svc.GetUsers(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
res := userList{}
|
||||
Expect(json.Unmarshal(data, &res)).To(Succeed())
|
||||
return res
|
||||
}
|
||||
|
||||
BeforeEach(func() {
|
||||
permissionService.On("GetPermissionByID", mock.Anything, mock.Anything).Return(&settings.GetPermissionByIDResponse{
|
||||
Permission: &settingsmsg.Permission{
|
||||
@@ -783,63 +756,55 @@ var _ = Describe("Users", func() {
|
||||
DescribeTable("returns only the users assigned to a role that grants vault mode",
|
||||
func(filter string) {
|
||||
expectRoles()
|
||||
// Only the eligible user's own assignments hold the vault-granting role;
|
||||
// the other user holds a role that doesn't grant it.
|
||||
expectAssignments(eligibleUser, []*settingsmsg.UserRoleAssignment{
|
||||
{Id: "assignment-ID", AccountUuid: eligibleUser, RoleId: vaultRole},
|
||||
}, nil)
|
||||
expectAssignments(otherUser, []*settingsmsg.UserRoleAssignment{
|
||||
{Id: "other-assignment-ID", AccountUuid: otherUser, RoleId: vaultLessRole},
|
||||
// Only the assignments of the vault granting role may be asked for, and only
|
||||
// the eligible user holds one.
|
||||
roleService.On("ListRoleAssignmentsFiltered", mock.Anything, mock.MatchedBy(
|
||||
func(in *settings.ListRoleAssignmentsFilteredRequest) bool {
|
||||
return in.GetFilters()[0].GetRoleId() == vaultRole
|
||||
}), mock.Anything).Return(&settings.ListRoleAssignmentsResponse{
|
||||
Assignments: []*settingsmsg.UserRoleAssignment{
|
||||
{Id: "assignment-ID", AccountUuid: eligibleUser, RoleId: vaultRole},
|
||||
},
|
||||
}, nil)
|
||||
|
||||
res := requestVaultEligibleUsers(filter)
|
||||
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/users?$filter="+url.QueryEscape(filter), nil)
|
||||
r = r.WithContext(revactx.SetMFA(r.Context()))
|
||||
svc.GetUsers(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
res := userList{}
|
||||
Expect(json.Unmarshal(data, &res)).To(Succeed())
|
||||
Expect(res.Value).To(HaveLen(1))
|
||||
Expect(res.Value[0].GetId()).To(Equal(eligibleUser))
|
||||
|
||||
roleService.AssertNotCalled(GinkgoT(), "ListRoleAssignmentsFiltered", mock.Anything, mock.Anything, mock.Anything)
|
||||
},
|
||||
Entry("plain", "vaultEligible eq true"),
|
||||
Entry("parenthesized", "(vaultEligible eq true)"),
|
||||
)
|
||||
|
||||
It("drops a user with no role assignments at all, as a normal (non-error) outcome", func() {
|
||||
expectRoles()
|
||||
expectAssignments(eligibleUser, []*settingsmsg.UserRoleAssignment{
|
||||
{Id: "assignment-ID", AccountUuid: eligibleUser, RoleId: vaultRole},
|
||||
}, nil)
|
||||
expectAssignments(otherUser, nil, nil)
|
||||
|
||||
res := requestVaultEligibleUsers("vaultEligible eq true")
|
||||
Expect(res.Value).To(HaveLen(1))
|
||||
Expect(res.Value[0].GetId()).To(Equal(eligibleUser))
|
||||
})
|
||||
|
||||
It("returns nobody when no role grants vault mode, without listing anyone's assignments", func() {
|
||||
It("returns nobody when no role grants vault mode", func() {
|
||||
roleService.On("ListRoles", mock.Anything, mock.Anything, mock.Anything).Return(&settings.ListBundlesResponse{
|
||||
Bundles: []*settingsmsg.Bundle{{Id: vaultLessRole, Type: settingsmsg.Bundle_TYPE_ROLE}},
|
||||
}, nil)
|
||||
|
||||
res := requestVaultEligibleUsers("vaultEligible eq true")
|
||||
Expect(res.Value).To(BeEmpty())
|
||||
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/users?$filter="+url.QueryEscape("vaultEligible eq true"), nil)
|
||||
r = r.WithContext(revactx.SetMFA(r.Context()))
|
||||
svc.GetUsers(rr, r)
|
||||
|
||||
roleService.AssertNotCalled(GinkgoT(), "ListRoleAssignments", mock.Anything, mock.Anything, mock.Anything)
|
||||
roleService.AssertNotCalled(GinkgoT(), "ListRoleAssignmentsFiltered", mock.Anything, mock.Anything, mock.Anything)
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
res := userList{}
|
||||
Expect(json.Unmarshal(data, &res)).To(Succeed())
|
||||
Expect(res.Value).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("makes no calls to the role service when the directory search returns no users", func() {
|
||||
identityBackend.On("GetUsers", mock.Anything, mock.Anything).Unset()
|
||||
identityBackend.On("GetUsers", mock.Anything, mock.Anything).Return([]*libregraph.User{}, nil)
|
||||
|
||||
res := requestVaultEligibleUsers("vaultEligible eq true")
|
||||
Expect(res.Value).To(BeEmpty())
|
||||
|
||||
roleService.AssertNotCalled(GinkgoT(), "ListRoles", mock.Anything, mock.Anything, mock.Anything)
|
||||
roleService.AssertNotCalled(GinkgoT(), "ListRoleAssignments", mock.Anything, mock.Anything, mock.Anything)
|
||||
roleService.AssertNotCalled(GinkgoT(), "ListRoleAssignmentsFiltered", mock.Anything, mock.Anything, mock.Anything)
|
||||
})
|
||||
|
||||
It("fails the request when the role list cannot be fetched", func() {
|
||||
roleService.On("ListRoles", mock.Anything, mock.Anything, mock.Anything).
|
||||
It("fails the request when the role assignments cannot be listed", func() {
|
||||
expectRoles()
|
||||
roleService.On("ListRoleAssignmentsFiltered", mock.Anything, mock.Anything, mock.Anything).
|
||||
Return(nil, errors.New("settings service unavailable"))
|
||||
|
||||
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/users?$filter="+url.QueryEscape("vaultEligible eq true"), nil)
|
||||
@@ -849,71 +814,6 @@ var _ = Describe("Users", func() {
|
||||
Expect(rr.Code).ToNot(Equal(http.StatusOK))
|
||||
})
|
||||
|
||||
It("fails the request when a per-user role assignment check fails", func() {
|
||||
expectRoles()
|
||||
expectAssignments(eligibleUser, []*settingsmsg.UserRoleAssignment{
|
||||
{Id: "assignment-ID", AccountUuid: eligibleUser, RoleId: vaultRole},
|
||||
}, nil)
|
||||
expectAssignments(otherUser, nil, errors.New("settings service unavailable"))
|
||||
|
||||
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/users?$filter="+url.QueryEscape("vaultEligible eq true"), nil)
|
||||
r = r.WithContext(revactx.SetMFA(r.Context()))
|
||||
svc.GetUsers(rr, r)
|
||||
|
||||
Expect(rr.Code).ToNot(Equal(http.StatusOK))
|
||||
})
|
||||
|
||||
It("preserves the directory search's original order under concurrent completion, dropping a middle ineligible user", func() {
|
||||
identityBackend.On("GetUsers", mock.Anything, mock.Anything).Unset()
|
||||
first := &libregraph.User{}
|
||||
first.SetId(thirdUser)
|
||||
second := &libregraph.User{}
|
||||
second.SetId(eligibleUser)
|
||||
third := &libregraph.User{}
|
||||
third.SetId(otherUser)
|
||||
// Deliberately not alphabetical/sorted, so that a concurrency bug that
|
||||
// reorders results would be caught.
|
||||
identityBackend.On("GetUsers", mock.Anything, mock.Anything).Return([]*libregraph.User{first, second, third}, nil)
|
||||
|
||||
expectRoles()
|
||||
|
||||
// Force the first user's lookup to finish last: it blocks on lastDone, which the
|
||||
// last user's lookup closes only after it has already returned. Since SetLimit
|
||||
// is 10, all three per-user goroutines run concurrently (the middle and last
|
||||
// lookups aren't blocked waiting on the first), so this reliably makes completion
|
||||
// order (third, second, first) the reverse of directory order (first, second,
|
||||
// third) without any sleeps.
|
||||
lastDone := make(chan struct{})
|
||||
roleService.On("ListRoleAssignments", mock.Anything, mock.MatchedBy(
|
||||
func(in *settings.ListRoleAssignmentsRequest) bool {
|
||||
return in.GetAccountUuid() == thirdUser
|
||||
}), mock.Anything).Run(func(mock.Arguments) {
|
||||
<-lastDone
|
||||
}).Return(&settings.ListRoleAssignmentsResponse{Assignments: []*settingsmsg.UserRoleAssignment{
|
||||
{Id: "assignment-1", AccountUuid: thirdUser, RoleId: vaultRole},
|
||||
}}, nil)
|
||||
|
||||
// The middle user holds no vault-granting role, so it must be dropped from the
|
||||
// result rather than just reordered.
|
||||
expectAssignments(eligibleUser, []*settingsmsg.UserRoleAssignment{
|
||||
{Id: "assignment-2", AccountUuid: eligibleUser, RoleId: vaultLessRole},
|
||||
}, nil)
|
||||
|
||||
roleService.On("ListRoleAssignments", mock.Anything, mock.MatchedBy(
|
||||
func(in *settings.ListRoleAssignmentsRequest) bool {
|
||||
return in.GetAccountUuid() == otherUser
|
||||
}), mock.Anything).Run(func(mock.Arguments) {
|
||||
close(lastDone)
|
||||
}).Return(&settings.ListRoleAssignmentsResponse{Assignments: []*settingsmsg.UserRoleAssignment{
|
||||
{Id: "assignment-3", AccountUuid: otherUser, RoleId: vaultRole},
|
||||
}}, nil)
|
||||
|
||||
res := requestVaultEligibleUsers("vaultEligible eq true")
|
||||
Expect(res.Value).To(HaveLen(2))
|
||||
Expect(res.Value[0].GetId()).To(Equal(thirdUser))
|
||||
Expect(res.Value[1].GetId()).To(Equal(otherUser))
|
||||
})
|
||||
|
||||
DescribeTable("rejects everything but 'eq true'",
|
||||
func(filter string, status int) {
|
||||
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/users?$filter="+url.QueryEscape(filter), nil)
|
||||
@@ -931,10 +831,12 @@ var _ = Describe("Users", func() {
|
||||
// otherwise restricts unprivileged users to 'userType eq ...'.
|
||||
It("is allowed for an unprivileged user", func() {
|
||||
expectRoles()
|
||||
expectAssignments(eligibleUser, []*settingsmsg.UserRoleAssignment{
|
||||
{Id: "assignment-ID", AccountUuid: eligibleUser, RoleId: vaultRole},
|
||||
}, nil)
|
||||
expectAssignments(otherUser, nil, nil)
|
||||
roleService.On("ListRoleAssignmentsFiltered", mock.Anything, mock.Anything, mock.Anything).
|
||||
Return(&settings.ListRoleAssignmentsResponse{
|
||||
Assignments: []*settingsmsg.UserRoleAssignment{
|
||||
{Id: "assignment-ID", AccountUuid: eligibleUser, RoleId: vaultRole},
|
||||
},
|
||||
}, nil)
|
||||
permissionService.On("GetPermissionByID", mock.Anything, mock.Anything).Unset()
|
||||
permissionService.On("GetPermissionByID", mock.Anything, mock.Anything).
|
||||
Return(&settings.GetPermissionByIDResponse{}, nil)
|
||||
|
||||
@@ -59,13 +59,13 @@ func DefaultConfig() *config.Config {
|
||||
PoolSize: 5,
|
||||
PoolCheckoutTimeout: 30 * time.Second,
|
||||
UserSchema: config.LDAPUserSchema{
|
||||
ID: "ownCloudUUID",
|
||||
ID: "ownclouduuid",
|
||||
Mail: "mail",
|
||||
DisplayName: "displayName",
|
||||
DisplayName: "displayname",
|
||||
Username: "uid",
|
||||
},
|
||||
GroupSchema: config.LDAPGroupSchema{
|
||||
ID: "ownCloudUUID",
|
||||
ID: "ownclouduuid",
|
||||
Mail: "mail",
|
||||
DisplayName: "cn",
|
||||
Groupname: "cn",
|
||||
|
||||
@@ -210,7 +210,7 @@ func (b *CS3Backend) DestroySession(_ context.Context, sessionRef *string) error
|
||||
// for the user specified by the userID.
|
||||
func (b *CS3Backend) UserClaims(_ string, _ map[string]bool) map[string]interface{} {
|
||||
return nil
|
||||
// TODO should we return the "ownCloudUUID" as a claim? there is also "LibgreGraph.UUID" / lico.ScopeUniqueUserID
|
||||
// TODO should we return the "ownclouduuid" as a claim? there is also "LibgreGraph.UUID" / lico.ScopeUniqueUserID
|
||||
}
|
||||
|
||||
// ScopesSupported implements the Backend interface, providing supported scopes
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/broker"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/cors"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/registry"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/runner"
|
||||
ohttp "github.com/owncloud/ocis/v2/ocis-pkg/service/http"
|
||||
@@ -58,21 +57,13 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
if err := sharedconf.Decode(sc); err != nil {
|
||||
logger.Error().Err(err).Msg("error decoding shared config for ocdav")
|
||||
}
|
||||
|
||||
corsAllowCredentials := cfg.HTTP.CORS.AllowCredentials
|
||||
if corsAllowCredentials && cors.AllowsAnyOrigin(cfg.HTTP.CORS.AllowedOrigins) {
|
||||
logger.Warn().
|
||||
Strs("allowed_origins", cfg.HTTP.CORS.AllowedOrigins).
|
||||
Msg("cors: refusing to allow credentials together with a wildcard origin, disabling allow_credentials")
|
||||
corsAllowCredentials = false
|
||||
}
|
||||
opts := []ocdav.Option{
|
||||
ocdav.Name(cfg.HTTP.Namespace + "." + cfg.Service.Name),
|
||||
ocdav.Version(version.GetString()),
|
||||
ocdav.Context(ctx),
|
||||
ocdav.Logger(logger.Logger),
|
||||
ocdav.Address(cfg.HTTP.Addr),
|
||||
ocdav.AllowCredentials(corsAllowCredentials),
|
||||
ocdav.AllowCredentials(cfg.HTTP.CORS.AllowCredentials),
|
||||
ocdav.AllowedMethods(cfg.HTTP.CORS.AllowedMethods),
|
||||
ocdav.AllowedHeaders(cfg.HTTP.CORS.AllowedHeaders),
|
||||
ocdav.AllowedOrigins(cfg.HTTP.CORS.AllowedOrigins),
|
||||
|
||||
@@ -3,9 +3,7 @@ package revaconfig
|
||||
import (
|
||||
"math"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/cors"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/v2/services/ocm/pkg/config"
|
||||
)
|
||||
@@ -25,14 +23,6 @@ func OCMConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]inter
|
||||
providerDomain = u.Host
|
||||
}
|
||||
|
||||
corsAllowCredentials := cfg.HTTP.CORS.AllowCredentials
|
||||
if corsAllowCredentials && cors.AllowsAnyOrigin(cfg.HTTP.CORS.AllowedOrigins) {
|
||||
logger.Warn().
|
||||
Strs("allowed_origins", cfg.HTTP.CORS.AllowedOrigins).
|
||||
Msg("cors: refusing to allow credentials together with a wildcard origin, disabling allow_credentials")
|
||||
corsAllowCredentials = false
|
||||
}
|
||||
|
||||
return map[string]interface{}{
|
||||
"shared": map[string]interface{}{
|
||||
"jwt_secret": cfg.TokenManager.JWTSecret,
|
||||
@@ -47,7 +37,7 @@ func OCMConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]inter
|
||||
"allowed_origins": cfg.HTTP.CORS.AllowedOrigins,
|
||||
"allowed_methods": cfg.HTTP.CORS.AllowedMethods,
|
||||
"allowed_headers": cfg.HTTP.CORS.AllowedHeaders,
|
||||
"allow_credentials": corsAllowCredentials,
|
||||
"allow_credentials": cfg.HTTP.CORS.AllowCredentials,
|
||||
// currently unused
|
||||
//"options_passthrough": ,
|
||||
//"debug": ,
|
||||
@@ -101,9 +91,8 @@ func OCMConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]inter
|
||||
"service_account_secret": cfg.ServiceAccount.Secret,
|
||||
},
|
||||
"dataprovider": map[string]interface{}{
|
||||
"prefix": "data",
|
||||
"driver": "ocmreceived",
|
||||
"upload_directory": filepath.Join(cfg.OCMStorageProvider.StorageRoot, "uploads"),
|
||||
"prefix": "data",
|
||||
"driver": "ocmreceived",
|
||||
"drivers": map[string]interface{}{
|
||||
"ocmreceived": map[string]interface{}{
|
||||
"insecure": cfg.OCMStorageProvider.Insecure,
|
||||
@@ -192,8 +181,7 @@ func OCMConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]inter
|
||||
},
|
||||
},
|
||||
"storageprovider": map[string]interface{}{
|
||||
"driver": "ocmreceived",
|
||||
"upload_directory": filepath.Join(cfg.OCMStorageProvider.StorageRoot, "uploads"),
|
||||
"driver": "ocmreceived",
|
||||
"drivers": map[string]interface{}{
|
||||
"ocmreceived": map[string]interface{}{
|
||||
"insecure": cfg.OCMStorageProvider.Insecure,
|
||||
|
||||
@@ -18,21 +18,21 @@ type AppAuthAuthenticator struct {
|
||||
}
|
||||
|
||||
// Authenticate implements the authenticator interface to authenticate requests via app auth.
|
||||
func (m AppAuthAuthenticator) Authenticate(r *http.Request) (*http.Request, error) {
|
||||
func (m AppAuthAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) {
|
||||
if isPublicPath(r.URL.Path) {
|
||||
// The authentication of public path requests is handled by another authenticator.
|
||||
// Since we can't guarantee the order of execution of the authenticators, we better
|
||||
// implement an early return here for paths we can't authenticate in this authenticator.
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
username, password, ok := r.BasicAuth()
|
||||
if !ok {
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
next, err := m.RevaGatewaySelector.Next()
|
||||
if err != nil {
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
authenticateResponse, err := next.Authenticate(r.Context(), &gateway.AuthenticateRequest{
|
||||
@@ -41,11 +41,11 @@ func (m AppAuthAuthenticator) Authenticate(r *http.Request) (*http.Request, erro
|
||||
ClientSecret: password,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
if authenticateResponse.GetStatus().GetCode() != cs3rpc.Code_CODE_OK {
|
||||
// TODO: log???
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
r.Header.Set(revactx.TokenHeader, authenticateResponse.GetToken())
|
||||
@@ -60,5 +60,5 @@ func (m AppAuthAuthenticator) Authenticate(r *http.Request) (*http.Request, erro
|
||||
}
|
||||
r = r.WithContext(oidc.NewContext(r.Context(), claims))
|
||||
|
||||
return r, nil
|
||||
return r, true
|
||||
}
|
||||
@@ -62,9 +62,9 @@ var _ = Describe("Authenticating requests", Label("AppAuthAuthenticator"), func(
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody)
|
||||
req.SetBasicAuth("test-user", "AppPassword")
|
||||
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(valid).To(Equal(true))
|
||||
Expect(req2).ToNot(BeNil())
|
||||
Expect(req2.Header.Get("x-access-token")).To(Equal("reva-token"))
|
||||
|
||||
@@ -82,9 +82,9 @@ var _ = Describe("Authenticating requests", Label("AppAuthAuthenticator"), func(
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody)
|
||||
req.SetBasicAuth("test-user", "WrongAppPassword")
|
||||
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(valid).To(Equal(false))
|
||||
Expect(req2).To(BeNil())
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
|
||||
"github.com/owncloud/ocis/v2/services/proxy/pkg/router"
|
||||
"github.com/owncloud/ocis/v2/services/proxy/pkg/webdav"
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
// ErrAuthenticationFailed maps to an HTTP 401 challenge.
|
||||
var ErrAuthenticationFailed = errors.New("authentication failed")
|
||||
|
||||
var (
|
||||
// SupportedAuthStrategies stores configured challenges.
|
||||
SupportedAuthStrategies []string
|
||||
@@ -47,10 +42,10 @@ const (
|
||||
|
||||
// Authenticator is the common interface implemented by all request authenticators.
|
||||
type Authenticator interface {
|
||||
// Authenticate authenticates incoming HTTP requests, returning the augmented request.
|
||||
// nil error means authenticated; ErrAuthenticationFailed (or an unhandled request) maps
|
||||
// to 401; an error wrapping oidc.ErrTemporarilyUnavailable maps to a retryable 503.
|
||||
Authenticate(*http.Request) (*http.Request, error)
|
||||
// Authenticate is used to authenticate incoming HTTP requests.
|
||||
// The Authenticator may augment the request with user info or anything related to the
|
||||
// authentication and return the augmented request.
|
||||
Authenticate(*http.Request) (*http.Request, bool)
|
||||
}
|
||||
|
||||
// Authentication is a higher order authentication middleware.
|
||||
@@ -70,24 +65,12 @@ func Authentication(auths []Authenticator, opts ...Option) func(next http.Handle
|
||||
return
|
||||
}
|
||||
|
||||
var temporarilyUnavailable bool
|
||||
for _, a := range auths {
|
||||
req, err := a.Authenticate(r)
|
||||
if err == nil {
|
||||
if req, ok := a.Authenticate(r); ok {
|
||||
next.ServeHTTP(w, req)
|
||||
return
|
||||
}
|
||||
if errors.Is(err, oidc.ErrTemporarilyUnavailable) {
|
||||
temporarilyUnavailable = true
|
||||
}
|
||||
}
|
||||
|
||||
if temporarilyUnavailable {
|
||||
w.Header().Set("Retry-After", "3")
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
|
||||
if !isPublicPath(r.URL.Path) {
|
||||
// Failed basic authentication attempts receive the Www-Authenticate header in the response
|
||||
var touch bool
|
||||
|
||||
@@ -2,8 +2,6 @@ package middleware
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"time"
|
||||
@@ -216,127 +214,4 @@ var _ = Describe("Authenticating requests", Label("Authentication"), func() {
|
||||
Expect(rr).To(HaveHTTPStatus(http.StatusOK))
|
||||
})
|
||||
})
|
||||
|
||||
When("the userinfo call to the IdP times out", func() {
|
||||
It("returns a retryable status, not 401, for a transient backend failure", func() {
|
||||
logger := log.NewLogger()
|
||||
|
||||
timingOutClient := oidcmocks.OIDCClient{}
|
||||
timingOutClient.On("VerifyAccessToken", mock.Anything, mock.Anything).Return(
|
||||
oidc.RegClaimsWithSID{
|
||||
SessionID: "a-session-id",
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
ExpiresAt: jwt.NewNumericDate(time.Unix(1147483647, 0)),
|
||||
},
|
||||
}, jwt.MapClaims{
|
||||
"sid": "a-session-id",
|
||||
"exp": 1147483647,
|
||||
},
|
||||
nil,
|
||||
)
|
||||
// what the oidc client returns for a userinfo timeout
|
||||
timingOutClient.On("UserInfo", mock.Anything, mock.Anything).Return(
|
||||
(*oidc.UserInfo)(nil),
|
||||
errors.Join(oidc.ErrTemporarilyUnavailable,
|
||||
fmt.Errorf("Get \"http://idp.example.com/userinfo\": %w", context.DeadlineExceeded)),
|
||||
)
|
||||
|
||||
authenticators := []Authenticator{
|
||||
&OIDCAuthenticator{
|
||||
OIDCIss: "http://idp.example.com",
|
||||
Logger: logger,
|
||||
oidcClient: &timingOutClient,
|
||||
userInfoCache: store.NewMemoryStore(),
|
||||
skipUserInfo: false,
|
||||
},
|
||||
}
|
||||
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/graph/v1.0/me/drives", http.NoBody)
|
||||
req = req.WithContext(router.SetRoutingInfo(context.Background(), router.RoutingInfo{}))
|
||||
req.Header.Set(_headerAuthorization, "Bearer jwt.token.sig")
|
||||
|
||||
handler := Authentication(authenticators,
|
||||
EnableBasicAuth(false),
|
||||
)
|
||||
testHandler := handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
Fail("next handler must not be reached when userinfo times out")
|
||||
}))
|
||||
rr := httptest.NewRecorder()
|
||||
testHandler.ServeHTTP(rr, req)
|
||||
|
||||
Expect(rr).To(HaveHTTPStatus(http.StatusServiceUnavailable))
|
||||
})
|
||||
|
||||
It("still returns 401 when userinfo fails without a transient signal", func() {
|
||||
logger := log.NewLogger()
|
||||
|
||||
failingClient := oidcmocks.OIDCClient{}
|
||||
failingClient.On("VerifyAccessToken", mock.Anything, mock.Anything).Return(
|
||||
oidc.RegClaimsWithSID{
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
ExpiresAt: jwt.NewNumericDate(time.Unix(1147483647, 0)),
|
||||
},
|
||||
}, jwt.MapClaims{"exp": 1147483647}, nil,
|
||||
)
|
||||
failingClient.On("UserInfo", mock.Anything, mock.Anything).Return(
|
||||
(*oidc.UserInfo)(nil),
|
||||
fmt.Errorf("401 Unauthorized: token revoked"),
|
||||
)
|
||||
|
||||
authenticators := []Authenticator{
|
||||
&OIDCAuthenticator{
|
||||
OIDCIss: "http://idp.example.com",
|
||||
Logger: logger,
|
||||
oidcClient: &failingClient,
|
||||
userInfoCache: store.NewMemoryStore(),
|
||||
skipUserInfo: false,
|
||||
},
|
||||
}
|
||||
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/graph/v1.0/me/drives", http.NoBody)
|
||||
req = req.WithContext(router.SetRoutingInfo(context.Background(), router.RoutingInfo{}))
|
||||
req.Header.Set(_headerAuthorization, "Bearer jwt.token.sig")
|
||||
|
||||
handler := Authentication(authenticators, EnableBasicAuth(false))
|
||||
testHandler := handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
Fail("next handler must not be reached for a failed authentication")
|
||||
}))
|
||||
rr := httptest.NewRecorder()
|
||||
testHandler.ServeHTTP(rr, req)
|
||||
|
||||
Expect(rr).To(HaveHTTPStatus(http.StatusUnauthorized))
|
||||
})
|
||||
|
||||
It("returns 401 for an invalid/malformed token", func() {
|
||||
logger := log.NewLogger()
|
||||
|
||||
invalidTokenClient := oidcmocks.OIDCClient{}
|
||||
invalidTokenClient.On("VerifyAccessToken", mock.Anything, mock.Anything).Return(
|
||||
oidc.RegClaimsWithSID{}, jwt.MapClaims{}, jwt.ErrTokenMalformed,
|
||||
)
|
||||
|
||||
authenticators := []Authenticator{
|
||||
&OIDCAuthenticator{
|
||||
OIDCIss: "http://idp.example.com",
|
||||
Logger: logger,
|
||||
oidcClient: &invalidTokenClient,
|
||||
userInfoCache: store.NewMemoryStore(),
|
||||
skipUserInfo: true,
|
||||
},
|
||||
}
|
||||
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/graph/v1.0/me/drives", http.NoBody)
|
||||
req = req.WithContext(router.SetRoutingInfo(context.Background(), router.RoutingInfo{}))
|
||||
req.Header.Set(_headerAuthorization, "Bearer invalid.token.sig")
|
||||
|
||||
handler := Authentication(authenticators, EnableBasicAuth(false))
|
||||
testHandler := handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
Fail("next handler must not be reached for an invalid token")
|
||||
}))
|
||||
rr := httptest.NewRecorder()
|
||||
testHandler.ServeHTTP(rr, req)
|
||||
|
||||
Expect(rr).To(HaveHTTPStatus(http.StatusUnauthorized))
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -17,17 +17,17 @@ type BasicAuthenticator struct {
|
||||
}
|
||||
|
||||
// Authenticate implements the authenticator interface to authenticate requests via basic auth.
|
||||
func (m BasicAuthenticator) Authenticate(r *http.Request) (*http.Request, error) {
|
||||
func (m BasicAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) {
|
||||
if isPublicPath(r.URL.Path) && isPublicWithShareToken(r) {
|
||||
// The authentication of public path requests is handled by another authenticator.
|
||||
// Since we can't guarantee the order of execution of the authenticators, we better
|
||||
// implement an early return here for paths we can't authenticate in this authenticator.
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
login, password, ok := r.BasicAuth()
|
||||
if !ok {
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
user, _, err := m.UserProvider.Authenticate(r.Context(), login, password)
|
||||
@@ -37,7 +37,7 @@ func (m BasicAuthenticator) Authenticate(r *http.Request) (*http.Request, error)
|
||||
Str("authenticator", "basic").
|
||||
Str("path", r.URL.Path).
|
||||
Msg("failed to authenticate request")
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// fake oidc claims
|
||||
@@ -58,5 +58,5 @@ func (m BasicAuthenticator) Authenticate(r *http.Request) (*http.Request, error)
|
||||
Str("authenticator", "basic").
|
||||
Str("path", r.URL.Path).
|
||||
Msg("successfully authenticated request")
|
||||
return r.WithContext(oidc.NewContext(r.Context(), claims)), nil
|
||||
return r.WithContext(oidc.NewContext(r.Context(), claims)), true
|
||||
}
|
||||
@@ -44,17 +44,17 @@ var _ = Describe("Authenticating requests", Label("BasicAuthenticator"), func()
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody)
|
||||
req.SetBasicAuth("testuser", "testpassword")
|
||||
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(valid).To(Equal(true))
|
||||
Expect(req2).ToNot(BeNil())
|
||||
})
|
||||
It("adds claims to the request context", func() {
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody)
|
||||
req.SetBasicAuth("testuser", "testpassword")
|
||||
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
Expect(valid).To(Equal(true))
|
||||
|
||||
claims := oidc.FromContext(req2.Context())
|
||||
Expect(claims).ToNot(BeNil())
|
||||
|
||||
@@ -178,17 +178,17 @@ func (m OIDCAuthenticator) shouldServe(req *http.Request) bool {
|
||||
}
|
||||
|
||||
// Authenticate implements the authenticator interface to authenticate requests via oidc auth.
|
||||
func (m *OIDCAuthenticator) Authenticate(r *http.Request) (*http.Request, error) {
|
||||
func (m *OIDCAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) {
|
||||
// there is no bearer token on the request,
|
||||
if !m.shouldServe(r) {
|
||||
// The authentication of public path requests is handled by another authenticator.
|
||||
// Since we can't guarantee the order of execution of the authenticators, we better
|
||||
// implement an early return here for paths we can't authenticate in this authenticator.
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
token := strings.TrimPrefix(r.Header.Get(_headerAuthorization), _bearerPrefix)
|
||||
if token == "" {
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
claims, newSession, err := m.getClaims(token, r)
|
||||
@@ -203,10 +203,7 @@ func (m *OIDCAuthenticator) Authenticate(r *http.Request) (*http.Request, error)
|
||||
Str("network.peer.address", host).
|
||||
Str("network.peer.port", port).
|
||||
Msg("failed to authenticate the request")
|
||||
if errors.Is(err, oidc.ErrTemporarilyUnavailable) {
|
||||
return nil, err
|
||||
}
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
m.Logger.Debug().
|
||||
Str("authenticator", "oidc").
|
||||
@@ -218,5 +215,5 @@ func (m *OIDCAuthenticator) Authenticate(r *http.Request) (*http.Request, error)
|
||||
ctx = oidc.NewContextSessionFlag(ctx, true)
|
||||
}
|
||||
|
||||
return r.WithContext(oidc.NewContext(ctx, claims)), nil
|
||||
return r.WithContext(oidc.NewContext(ctx, claims)), true
|
||||
}
|
||||
@@ -70,18 +70,18 @@ var _ = Describe("Authenticating requests", Label("OIDCAuthenticator"), func() {
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody)
|
||||
req.Header.Set(_headerAuthorization, "Bearer jwt.token.sig")
|
||||
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(valid).To(Equal(true))
|
||||
Expect(req2).ToNot(BeNil())
|
||||
})
|
||||
It("should successfully authenticate", func() {
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/dav/public-files", http.NoBody)
|
||||
req.Header.Set(_headerAuthorization, "Bearer jwt.token.sig")
|
||||
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(valid).To(Equal(true))
|
||||
Expect(req2).ToNot(BeNil())
|
||||
})
|
||||
It("should skip authenticate if the header ShareToken is set", func() {
|
||||
@@ -89,24 +89,24 @@ var _ = Describe("Authenticating requests", Label("OIDCAuthenticator"), func() {
|
||||
req.Header.Set(_headerAuthorization, "Bearer jwt.token.sig")
|
||||
req.Header.Set(headerShareToken, "sharetoken")
|
||||
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
// TODO Should the authentication of public path requests is handled by another authenticator?
|
||||
//Expect(err).To(HaveOccurred())
|
||||
//Expect(valid).To(Equal(false))
|
||||
//Expect(req2).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(valid).To(Equal(true))
|
||||
Expect(req2).ToNot(BeNil())
|
||||
})
|
||||
It("should skip authenticate if the 'public-token' is set", func() {
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/dav/public-files/?public-token=sharetoken", http.NoBody)
|
||||
req.Header.Set(_headerAuthorization, "Bearer jwt.token.sig")
|
||||
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
// TODO Should the authentication of public path requests is handled by another authenticator?
|
||||
//Expect(err).To(HaveOccurred())
|
||||
//Expect(valid).To(Equal(false))
|
||||
//Expect(req2).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(valid).To(Equal(true))
|
||||
Expect(req2).ToNot(BeNil())
|
||||
})
|
||||
})
|
||||
|
||||
@@ -57,9 +57,9 @@ func isPublicWithShareToken(r *http.Request) bool {
|
||||
}
|
||||
|
||||
// Authenticate implements the authenticator interface to authenticate requests via public share auth.
|
||||
func (a PublicShareAuthenticator) Authenticate(r *http.Request) (*http.Request, error) {
|
||||
func (a PublicShareAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) {
|
||||
if !isPublicPath(r.URL.Path) && !isPublicShareArchive(r) && !isPublicShareAppOpen(r) {
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
query := r.URL.Query()
|
||||
@@ -71,7 +71,7 @@ func (a PublicShareAuthenticator) Authenticate(r *http.Request) (*http.Request,
|
||||
if shareToken == "" {
|
||||
// If the share token is not set then we don't need to inject the user to
|
||||
// the request context so we can just continue with the request.
|
||||
return r, nil
|
||||
return r, true
|
||||
}
|
||||
|
||||
var sharePassword string
|
||||
@@ -81,7 +81,7 @@ func (a PublicShareAuthenticator) Authenticate(r *http.Request) (*http.Request,
|
||||
expiration := query.Get(_paramExpiration)
|
||||
if expiration == "" {
|
||||
a.Logger.Warn().Str("signature", signature).Msg("cannot do signature auth without the expiration")
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
sharePassword = strings.Join([]string{"signature", signature, expiration}, "|")
|
||||
} else {
|
||||
@@ -102,7 +102,7 @@ func (a PublicShareAuthenticator) Authenticate(r *http.Request) (*http.Request,
|
||||
Str("public_share_token", shareToken).
|
||||
Str("path", r.URL.Path).
|
||||
Msg("could not select next gateway client")
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// The brute force protection counts failed public link password attempts.
|
||||
@@ -129,7 +129,7 @@ func (a PublicShareAuthenticator) Authenticate(r *http.Request) (*http.Request,
|
||||
Str("public_share_token", shareToken).
|
||||
Str("path", r.URL.Path).
|
||||
Msg("failed to authenticate request")
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
r.Header.Add(_headerRevaAccessToken, authResp.Token)
|
||||
@@ -138,5 +138,5 @@ func (a PublicShareAuthenticator) Authenticate(r *http.Request) (*http.Request,
|
||||
Str("authenticator", "public_share").
|
||||
Str("path", r.URL.Path).
|
||||
Msg("successfully authenticated request")
|
||||
return r, nil
|
||||
return r, true
|
||||
}
|
||||
@@ -63,9 +63,9 @@ var _ = Describe("Authenticating requests", Label("PublicShareAuthenticator"), f
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/dav/public-files/?public-token=sharetoken", http.NoBody)
|
||||
req.SetBasicAuth("public", "examples3cr3t")
|
||||
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(valid).To(Equal(true))
|
||||
Expect(req2).ToNot(BeNil())
|
||||
|
||||
h := req2.Header
|
||||
@@ -76,9 +76,9 @@ var _ = Describe("Authenticating requests", Label("PublicShareAuthenticator"), f
|
||||
It("should successfully authenticate", func() {
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/dav/public-files/?public-token=sharetoken&signature=examplesignature&expiration=exampleexpiration", http.NoBody)
|
||||
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(valid).To(Equal(true))
|
||||
Expect(req2).ToNot(BeNil())
|
||||
|
||||
h := req2.Header
|
||||
@@ -90,9 +90,9 @@ var _ = Describe("Authenticating requests", Label("PublicShareAuthenticator"), f
|
||||
Context("using a public-token", func() {
|
||||
It("should successfully authenticate", func() {
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/archiver?public-token=sharetoken", http.NoBody)
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(valid).To(Equal(true))
|
||||
Expect(req2).ToNot(BeNil())
|
||||
|
||||
h := req2.Header
|
||||
@@ -102,9 +102,9 @@ var _ = Describe("Authenticating requests", Label("PublicShareAuthenticator"), f
|
||||
Context("not using a public-token", func() {
|
||||
It("should fail to authenticate", func() {
|
||||
req := httptest.NewRequest(http.MethodGet, "http://example.com/archiver", http.NoBody)
|
||||
req2, err := authenticator.Authenticate(req)
|
||||
req2, valid := authenticator.Authenticate(req)
|
||||
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(valid).To(Equal(false))
|
||||
Expect(req2).To(BeNil())
|
||||
})
|
||||
})
|
||||
|
||||
@@ -219,9 +219,9 @@ func (m SignedURLAuthenticator) createSignature(url string, signingKey []byte) s
|
||||
}
|
||||
|
||||
// Authenticate implements the authenticator interface to authenticate requests via signed URL auth.
|
||||
func (m SignedURLAuthenticator) Authenticate(r *http.Request) (*http.Request, error) {
|
||||
func (m SignedURLAuthenticator) Authenticate(r *http.Request) (*http.Request, bool) {
|
||||
if !m.shouldServe(r) {
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
user, _, err := m.UserProvider.GetUserByClaims(r.Context(), "username", r.URL.Query().Get(_paramOCCredential))
|
||||
@@ -231,7 +231,7 @@ func (m SignedURLAuthenticator) Authenticate(r *http.Request) (*http.Request, er
|
||||
Str("authenticator", "signed_url").
|
||||
Str("path", r.URL.Path).
|
||||
Msg("Could not get user by claim")
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
user, err = m.UserRoleAssigner.ApplyUserRole(r.Context(), user)
|
||||
@@ -241,7 +241,7 @@ func (m SignedURLAuthenticator) Authenticate(r *http.Request) (*http.Request, er
|
||||
Str("authenticator", "signed_url").
|
||||
Str("path", r.URL.Path).
|
||||
Msg("Could not get user by claim")
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
ctx := revactx.ContextSetUser(r.Context(), user)
|
||||
@@ -255,7 +255,7 @@ func (m SignedURLAuthenticator) Authenticate(r *http.Request) (*http.Request, er
|
||||
Str("path", r.URL.Path).
|
||||
Str("url", r.URL.String()).
|
||||
Msg("Could not get user by claim")
|
||||
return nil, ErrAuthenticationFailed
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// TODO: set user in context
|
||||
@@ -263,5 +263,5 @@ func (m SignedURLAuthenticator) Authenticate(r *http.Request) (*http.Request, er
|
||||
Str("authenticator", "signed_url").
|
||||
Str("path", r.URL.Path).
|
||||
Msg("successfully authenticated request")
|
||||
return r, nil
|
||||
return r, true
|
||||
}
|
||||
@@ -5,19 +5,12 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/cors"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/generators"
|
||||
"github.com/owncloud/ocis/v2/services/storage-users/pkg/config"
|
||||
)
|
||||
|
||||
// StorageUsersConfigFromStruct will adapt an oCIS config struct into a reva mapstructure to start a reva service.
|
||||
func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
// Credentials must not be combined with a wildcard origin.
|
||||
corsAllowCredentials := cfg.HTTP.CORS.AllowCredentials
|
||||
if corsAllowCredentials && cors.AllowsAnyOrigin(cfg.HTTP.CORS.AllowedOrigins) {
|
||||
corsAllowCredentials = false
|
||||
}
|
||||
|
||||
rcfg := map[string]interface{}{
|
||||
"core": map[string]interface{}{
|
||||
"graceful_shutdown_timeout": cfg.GracefulShutdownTimeout,
|
||||
@@ -87,7 +80,6 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
"prefix": cfg.HTTP.Prefix,
|
||||
"driver": cfg.Driver,
|
||||
"drivers": DataProviderDrivers(cfg),
|
||||
"mount_id": cfg.MountID,
|
||||
"nats_address": cfg.Events.Addr,
|
||||
"nats_clusterID": cfg.Events.ClusterID,
|
||||
"nats_tls_insecure": cfg.Events.TLSInsecure,
|
||||
@@ -113,7 +105,7 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
"cors_enabled": true,
|
||||
// allow_origin is configured as a regex in tusd, so we concatenate the configured values into a regex
|
||||
"cors_allow_origin": "(" + strings.ReplaceAll(strings.Join(cfg.HTTP.CORS.AllowedOrigins, "|"), "*", ".*") + ")",
|
||||
"cors_allow_credentials": corsAllowCredentials,
|
||||
"cors_allow_credentials": cfg.HTTP.CORS.AllowCredentials,
|
||||
"cors_allow_methods": strings.Join(cfg.HTTP.CORS.AllowedMethods, ","),
|
||||
"cors_allow_headers": strings.Join(cfg.HTTP.CORS.AllowedHeaders, ","),
|
||||
"cors_max_age": strconv.FormatUint(uint64(cfg.HTTP.CORS.MaxAge), 10),
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/image/bmp"
|
||||
"golang.org/x/image/font"
|
||||
"golang.org/x/image/font/opentype"
|
||||
"golang.org/x/image/math/fixed"
|
||||
@@ -179,19 +178,6 @@ Scan: // Label for the scanner loop, so we can break it easily
|
||||
return img, scanner.Err()
|
||||
}
|
||||
|
||||
// BmpDecoder is a converter for bmp files. BMP bytes must not go through
|
||||
// libvips, which loads them via ImageMagick, missing on minimal runtimes.
|
||||
type BmpDecoder struct{}
|
||||
|
||||
// Convert reads the bmp file and returns the decoded image
|
||||
func (b BmpDecoder) Convert(r io.Reader) (interface{}, error) {
|
||||
img, err := bmp.Decode(r)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, `could not decode the bmp image`)
|
||||
}
|
||||
return img, nil
|
||||
}
|
||||
|
||||
// GGPStruct is the layout of a ggp file (which is basically json)
|
||||
type GGPStruct struct {
|
||||
Sections []struct {
|
||||
@@ -335,10 +321,6 @@ func ForType(mimeType string, opts map[string]interface{}) FileConverter {
|
||||
fallthrough
|
||||
case "audio/ogg":
|
||||
return AudioDecoder{}
|
||||
case "image/bmp":
|
||||
fallthrough
|
||||
case "image/x-ms-bmp":
|
||||
return BmpDecoder{}
|
||||
default:
|
||||
return ImageDecoder{}
|
||||
}
|
||||
|
||||
@@ -151,25 +151,6 @@ var _ = Describe("ImageDecoder", func() {
|
||||
})
|
||||
})
|
||||
|
||||
Describe("should decode bmp", func() {
|
||||
It("should decode a bmp", func() {
|
||||
fileContent, err := os.ReadFile("test_assets/bmp_test.bmp")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
decoder := BmpDecoder{}
|
||||
img, err := decoder.Convert(bytes.NewReader(fileContent))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(img).ToNot(BeNil())
|
||||
})
|
||||
It("should return an error if the bmp is invalid", func() {
|
||||
decoder := BmpDecoder{}
|
||||
img, err := decoder.Convert(bytes.NewReader([]byte("not a bmp")))
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(img).To(BeNil())
|
||||
})
|
||||
})
|
||||
|
||||
Describe("test ForType", func() {
|
||||
It("should return an ImageDecoder for image types", func() {
|
||||
decoder := ForType("image/png", nil)
|
||||
@@ -197,16 +178,6 @@ var _ = Describe("ImageDecoder", func() {
|
||||
Expect(decoder).To(BeAssignableToTypeOf(TxtToImageConverter{}))
|
||||
})
|
||||
|
||||
It("should return a BmpDecoder for bmp types", func() {
|
||||
decoder := ForType("image/bmp", nil)
|
||||
Expect(decoder).To(BeAssignableToTypeOf(BmpDecoder{}))
|
||||
})
|
||||
|
||||
It("should return a BmpDecoder for x-ms-bmp types", func() {
|
||||
decoder := ForType("image/x-ms-bmp", nil)
|
||||
Expect(decoder).To(BeAssignableToTypeOf(BmpDecoder{}))
|
||||
})
|
||||
|
||||
It("should return an ImageDecoder for unknown types", func() {
|
||||
decoder := ForType("unknown", nil)
|
||||
Expect(decoder).To(BeAssignableToTypeOf(ImageDecoder{}))
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -3,11 +3,13 @@
|
||||
package thumbnail
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"image"
|
||||
"strings"
|
||||
|
||||
"github.com/davidbyttow/govips/v2/vips"
|
||||
"github.com/owncloud/ocis/v2/services/thumbnails/pkg/errors"
|
||||
"golang.org/x/image/bmp"
|
||||
)
|
||||
|
||||
// SimpleGenerator is the default image generator and is used for all image types expect gif.
|
||||
@@ -40,10 +42,13 @@ func (g SimpleGenerator) Generate(size image.Rectangle, img interface{}) (interf
|
||||
var m *vips.ImageRef
|
||||
var err error
|
||||
switch img.(type) {
|
||||
case image.Image:
|
||||
// Direct import: encoded BMP bytes need the ImageMagick loader,
|
||||
// missing on minimal runtimes. Covers the txt render and BMP sources.
|
||||
m, err = vips.NewImageFromGoImage(img.(image.Image))
|
||||
case *image.RGBA:
|
||||
// This comes from the txt preprocessor
|
||||
var buf bytes.Buffer
|
||||
if err = bmp.Encode(&buf, img.(*image.RGBA)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m, err = vips.NewImageFromReader(&buf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -67,8 +72,8 @@ func (g SimpleGenerator) Generate(size image.Rectangle, img interface{}) (interf
|
||||
|
||||
func (g SimpleGenerator) Dimensions(img interface{}) (image.Rectangle, error) {
|
||||
switch img.(type) {
|
||||
case image.Image:
|
||||
m := img.(image.Image)
|
||||
case *image.RGBA:
|
||||
m := img.(*image.RGBA)
|
||||
return m.Bounds(), nil
|
||||
case *vips.ImageRef:
|
||||
m := img.(*vips.ImageRef)
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
//go:build enable_vips
|
||||
|
||||
package thumbnail
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"image"
|
||||
"image/draw"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/davidbyttow/govips/v2/vips"
|
||||
"github.com/owncloud/ocis/v2/services/thumbnails/pkg/preprocessor"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/image/bmp"
|
||||
)
|
||||
|
||||
// Start vips once for the package.
|
||||
func TestMain(m *testing.M) {
|
||||
if err := vips.Startup(nil); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
// Guards the txt-preview path: the preprocessor hands us *image.RGBA and the
|
||||
// vips generator must import it without any encoded round-trip (BMP bytes
|
||||
// need the ImageMagick loader, absent from minimal libvips runtimes).
|
||||
func TestSimpleGenerator_TxtRGBA(t *testing.T) {
|
||||
src := image.NewRGBA(image.Rect(0, 0, 640, 480))
|
||||
draw.Draw(src, src.Bounds(), image.White, image.Point{}, draw.Src)
|
||||
|
||||
gen, err := NewSimpleGenerator("png", "fit")
|
||||
require.NoError(t, err)
|
||||
|
||||
dims, err := gen.Dimensions(src)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, image.Rect(0, 0, 640, 480), dims)
|
||||
|
||||
got, err := gen.Generate(image.Rect(0, 0, 32, 32), src)
|
||||
require.NoError(t, err)
|
||||
m, ok := got.(*vips.ImageRef)
|
||||
require.True(t, ok, "expected *vips.ImageRef, got %T", got)
|
||||
require.Equal(t, 32, m.Width())
|
||||
|
||||
var pngBuf bytes.Buffer
|
||||
require.NoError(t, PngEncoder{}.Encode(&pngBuf, m))
|
||||
require.NotEmpty(t, pngBuf.Bytes())
|
||||
|
||||
var jpgBuf bytes.Buffer
|
||||
require.NoError(t, JpegEncoder{}.Encode(&jpgBuf, m))
|
||||
require.NotEmpty(t, jpgBuf.Bytes())
|
||||
}
|
||||
|
||||
// Guards BMP sources: decoded in Go by BmpDecoder, imported without the
|
||||
// magick loader that minimal libvips runtimes lack.
|
||||
func TestSimpleGenerator_BmpSource(t *testing.T) {
|
||||
src := image.NewRGBA(image.Rect(0, 0, 32, 32))
|
||||
draw.Draw(src, src.Bounds(), image.White, image.Point{}, draw.Src)
|
||||
|
||||
var buf bytes.Buffer
|
||||
require.NoError(t, bmp.Encode(&buf, src))
|
||||
|
||||
img, err := preprocessor.ForType("image/bmp", nil).Convert(&buf)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, img)
|
||||
|
||||
gen, err := NewSimpleGenerator("jpg", "fit")
|
||||
require.NoError(t, err)
|
||||
|
||||
dims, err := gen.Dimensions(img)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, image.Rect(0, 0, 32, 32), dims)
|
||||
|
||||
got, err := gen.Generate(image.Rect(0, 0, 32, 32), img)
|
||||
require.NoError(t, err)
|
||||
m, ok := got.(*vips.ImageRef)
|
||||
require.True(t, ok, "expected *vips.ImageRef, got %T", got)
|
||||
require.Equal(t, 32, m.Width())
|
||||
|
||||
var pngBuf bytes.Buffer
|
||||
require.NoError(t, PngEncoder{}.Encode(&pngBuf, m))
|
||||
require.NotEmpty(t, pngBuf.Bytes())
|
||||
|
||||
var jpgBuf bytes.Buffer
|
||||
require.NoError(t, JpegEncoder{}.Encode(&jpgBuf, m))
|
||||
require.NotEmpty(t, jpgBuf.Bytes())
|
||||
}
|
||||
@@ -62,14 +62,14 @@ func DefaultConfig() *config.Config {
|
||||
PoolSize: 5,
|
||||
PoolCheckoutTimeout: 30 * time.Second,
|
||||
UserSchema: config.LDAPUserSchema{
|
||||
ID: "ownCloudUUID",
|
||||
ID: "ownclouduuid",
|
||||
Mail: "mail",
|
||||
DisplayName: "displayName",
|
||||
DisplayName: "displayname",
|
||||
Username: "uid",
|
||||
Enabled: "ownCloudUserEnabled",
|
||||
},
|
||||
GroupSchema: config.LDAPGroupSchema{
|
||||
ID: "ownCloudUUID",
|
||||
ID: "ownclouduuid",
|
||||
Mail: "mail",
|
||||
DisplayName: "cn",
|
||||
Groupname: "cn",
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
"swatch-danger-contrast": "#ffffff",
|
||||
"swatch-danger-default": "rgb(197, 48, 48)",
|
||||
"swatch-danger-hover": "#b12b2b",
|
||||
"swatch-danger-muted": "rgb(180, 90, 90)",
|
||||
"swatch-danger-muted": "rgb(204, 117, 117)",
|
||||
"swatch-inverse-default": "#ffffff",
|
||||
"swatch-inverse-hover": "#ffffff",
|
||||
"swatch-inverse-muted": "#bfbfbf",
|
||||
@@ -197,7 +197,7 @@
|
||||
"swatch-danger-contrast": "#ffffff",
|
||||
"swatch-danger-default": "rgb(197, 48, 48)",
|
||||
"swatch-danger-hover": "#b12b2b",
|
||||
"swatch-danger-muted": "rgb(180, 90, 90)",
|
||||
"swatch-danger-muted": "rgb(204, 117, 117)",
|
||||
"swatch-inverse-default": "#000000",
|
||||
"swatch-inverse-hover": "#555555",
|
||||
"swatch-inverse-muted": "#bfbfbf",
|
||||
@@ -508,8 +508,8 @@
|
||||
"swatch-danger-contrast": "#ffffff",
|
||||
"swatch-danger-default": "rgb(197, 48, 48)",
|
||||
"swatch-danger-hover": "#b12b2b",
|
||||
"swatch-danger-muted": "rgb(180, 90, 90)",
|
||||
"swatch-inverse-default": "#000000",
|
||||
"swatch-danger-muted": "rgb(204, 117, 117)",
|
||||
"swatch-inverse-default": "#ffffff",
|
||||
"swatch-inverse-hover": "#ffffff",
|
||||
"swatch-inverse-muted": "#bfbfbf",
|
||||
"swatch-passive-default": "#000000",
|
||||
@@ -611,7 +611,7 @@
|
||||
"swatch-danger-contrast": "#ffffff",
|
||||
"swatch-danger-default": "rgb(197, 48, 48)",
|
||||
"swatch-danger-hover": "#b12b2b",
|
||||
"swatch-danger-muted": "rgb(180, 90, 90)",
|
||||
"swatch-danger-muted": "rgb(204, 117, 117)",
|
||||
"swatch-inverse-default": "#000000",
|
||||
"swatch-inverse-hover": "#555555",
|
||||
"swatch-inverse-muted": "#bfbfbf",
|
||||
@@ -716,8 +716,8 @@
|
||||
"swatch-inverse-hover": "",
|
||||
"swatch-inverse-muted": "#696969",
|
||||
"swatch-passive-default": "#F0AA39",
|
||||
"swatch-passive-hover": "#D49B35",
|
||||
"swatch-passive-hover-outline": "#D49B35",
|
||||
"swatch-passive-hover": "#CA912B",
|
||||
"swatch-passive-hover-outline": "#CA912B",
|
||||
"swatch-passive-muted": "#bdbfc3",
|
||||
"swatch-passive-contrast": "#000000",
|
||||
"swatch-primary-default": "#F0AA39",
|
||||
@@ -821,7 +821,7 @@
|
||||
"swatch-brand-default": "#F0AA39",
|
||||
"swatch-brand-hover": "#CA912B",
|
||||
"swatch-brand-contrast": "#000000",
|
||||
"swatch-inverse-default": "#000000",
|
||||
"swatch-inverse-default": "",
|
||||
"swatch-inverse-hover": "",
|
||||
"swatch-inverse-muted": "#f8f8f8",
|
||||
"swatch-passive-default": "#ffffff",
|
||||
|
||||
@@ -204,10 +204,6 @@ class HttpRequestHelper {
|
||||
* @param int|null $timeout
|
||||
* @param Client|null $client
|
||||
* @param bool|null $isGivenStep
|
||||
* @param bool $retryOn5xxForK8s Set to false when the caller already has its own
|
||||
* retry-on-5xx loop (e.g. SearchContext::searchWithRetry),
|
||||
* so this generic layer doesn't redundantly burn extra
|
||||
* time retrying inside every one of the caller's attempts.
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*
|
||||
@@ -227,7 +223,6 @@ class HttpRequestHelper {
|
||||
?int $timeout = 0,
|
||||
?Client $client = null,
|
||||
?bool $isGivenStep = false,
|
||||
bool $retryOn5xxForK8s = true,
|
||||
): ResponseInterface {
|
||||
if ((\getenv('DEBUG_ACCEPTANCE_RESPONSES') !== false) || (\getenv('DEBUG_ACCEPTANCE_API_CALLS') !== false)) {
|
||||
$debugResponses = true;
|
||||
@@ -275,7 +270,7 @@ class HttpRequestHelper {
|
||||
$loopAgain = !$sendExceptionHappened && ($response->getStatusCode() === self::HTTP_TOO_EARLY ||
|
||||
($response->getStatusCode() === self::HTTP_CONFLICT && $isGivenStep)) &&
|
||||
$sendCount <= $sendRetryLimit;
|
||||
if ($retryOn5xxForK8s && OcisConfigHelper::isK8s()) {
|
||||
if (OcisConfigHelper::isK8s()) {
|
||||
$loopAgain = $loopAgain || ($response->getStatusCode() >= HttpResponse::HTTP_INTERNAL_SERVER_ERROR &&
|
||||
$sendCount <= $sendRetryLimit
|
||||
&& $response->getStatusCode() !== HttpResponse::HTTP_INSUFFICIENT_STORAGE);
|
||||
|
||||
@@ -324,24 +324,6 @@ class ArchiverContext implements Context {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private array $publicLinkArchiveData = [];
|
||||
|
||||
/**
|
||||
* @param string $password
|
||||
*
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
private function getPublicLinkArchiveData(string $password): array {
|
||||
if ($this->publicLinkArchiveData === []) {
|
||||
$this->publicLinkArchiveData = $this->fetchPublicLinkArchiveData($password);
|
||||
}
|
||||
return $this->publicLinkArchiveData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the public downloads the archive of the last created public link with password "([^"]*)"$/
|
||||
*
|
||||
@@ -352,7 +334,7 @@ class ArchiverContext implements Context {
|
||||
* @throws GuzzleException|Exception
|
||||
*/
|
||||
public function publicDownloadsTheArchiveOfTheLastCreatedPublicLink(string $password = ""): void {
|
||||
$data = $this->getPublicLinkArchiveData($password);
|
||||
$data = $this->fetchPublicLinkArchiveData($password);
|
||||
$fileIds = $data['fileIds'];
|
||||
$signature = $data['signature'];
|
||||
$expiration = $data['expiration'];
|
||||
@@ -378,36 +360,6 @@ class ArchiverContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public downloads the archive of the last created public link with incorrect password :password
|
||||
*
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function publicDownloadsTheArchiveOfTheLastCreatedPublicLinkUsingBasicAuth(string $password): void {
|
||||
$data = $this->getPublicLinkArchiveData('%public%');
|
||||
$fileIds = $data['fileIds'];
|
||||
|
||||
$token = $this->featureContext->isUsingSharingNG()
|
||||
? $this->featureContext->shareNgGetLastCreatedLinkShareToken()
|
||||
: $this->featureContext->getLastCreatedPublicShareToken();
|
||||
|
||||
$queryParts = ['public-token=' . urlencode($token)];
|
||||
foreach ($fileIds as $fileId) {
|
||||
$queryParts[] = "id=" . urlencode($fileId);
|
||||
}
|
||||
|
||||
$this->featureContext->setResponse(
|
||||
HttpRequestHelper::get(
|
||||
$this->getArchiverUrl(\implode('&', $queryParts)),
|
||||
'public',
|
||||
$password,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the downloaded :type archive should contain these files:
|
||||
*
|
||||
|
||||
@@ -1328,30 +1328,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$this->setResponse($this->sendingToWithDirectUrl($user, $verb, $endpoint));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param string $url
|
||||
* @param string $password
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
private function sendHttpMethodToUrlWithPassword(string $method, string $url, string $password): ResponseInterface {
|
||||
$password = $this->getActualPassword($password);
|
||||
$token = $this->shareNgGetLastCreatedLinkShareToken();
|
||||
$fullUrl = $this->getBaseUrl() . $url;
|
||||
$headers = [
|
||||
'Public-Token' => $token,
|
||||
];
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$fullUrl,
|
||||
$method,
|
||||
"public",
|
||||
$password,
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public sends HTTP method :method to URL :url with password :password
|
||||
*
|
||||
@@ -1360,33 +1336,23 @@ class FeatureContext extends BehatVariablesContext {
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function thePublicSendsHttpMethodToUrlWithPassword(string $method, string $url, string $password): void {
|
||||
$this->setResponse($this->sendHttpMethodToUrlWithPassword($method, $url, $password));
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public sends HTTP method :method to URL :url with password :password for :attempts times
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $url
|
||||
* @param string $password
|
||||
* @param int $attempts
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function thePublicSendsHttpMethodToUrlWithPasswordForTimes(
|
||||
string $method,
|
||||
string $url,
|
||||
string $password,
|
||||
int $attempts,
|
||||
): void {
|
||||
for ($i = 0; $i < $attempts; $i++) {
|
||||
$this->setResponse($this->sendHttpMethodToUrlWithPassword($method, $url, $password));
|
||||
$this->pushToLastHttpStatusCodesArray();
|
||||
}
|
||||
$password = $this->getActualPassword($password);
|
||||
$token = $this->shareNgGetLastCreatedLinkShareToken();
|
||||
$fullUrl = $this->getBaseUrl() . $url;
|
||||
$headers = [
|
||||
'Public-Token' => $token,
|
||||
];
|
||||
$this->setResponse(
|
||||
HttpRequestHelper::sendRequest(
|
||||
$fullUrl,
|
||||
$method,
|
||||
"public",
|
||||
$password,
|
||||
$headers,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -213,9 +213,6 @@ class SearchContext implements Context {
|
||||
$password,
|
||||
$headers,
|
||||
$body,
|
||||
// this method's own caller (searchWithRetry) already retries on 5xx,
|
||||
// so the generic k8s 5xx-retry here would just double up the wait
|
||||
retryOn5xxForK8s: false,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -469,7 +469,6 @@ default:
|
||||
- SharingNgContext:
|
||||
- CollaborationContext:
|
||||
- TrashbinContext:
|
||||
- OcisConfigContext:
|
||||
|
||||
apiServiceAvailability:
|
||||
paths:
|
||||
|
||||
@@ -55,6 +55,17 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
||||
- [apiGraphUser/getUser.feature:389](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUser/getUser.feature#L389)
|
||||
- [apiGraphUser/getUser.feature:390](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUser/getUser.feature#L390)
|
||||
|
||||
#### [Normal user can get expanded members information of a group](https://github.com/owncloud/ocis/issues/5604)
|
||||
|
||||
- [apiGraphGroup/getGroup.feature:399](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphGroup/getGroup.feature#L399)
|
||||
- [apiGraphGroup/getGroup.feature:400](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphGroup/getGroup.feature#L400)
|
||||
- [apiGraphGroup/getGroup.feature:401](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphGroup/getGroup.feature#L401)
|
||||
- [apiGraphGroup/getGroup.feature:460](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphGroup/getGroup.feature#L460)
|
||||
- [apiGraphGroup/getGroup.feature:461](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphGroup/getGroup.feature#L461)
|
||||
- [apiGraphGroup/getGroup.feature:462](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphGroup/getGroup.feature#L462)
|
||||
- [apiGraphGroup/getGroup.feature:508](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphGroup/getGroup.feature#L508)
|
||||
- [apiGraphGroup/getGroup.feature:509](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphGroup/getGroup.feature#L509)
|
||||
- [apiGraphGroup/getGroup.feature:510](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphGroup/getGroup.feature#L510)
|
||||
|
||||
#### [Same users can be added in a group multiple time](https://github.com/owncloud/ocis/issues/5702)
|
||||
|
||||
|
||||
@@ -1220,26 +1220,3 @@ Feature: collaboration (wopi)
|
||||
| app | FakeOffice |
|
||||
When the public sends a lock request with lock id "abcdef123" to the last opened file using wopi endpoint
|
||||
Then the HTTP status code should be "200"
|
||||
|
||||
|
||||
Scenario: brute-force protection must apply to max failed attempt on /app/open
|
||||
And user "Alice" has uploaded file "filesForUpload/simple.odt" to "simple.odt"
|
||||
And we save it into "FILEID"
|
||||
And user "Alice" has created the following resource link share:
|
||||
| resource | simple.odt |
|
||||
| space | Personal |
|
||||
| permissionsRole | View |
|
||||
| password | %public% |
|
||||
When the public sends HTTP method "POST" to URL "/app/open?file_id=<<FILEID>>" with password "%public%"
|
||||
Then the HTTP status code should be "200"
|
||||
# For this test using the default STORAGE_PUBLICLINK_BRUTEFORCE_MAXATTEMPTS (5)
|
||||
# instead of lowering it via an env-config restart: a restart wipes oCIS's in-memory,
|
||||
# non-persistent app registry, and the FakeOffice/Collabora/OnlyOffice app providers this
|
||||
# suite depends on only ever register once, at their own startup - they never
|
||||
# re-register - so losing that registration here would permanently break every other
|
||||
# scenario in this file for the rest of the test run
|
||||
# After the exceeding max attempts the public request to /app/open with correct password should return 401
|
||||
When the public sends HTTP method "POST" to URL "/app/open?file_id=<<FILEID>>" with password "wrong-pw" for 6 times
|
||||
Then the HTTP status code of responses on each endpoint should be "401, 401, 401, 401, 401, 401" respectively
|
||||
When the public sends HTTP method "POST" to URL "/app/open?file_id=<<FILEID>>" with password "%public%"
|
||||
Then the HTTP status code should be "401"
|
||||
@@ -370,26 +370,27 @@ Feature: get groups and their members
|
||||
And user "Alice" has been added to group "tea-lover"
|
||||
And user "Brian" has been added to group "tea-lover"
|
||||
When user "Brian" gets all the members information of group "tea-lover" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
Then the HTTP status code should be "403"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"displayName",
|
||||
"id"
|
||||
"error"
|
||||
],
|
||||
"properties": {
|
||||
"displayName": {
|
||||
"const": "tea-lover"
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%group_id_pattern%$"
|
||||
"error": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["Forbidden"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"not": {
|
||||
"required": ["members"]
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -430,26 +431,27 @@ Feature: get groups and their members
|
||||
Given group "tea-lover" has been created
|
||||
And the administrator has assigned the role "<user-role>" to user "Alice" using the Graph API
|
||||
When user "Alice" gets details of the group "tea-lover" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
Then the HTTP status code should be "403"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"displayName",
|
||||
"id"
|
||||
"error"
|
||||
],
|
||||
"properties": {
|
||||
"displayName": {
|
||||
"const": "tea-lover"
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^%group_id_pattern%$"
|
||||
"error": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"message"
|
||||
],
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string",
|
||||
"enum": ["Forbidden"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"not": {
|
||||
"required": ["members"]
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -500,7 +502,7 @@ Feature: get groups and their members
|
||||
Scenario Outline: non-admin user tries to get group information of non-existing group
|
||||
Given the administrator has assigned the role "<user-role>" to user "Alice" using the Graph API
|
||||
When user "Alice" gets details of the group "non-existing" using the Graph API
|
||||
Then the HTTP status code should be "404"
|
||||
Then the HTTP status code should be "403"
|
||||
Examples:
|
||||
| user-role |
|
||||
| Space Admin |
|
||||
|
||||
@@ -1428,27 +1428,3 @@ Feature: Send a drive invitations
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@env-config
|
||||
Scenario: user has access to a space shared with LDAP group using posixGroup objectclass with uniqueMember schema
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| graph | OCIS_LDAP_GROUP_OBJECTCLASS | posixGroup |
|
||||
| graph | OCIS_LDAP_GROUP_SCHEMA_MEMBER | uniqueMember |
|
||||
| groups | OCIS_LDAP_GROUP_OBJECTCLASS | posixGroup |
|
||||
| groups | OCIS_LDAP_GROUP_SCHEMA_MEMBER | uniqueMember |
|
||||
| users | OCIS_LDAP_GROUP_OBJECTCLASS | posixGroup |
|
||||
| users | OCIS_LDAP_GROUP_SCHEMA_MEMBER | uniqueMember |
|
||||
| auth-basic | OCIS_LDAP_GROUP_OBJECTCLASS | posixGroup |
|
||||
| auth-basic | OCIS_LDAP_GROUP_SCHEMA_MEMBER | uniqueMember |
|
||||
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
|
||||
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
|
||||
And the administrator has created a group "grp1" using the Graph API
|
||||
And the administrator has added a user "Brian" to the group "grp1" using the Graph API
|
||||
When user "Alice" sends the following space share invitation using permissions endpoint of the Graph API:
|
||||
| space | NewSpace |
|
||||
| sharee | grp1 |
|
||||
| shareType | group |
|
||||
| permissionsRole | Space Viewer |
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should have a space called "NewSpace" granted to group "grp1" with role "viewer"
|
||||
@@ -1,47 +0,0 @@
|
||||
@env-config
|
||||
Feature: brute-force protection for password protected public links
|
||||
As the maintainer of a password protected public link
|
||||
I want repeated wrong password guesses against that link to be rate limited
|
||||
So that an attacker cannot brute-force the password regardless of which endpoint they use
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes:
|
||||
| username |
|
||||
| Alice |
|
||||
And using spaces DAV path
|
||||
And the config "STORAGE_PUBLICLINK_BRUTEFORCE_MAXATTEMPTS" has been set to "2" for "storage-publiclink" service
|
||||
And using SharingNG
|
||||
|
||||
|
||||
Scenario: brute-force protection must apply to max failed attempt on public WebDAV
|
||||
Given user "Alice" has uploaded file with content "some content" to "testfile.txt"
|
||||
When user "Alice" creates the following resource link share using the Graph API:
|
||||
| resource | testfile.txt |
|
||||
| space | Personal |
|
||||
| permissionsRole | View |
|
||||
| password | %public% |
|
||||
Then the public download of file "testfile.txt" from inside the last public link shared folder using the public WebDAV API with password "%public%" should fail with HTTP status code "200"
|
||||
And the public download of file "testfile.txt" from inside the last public link shared folder using the public WebDAV API with password "wrong-password" should fail with HTTP status code "401"
|
||||
And the public download of file "testfile.txt" from inside the last public link shared folder using the public WebDAV API with password "wrong-password" should fail with HTTP status code "401"
|
||||
And the public download of file "testfile.txt" from inside the last public link shared folder using the public WebDAV API with password "wrong-password" should fail with HTTP status code "429"
|
||||
And the public download of file "testfile.txt" from inside the last public link shared folder using the public WebDAV API with password "%public%" should fail with HTTP status code "429"
|
||||
|
||||
|
||||
Scenario: brute-force protection must apply to max failed attempt on /archiver
|
||||
Given user "Alice" has created folder "public-folder"
|
||||
And user "Alice" has uploaded file with content "some content" to "public-folder/testfile.txt"
|
||||
And user "Alice" has created the following resource link share:
|
||||
| resource | public-folder |
|
||||
| space | Personal |
|
||||
| permissionsRole | View |
|
||||
| password | %public% |
|
||||
When the public downloads the archive of the last created public link with password "%public%"
|
||||
Then the HTTP status code should be "200"
|
||||
When the public downloads the archive of the last created public link with incorrect password "wrong-pw"
|
||||
Then the HTTP status code should be "401"
|
||||
When the public downloads the archive of the last created public link with incorrect password "wrong-pw"
|
||||
Then the HTTP status code should be "401"
|
||||
When the public downloads the archive of the last created public link with incorrect password "wrong-pw"
|
||||
Then the HTTP status code should be "401"
|
||||
When the public downloads the archive of the last created public link with password "%public%"
|
||||
Then the HTTP status code should be "401"
|
||||
+11
-40
@@ -4,9 +4,6 @@ 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
|
||||
Optional: K8S=true, TEST_SERVER_URL=<url> - run against an already-deployed
|
||||
k8s OCIS instance (see .github/workflows/k8s.yml) instead of starting one
|
||||
locally. All other *_NEEDED flags are ignored in this mode.
|
||||
"""
|
||||
|
||||
import json
|
||||
@@ -123,43 +120,6 @@ def main() -> int:
|
||||
file=sys.stderr)
|
||||
return 1
|
||||
|
||||
repo_root = Path(__file__).resolve().parents[2]
|
||||
web_dir = repo_root / "web"
|
||||
|
||||
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)
|
||||
|
||||
if os.environ.get("K8S", "").lower() == "true":
|
||||
# oCIS is already running as a Helm-deployed k8s cluster (see
|
||||
# .github/workflows/k8s.yml) -- unlike the flow below, there's no local
|
||||
# binary to build, init, or start. Just confirm it's up and point
|
||||
# Playwright straight at it.
|
||||
ocis_url = os.environ["TEST_SERVER_URL"]
|
||||
wait_for(lambda: ocis_healthy(ocis_url), 120, "ocis")
|
||||
print("ocis ready.")
|
||||
|
||||
playwright_env = {
|
||||
**os.environ,
|
||||
"BASE_URL_OCIS": ocis_url,
|
||||
"HEADLESS": "true",
|
||||
"RETRY": "3",
|
||||
"REPORT_TRACING": "false",
|
||||
"BROWSER": "chromium",
|
||||
}
|
||||
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
|
||||
|
||||
tika_needed = os.environ.get("TIKA_NEEDED", "").lower() == "true"
|
||||
keycloak_needed = os.environ.get("KEYCLOAK_NEEDED", "").lower() == "true"
|
||||
mfa_needed = os.environ.get("MFA_NEEDED", "").lower() == "true"
|
||||
@@ -171,6 +131,7 @@ def main() -> int:
|
||||
# MFA mode runs ocis behind keycloak with TOTP enforced
|
||||
keycloak_needed = keycloak_needed or mfa_needed or vault_storage_needed
|
||||
|
||||
repo_root = Path(__file__).resolve().parents[2]
|
||||
ocis_bin = repo_root / "ocis/bin/ocis"
|
||||
wrapper_bin = repo_root / "tests/ociswrapper/bin/ociswrapper"
|
||||
# The federated suite must address the primary as localhost instead of
|
||||
@@ -180,6 +141,7 @@ def main() -> int:
|
||||
# suite), which only lists localhost:9200.
|
||||
ocis_url = "https://localhost:9200" if federated_needed else "https://127.0.0.1:9200"
|
||||
ocis_config_dir = Path.home() / ".ocis/config"
|
||||
web_dir = repo_root / "web"
|
||||
|
||||
# build ocis + ociswrapper only if not already provided (e.g. via artifact)
|
||||
if not ocis_bin.exists():
|
||||
@@ -188,6 +150,15 @@ def main() -> int:
|
||||
run(["make", "-C", str(repo_root / "tests/ociswrapper"), "build"],
|
||||
env={"GOWORK": "off"})
|
||||
|
||||
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"])
|
||||
# tests/config/ci/app-registry.yaml maps its one mimetype to "FakeOffice", the
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
NAMESPACE="${TEST_SERVER_DOMAIN:-ocis-server}"
|
||||
NAMESPACE="${NAMESPACE:-ocis-server}"
|
||||
|
||||
declare -A DEBUG_PORTS=(
|
||||
[activitylog]=9197
|
||||
|
||||
@@ -4,7 +4,7 @@ set -e
|
||||
|
||||
HOST_IP=$(ip route get 1 | awk '{print $7}')
|
||||
|
||||
NAMESPACE="${TEST_SERVER_DOMAIN:-ocis-server}"
|
||||
NAMESPACE="ocis-server"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
deploy_name=$1
|
||||
service_port=$2
|
||||
node_port=$3
|
||||
namespace="${TEST_SERVER_DOMAIN:-ocis-server}"
|
||||
|
||||
if [[ -z "$deploy_name" ]] || [[ -z "$service_port" ]] || [[ -z "$node_port" ]]; then
|
||||
echo "[ERROR] Missing arguments. Usage: $0 <deploy_name> <service_port> <node_port>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
service_name="${deploy_name}-${node_port}-np"
|
||||
|
||||
kubectl -n "$namespace" expose deployment "$deploy_name" --type=NodePort --port="$service_port" --name="$service_name"
|
||||
kubectl -n "$namespace" patch svc "$service_name" -p "{\"spec\":{\"ports\":[{\"port\":${service_port},\"nodePort\":${node_port}}]}}"
|
||||
@@ -69,11 +69,6 @@ if [[ "$ENABLE_WOPI" == "true" ]]; then
|
||||
# patch collaboration service
|
||||
# - allow dynamic wopi src
|
||||
sed -i -E "s|value: http://.*:9300|value: {{ \$officeSuite.wopiSrc }}|" $TPL_DIR/collaboration/deployment.yaml
|
||||
sed -i \
|
||||
-e 's/{{- include "ocis.extraEnvs" \. | nindent 12 }}/{{- include "ocis.extraEnvs" $ | nindent 12 }}/' \
|
||||
-e 's/{{- include "ocis.extraVolMounts" \. | nindent 12 }}/{{- include "ocis.extraVolMounts" $ | nindent 12 }}/' \
|
||||
-e 's/{{- include "ocis.extraVolumes" \. | nindent 8 }}/{{- include "ocis.extraVolumes" $ | nindent 8 }}/' \
|
||||
$TPL_DIR/collaboration/deployment.yaml
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_OCM" == "true" ]]; then
|
||||
|
||||
@@ -74,7 +74,7 @@ features:
|
||||
ingress:
|
||||
enabled: false
|
||||
- name: 'OnlyOffice'
|
||||
uri: 'https://onlyoffice:7443'
|
||||
uri: 'https://onlyoffice'
|
||||
wopiSrc: 'http://ocis-server:9302'
|
||||
product: 'OnlyOffice'
|
||||
enabled: true
|
||||
|
||||
+3
-18
@@ -129,9 +129,6 @@ const (
|
||||
|
||||
// Always asserts that condition is true every time this function is called, and that it is called at least once. The corresponding test property will be viewable in the Antithesis SDK: Always group of your triage report.
|
||||
func Always(condition bool, message string, details map[string]any) {
|
||||
if trackerEmitted(message, condition) {
|
||||
return
|
||||
}
|
||||
locationInfo := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, locationInfo)
|
||||
assertImpl(condition, message, details, locationInfo, wasHit, mustBeHit, universalTest, alwaysDisplay, id)
|
||||
@@ -139,9 +136,6 @@ func Always(condition bool, message string, details map[string]any) {
|
||||
|
||||
// AlwaysOrUnreachable asserts that condition is true every time this function is called. The corresponding test property will pass if the assertion is never encountered (unlike Always assertion types). This test property will be viewable in the “Antithesis SDK: Always” group of your triage report.
|
||||
func AlwaysOrUnreachable(condition bool, message string, details map[string]any) {
|
||||
if trackerEmitted(message, condition) {
|
||||
return
|
||||
}
|
||||
locationInfo := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, locationInfo)
|
||||
assertImpl(condition, message, details, locationInfo, wasHit, optionallyHit, universalTest, alwaysOrUnreachableDisplay, id)
|
||||
@@ -149,9 +143,6 @@ func AlwaysOrUnreachable(condition bool, message string, details map[string]any)
|
||||
|
||||
// Sometimes asserts that condition is true at least one time that this function was called. (If the assertion is never encountered, the test property will therefore fail.) This test property will be viewable in the “Antithesis SDK: Sometimes” group.
|
||||
func Sometimes(condition bool, message string, details map[string]any) {
|
||||
if trackerEmitted(message, condition) {
|
||||
return
|
||||
}
|
||||
locationInfo := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, locationInfo)
|
||||
assertImpl(condition, message, details, locationInfo, wasHit, mustBeHit, existentialTest, sometimesDisplay, id)
|
||||
@@ -159,9 +150,6 @@ func Sometimes(condition bool, message string, details map[string]any) {
|
||||
|
||||
// Unreachable asserts that a line of code is never reached. The corresponding test property will fail if this function is ever called. (If it is never called the test property will therefore pass.) This test property will be viewable in the “Antithesis SDK: Reachablity assertions” group.
|
||||
func Unreachable(message string, details map[string]any) {
|
||||
if trackerEmitted(message, false) {
|
||||
return
|
||||
}
|
||||
locationInfo := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, locationInfo)
|
||||
assertImpl(false, message, details, locationInfo, wasHit, optionallyHit, reachabilityTest, unreachableDisplay, id)
|
||||
@@ -169,9 +157,6 @@ func Unreachable(message string, details map[string]any) {
|
||||
|
||||
// Reachable asserts that a line of code is reached at least once. The corresponding test property will pass if this function is ever called. (If it is never called the test property will therefore fail.) This test property will be viewable in the “Antithesis SDK: Reachablity assertions” group.
|
||||
func Reachable(message string, details map[string]any) {
|
||||
if trackerEmitted(message, true) {
|
||||
return
|
||||
}
|
||||
locationInfo := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, locationInfo)
|
||||
assertImpl(true, message, details, locationInfo, wasHit, mustBeHit, reachabilityTest, reachableDisplay, id)
|
||||
@@ -179,13 +164,13 @@ func Reachable(message string, details map[string]any) {
|
||||
|
||||
// AssertRaw is a low-level method designed to be used by third-party frameworks. Regular users of the assert package should not call it.
|
||||
func AssertRaw(cond bool, message string, details map[string]any,
|
||||
classname, funcname, filename string, line int, column int,
|
||||
classname, funcname, filename string, line int,
|
||||
hit bool, mustHit bool,
|
||||
assertType string, displayType string,
|
||||
id string,
|
||||
) {
|
||||
assertImpl(cond, message, details,
|
||||
&locationInfo{classname, funcname, filename, line, column},
|
||||
&locationInfo{classname, funcname, filename, line, columnUnknown},
|
||||
hit, mustHit,
|
||||
assertType, displayType,
|
||||
id)
|
||||
@@ -197,7 +182,7 @@ func assertImpl(cond bool, message string, details map[string]any,
|
||||
assertType string, displayType string,
|
||||
id string,
|
||||
) {
|
||||
trackerEntry := getTrackerEntry(id, loc.Filename, loc.Classname)
|
||||
trackerEntry := assertTracker.getTrackerEntry(id, loc.Filename, loc.Classname)
|
||||
|
||||
// Always grab the Filename and Classname captured when the trackerEntry was established
|
||||
// This provides the consistency needed between instrumentation-time and runtime
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ func Sometimes(condition bool, message string, details map[string]any)
|
||||
func Unreachable(message string, details map[string]any) {}
|
||||
func Reachable(message string, details map[string]any) {}
|
||||
func AssertRaw(cond bool, message string, details map[string]any,
|
||||
classname, funcname, filename string, line int, column int,
|
||||
classname, funcname, filename string, line int,
|
||||
hit bool, mustHit bool,
|
||||
assertType string, displayType string,
|
||||
id string,
|
||||
|
||||
+40
-13
@@ -8,22 +8,43 @@ import (
|
||||
"github.com/antithesishq/antithesis-sdk-go/internal"
|
||||
)
|
||||
|
||||
// TODO: Someday this tracker should also start deduplicating
|
||||
// guidance, but there are some complicated policy questions
|
||||
// to settle before we do that.
|
||||
type booleanGuidance struct{}
|
||||
// TODO: Tracker is intended to prevent sending the same guidance
|
||||
// more than once. In this case, we always send, so the tracker
|
||||
// is not presently used.
|
||||
type booleanGuidance struct {
|
||||
n int
|
||||
}
|
||||
|
||||
// booleanGuidanceTracker keeps the per-id entries: a grow-only map with
|
||||
// stable keys, read on every rich-assert evaluation and written once per
|
||||
// guidance id.
|
||||
var booleanGuidanceTracker sync.Map // message key -> *booleanGuidance
|
||||
type booleanGuidanceTracker map[string]*booleanGuidance
|
||||
|
||||
func getBooleanGuidanceEntry(messageKey string) *booleanGuidance {
|
||||
if entry, ok := booleanGuidanceTracker.Load(messageKey); ok {
|
||||
return entry.(*booleanGuidance)
|
||||
var (
|
||||
boolean_guidance_tracker booleanGuidanceTracker = make(booleanGuidanceTracker)
|
||||
boolean_guidance_tracker_mutex sync.Mutex
|
||||
boolean_guidance_info_mutex sync.Mutex
|
||||
)
|
||||
|
||||
func (tracker booleanGuidanceTracker) getTrackerEntry(messageKey string) *booleanGuidance {
|
||||
var trackerEntry *booleanGuidance
|
||||
var ok bool
|
||||
|
||||
if tracker == nil {
|
||||
return nil
|
||||
}
|
||||
entry, _ := booleanGuidanceTracker.LoadOrStore(messageKey, &booleanGuidance{})
|
||||
return entry.(*booleanGuidance)
|
||||
|
||||
boolean_guidance_tracker_mutex.Lock()
|
||||
defer boolean_guidance_tracker_mutex.Unlock()
|
||||
if trackerEntry, ok = boolean_guidance_tracker[messageKey]; !ok {
|
||||
trackerEntry = newBooleanGuidance()
|
||||
tracker[messageKey] = trackerEntry
|
||||
}
|
||||
|
||||
return trackerEntry
|
||||
}
|
||||
|
||||
// Create a boolean guidance tracker
|
||||
func newBooleanGuidance() *booleanGuidance {
|
||||
trackerInfo := booleanGuidance{}
|
||||
return &trackerInfo
|
||||
}
|
||||
|
||||
func (tI *booleanGuidance) send_value(bgI *booleanGuidanceInfo) {
|
||||
@@ -31,6 +52,12 @@ func (tI *booleanGuidance) send_value(bgI *booleanGuidanceInfo) {
|
||||
return
|
||||
}
|
||||
|
||||
boolean_guidance_info_mutex.Lock()
|
||||
defer boolean_guidance_info_mutex.Unlock()
|
||||
|
||||
// The tracker entry should be consulted to determine
|
||||
// if this Guidance info has already been sent, or not.
|
||||
|
||||
emitBooleanGuidance(bgI)
|
||||
}
|
||||
|
||||
|
||||
+78
-67
@@ -5,7 +5,6 @@ package assert
|
||||
import (
|
||||
"math"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/antithesishq/antithesis-sdk-go/internal"
|
||||
)
|
||||
@@ -46,26 +45,35 @@ func gapTypeForOperand[T Number](num T) numericGapType {
|
||||
//
|
||||
// --------------------------------------------------------------------------------
|
||||
type numericGuidanceInfo struct {
|
||||
gap any
|
||||
descriminator numericGapType
|
||||
maximize bool
|
||||
// The best gap sent so far (a gapValue[uint64] or gapValue[float64],
|
||||
// fixed per entry). Read lock-free on every evaluation; updated under mu.
|
||||
gap atomic.Value
|
||||
// Serializes improvements (compare, update, emit) so guidance emissions
|
||||
// form an ordered monotone chain; the no-improvement fast path never
|
||||
// takes it.
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
var numericGuidanceTracker sync.Map // message key -> *numericGuidanceInfo
|
||||
type numericGuidanceTracker map[string]*numericGuidanceInfo
|
||||
|
||||
func getNumericGuidanceEntry(messageKey string, trackerType numericGapType, maximize bool) *numericGuidanceInfo {
|
||||
if entry, ok := numericGuidanceTracker.Load(messageKey); ok {
|
||||
return entry.(*numericGuidanceInfo)
|
||||
var (
|
||||
numeric_guidance_tracker numericGuidanceTracker = make(numericGuidanceTracker)
|
||||
numeric_guidance_tracker_mutex sync.Mutex
|
||||
numeric_guidance_info_mutex sync.Mutex
|
||||
)
|
||||
|
||||
func (tracker numericGuidanceTracker) getTrackerEntry(messageKey string, trackerType numericGapType, maximize bool) *numericGuidanceInfo {
|
||||
var trackerEntry *numericGuidanceInfo
|
||||
var ok bool
|
||||
|
||||
if tracker == nil {
|
||||
return nil
|
||||
}
|
||||
entry, _ := numericGuidanceTracker.LoadOrStore(messageKey,
|
||||
newNumericGuidanceInfo(trackerType, maximize))
|
||||
return entry.(*numericGuidanceInfo)
|
||||
|
||||
numeric_guidance_tracker_mutex.Lock()
|
||||
defer numeric_guidance_tracker_mutex.Unlock()
|
||||
if trackerEntry, ok = numeric_guidance_tracker[messageKey]; !ok {
|
||||
trackerEntry = newNumericGuidanceInfo(trackerType, maximize)
|
||||
tracker[messageKey] = trackerEntry
|
||||
}
|
||||
|
||||
return trackerEntry
|
||||
}
|
||||
|
||||
// Create an numeric guidance entry
|
||||
@@ -80,8 +88,8 @@ func newNumericGuidanceInfo(trackerType numericGapType, maximize bool) *numericG
|
||||
trackerInfo := numericGuidanceInfo{
|
||||
maximize: maximize,
|
||||
descriminator: trackerType,
|
||||
gap: gap,
|
||||
}
|
||||
trackerInfo.gap.Store(gap)
|
||||
return &trackerInfo
|
||||
}
|
||||
|
||||
@@ -167,51 +175,14 @@ func is_less_than[T numConstraint](left gapValue[T], right gapValue[T]) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// The candidate gap for a pair of guidance operands, in the tracker's
|
||||
// representation (nil when the operand type resolves to none).
|
||||
func candidateGap(data any) any {
|
||||
// Needs to have individual case statements to assist
|
||||
// the compiler to infer the actual type of the var named 'operands'
|
||||
switch operands := data.(type) {
|
||||
case numericOperands[int32]:
|
||||
return makeGap(operands)
|
||||
case numericOperands[int64]:
|
||||
return makeGap(operands)
|
||||
case numericOperands[uint64]:
|
||||
return makeGap(operands)
|
||||
case numericOperands[float64]:
|
||||
return makeFloatGap(operands)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Whether candidate improves on the entry's tracked extremum.
|
||||
func (tI *numericGuidanceInfo) improves(candidate any) bool {
|
||||
maximize := tI.should_maximize()
|
||||
switch prev := tI.gap.Load().(type) {
|
||||
case gapValue[uint64]:
|
||||
if gap, ok := candidate.(gapValue[uint64]); ok {
|
||||
if maximize {
|
||||
return is_greater_than(gap, prev)
|
||||
}
|
||||
return is_less_than(gap, prev)
|
||||
}
|
||||
case gapValue[float64]:
|
||||
if gap, ok := candidate.(gapValue[float64]); ok {
|
||||
if maximize {
|
||||
return is_greater_than(gap, prev)
|
||||
}
|
||||
return is_less_than(gap, prev)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func send_value_if_needed(tI *numericGuidanceInfo, gI *guidanceInfo) {
|
||||
if tI == nil {
|
||||
return
|
||||
}
|
||||
|
||||
numeric_guidance_info_mutex.Lock()
|
||||
defer numeric_guidance_info_mutex.Unlock()
|
||||
|
||||
// if this is a catalog entry (gI.hit is false)
|
||||
// do not update the reference gap in the tracker (tI *numericGuidanceInfo)
|
||||
if !gI.Hit {
|
||||
@@ -219,19 +190,59 @@ func send_value_if_needed(tI *numericGuidanceInfo, gI *guidanceInfo) {
|
||||
return
|
||||
}
|
||||
|
||||
// Most evaluations do not improve on the tracked extremum; that path is
|
||||
// a lock-free load and compare. The mutex serializes only improvements.
|
||||
candidate := candidateGap(gI.Data)
|
||||
if !tI.improves(candidate) {
|
||||
return
|
||||
should_send := false
|
||||
maximize := tI.should_maximize()
|
||||
|
||||
var gap gapValue[uint64]
|
||||
var float_gap gapValue[float64]
|
||||
|
||||
// Needs to have individual case statements to assist
|
||||
// the compiler to infer the actual type of the var named 'operands'
|
||||
switch operands := (gI.Data).(type) {
|
||||
case numericOperands[int32]:
|
||||
gap = makeGap(operands)
|
||||
case numericOperands[int64]:
|
||||
gap = makeGap(operands)
|
||||
case numericOperands[uint64]:
|
||||
gap = makeGap(operands)
|
||||
case numericOperands[float64]:
|
||||
float_gap = makeFloatGap(operands)
|
||||
}
|
||||
tI.mu.Lock()
|
||||
defer tI.mu.Unlock()
|
||||
if !tI.improves(candidate) {
|
||||
return
|
||||
|
||||
var prev_gap gapValue[uint64]
|
||||
var prev_float_gap gapValue[float64]
|
||||
has_prev_gap := false
|
||||
has_prev_float_gap := false
|
||||
|
||||
prev_gap, has_prev_gap = tI.gap.(gapValue[uint64])
|
||||
if !has_prev_gap {
|
||||
prev_float_gap, has_prev_float_gap = tI.gap.(gapValue[float64])
|
||||
}
|
||||
|
||||
if has_prev_gap {
|
||||
if maximize {
|
||||
should_send = is_greater_than(gap, prev_gap)
|
||||
} else {
|
||||
should_send = is_less_than(gap, prev_gap)
|
||||
}
|
||||
}
|
||||
|
||||
if has_prev_float_gap {
|
||||
if maximize {
|
||||
should_send = is_greater_than(float_gap, prev_float_gap)
|
||||
} else {
|
||||
should_send = is_less_than(float_gap, prev_float_gap)
|
||||
}
|
||||
}
|
||||
|
||||
if should_send {
|
||||
if tI.is_integer_gap() {
|
||||
tI.gap = gap
|
||||
} else {
|
||||
tI.gap = float_gap
|
||||
}
|
||||
emitGuidance(gI)
|
||||
}
|
||||
tI.gap.Store(candidate)
|
||||
emitGuidance(gI)
|
||||
}
|
||||
|
||||
func emitGuidance(gI *guidanceInfo) error {
|
||||
|
||||
+2
-42
@@ -139,13 +139,13 @@ func behavior_to_guidance(behavior string) guidanceFnType {
|
||||
}
|
||||
|
||||
func numericGuidanceImpl[T Number](left, right T, message, id string, loc *locationInfo, guidanceFn guidanceFnType, hit bool) {
|
||||
tI := getNumericGuidanceEntry(id, gapTypeForOperand(left), uses_maximize(guidanceFn))
|
||||
tI := numeric_guidance_tracker.getTrackerEntry(id, gapTypeForOperand(left), uses_maximize(guidanceFn))
|
||||
gI := build_numeric_guidance(guidanceFn, message, left, right, loc, id, hit)
|
||||
send_value_if_needed(tI, gI)
|
||||
}
|
||||
|
||||
func booleanGuidanceImpl(named_bools []NamedBool, message, id string, loc *locationInfo, guidanceFn guidanceFnType, hit bool) {
|
||||
tI := getBooleanGuidanceEntry(id)
|
||||
tI := boolean_guidance_tracker.getTrackerEntry(id)
|
||||
bgI := build_boolean_guidance(guidanceFn, message, named_bools, loc, id, hit)
|
||||
tI.send_value(bgI)
|
||||
}
|
||||
@@ -207,27 +207,8 @@ func add_boolean_details(details map[string]any, named_bools []NamedBool) map[st
|
||||
return enhancedDetails
|
||||
}
|
||||
|
||||
// Whether a numeric rich-assert evaluation can return before capturing its
|
||||
// location or building its details: the assertion side has already emitted
|
||||
// for this condition, and the guidance side does not improve the tracked
|
||||
// extremum. Both checks are lock-free loads. False while the guidance entry
|
||||
// does not exist, so the first evaluation still takes the full path.
|
||||
func numericRichAssertSettled[T Number](left, right T, message string, condition bool) bool {
|
||||
if !trackerEmitted(message, condition) {
|
||||
return false
|
||||
}
|
||||
entry, ok := numericGuidanceTracker.Load(message)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return !entry.(*numericGuidanceInfo).improves(candidateGap(newOperands(left, right)))
|
||||
}
|
||||
|
||||
// Equivalent to asserting Always(left > right, message, details). Information about left and right will automatically be added to the details parameter, with keys left and right. If you use this function for assertions that compare numeric quantities, you may help Antithesis find more bugs.
|
||||
func AlwaysGreaterThan[T Number](left, right T, message string, details map[string]any) {
|
||||
if numericRichAssertSettled(left, right, message, left > right) {
|
||||
return
|
||||
}
|
||||
loc := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, loc)
|
||||
condition := left > right
|
||||
@@ -239,9 +220,6 @@ func AlwaysGreaterThan[T Number](left, right T, message string, details map[stri
|
||||
|
||||
// Equivalent to asserting Always(left >= right, message, details). Information about left and right will automatically be added to the details parameter, with keys left and right. If you use this function for assertions that compare numeric quantities, you may help Antithesis find more bugs.
|
||||
func AlwaysGreaterThanOrEqualTo[T Number](left, right T, message string, details map[string]any) {
|
||||
if numericRichAssertSettled(left, right, message, left >= right) {
|
||||
return
|
||||
}
|
||||
loc := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, loc)
|
||||
condition := left >= right
|
||||
@@ -253,9 +231,6 @@ func AlwaysGreaterThanOrEqualTo[T Number](left, right T, message string, details
|
||||
|
||||
// Equivalent to asserting Sometimes(T left > T right, message, details). Information about left and right will automatically be added to the details parameter, with keys left and right. If you use this function for assertions that compare numeric quantities, you may help Antithesis find more bugs.
|
||||
func SometimesGreaterThan[T Number](left, right T, message string, details map[string]any) {
|
||||
if numericRichAssertSettled(left, right, message, left > right) {
|
||||
return
|
||||
}
|
||||
loc := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, loc)
|
||||
condition := left > right
|
||||
@@ -267,9 +242,6 @@ func SometimesGreaterThan[T Number](left, right T, message string, details map[s
|
||||
|
||||
// Equivalent to asserting Sometimes(T left >= T right, message, details). Information about left and right will automatically be added to the details parameter, with keys left and right. If you use this function for assertions that compare numeric quantities, you may help Antithesis find more bugs.
|
||||
func SometimesGreaterThanOrEqualTo[T Number](left, right T, message string, details map[string]any) {
|
||||
if numericRichAssertSettled(left, right, message, left >= right) {
|
||||
return
|
||||
}
|
||||
loc := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, loc)
|
||||
condition := left >= right
|
||||
@@ -281,9 +253,6 @@ func SometimesGreaterThanOrEqualTo[T Number](left, right T, message string, deta
|
||||
|
||||
// Equivalent to asserting Always(left < right, message, details). Information about left and right will automatically be added to the details parameter, with keys left and right. If you use this function for assertions that compare numeric quantities, you may help Antithesis find more bugs.
|
||||
func AlwaysLessThan[T Number](left, right T, message string, details map[string]any) {
|
||||
if numericRichAssertSettled(left, right, message, left < right) {
|
||||
return
|
||||
}
|
||||
loc := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, loc)
|
||||
condition := left < right
|
||||
@@ -295,9 +264,6 @@ func AlwaysLessThan[T Number](left, right T, message string, details map[string]
|
||||
|
||||
// Equivalent to asserting Always(left <= right, message, details). Information about left and right will automatically be added to the details parameter, with keys left and right. If you use this function for assertions that compare numeric quantities, you may help Antithesis find more bugs.
|
||||
func AlwaysLessThanOrEqualTo[T Number](left, right T, message string, details map[string]any) {
|
||||
if numericRichAssertSettled(left, right, message, left <= right) {
|
||||
return
|
||||
}
|
||||
loc := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, loc)
|
||||
condition := left <= right
|
||||
@@ -309,9 +275,6 @@ func AlwaysLessThanOrEqualTo[T Number](left, right T, message string, details ma
|
||||
|
||||
// Equivalent to asserting Sometimes(T left < T right, message, details). Information about left and right will automatically be added to the details parameter, with keys left and right. If you use this function for assertions that compare numeric quantities, you may help Antithesis find more bugs.
|
||||
func SometimesLessThan[T Number](left, right T, message string, details map[string]any) {
|
||||
if numericRichAssertSettled(left, right, message, left < right) {
|
||||
return
|
||||
}
|
||||
loc := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, loc)
|
||||
condition := left < right
|
||||
@@ -323,9 +286,6 @@ func SometimesLessThan[T Number](left, right T, message string, details map[stri
|
||||
|
||||
// Equivalent to asserting Sometimes(T left <= T right, message, details). Information about left and right will automatically be added to the details parameter, with keys left and right. If you use this function for assertions that compare numeric quantities, you may help Antithesis find more bugs.
|
||||
func SometimesLessThanOrEqualTo[T Number](left, right T, message string, details map[string]any) {
|
||||
if numericRichAssertSettled(left, right, message, left <= right) {
|
||||
return
|
||||
}
|
||||
loc := newLocationInfo(offsetAPICaller)
|
||||
id := makeKey(message, loc)
|
||||
condition := left <= right
|
||||
|
||||
+68
-41
@@ -3,34 +3,54 @@
|
||||
package assert
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/antithesishq/antithesis-sdk-go/internal"
|
||||
)
|
||||
|
||||
// Tracking info for one assertion id.
|
||||
type trackerInfo struct {
|
||||
Filename string
|
||||
Classname string
|
||||
|
||||
passEmitted atomic.Bool
|
||||
failEmitted atomic.Bool
|
||||
// Serializes only first-emission attempts (including retries after an
|
||||
// emission error); never taken once a flag is set.
|
||||
emitMutex sync.Mutex
|
||||
PassCount int
|
||||
FailCount int
|
||||
}
|
||||
|
||||
// assertTracker keeps track of the unique asserts evaluated.
|
||||
var assertTracker sync.Map // message key -> *trackerInfo
|
||||
type emitTracker map[string]*trackerInfo
|
||||
|
||||
func getTrackerEntry(messageKey string, filename string, classname string) *trackerInfo {
|
||||
if entry, ok := assertTracker.Load(messageKey); ok {
|
||||
return entry.(*trackerInfo)
|
||||
// assert_tracker (global) keeps track of the unique asserts evaluated
|
||||
var (
|
||||
assertTracker emitTracker = make(emitTracker)
|
||||
trackerMutex sync.Mutex
|
||||
trackerInfoMutex sync.Mutex
|
||||
)
|
||||
|
||||
func (tracker emitTracker) getTrackerEntry(messageKey string, filename, classname string) *trackerInfo {
|
||||
var trackerEntry *trackerInfo
|
||||
var ok bool
|
||||
|
||||
if tracker == nil {
|
||||
return nil
|
||||
}
|
||||
entry, _ := assertTracker.LoadOrStore(messageKey,
|
||||
&trackerInfo{Filename: filename, Classname: classname})
|
||||
return entry.(*trackerInfo)
|
||||
|
||||
trackerMutex.Lock()
|
||||
defer trackerMutex.Unlock()
|
||||
if trackerEntry, ok = tracker[messageKey]; !ok {
|
||||
trackerEntry = newTrackerInfo(filename, classname)
|
||||
tracker[messageKey] = trackerEntry
|
||||
}
|
||||
return trackerEntry
|
||||
}
|
||||
|
||||
func newTrackerInfo(filename, classname string) *trackerInfo {
|
||||
trackerInfo := trackerInfo{
|
||||
PassCount: 0,
|
||||
FailCount: 0,
|
||||
Filename: filename,
|
||||
Classname: classname,
|
||||
}
|
||||
return &trackerInfo
|
||||
}
|
||||
|
||||
func (ti *trackerInfo) emit(ai *assertInfo) {
|
||||
@@ -39,46 +59,53 @@ func (ti *trackerInfo) emit(ai *assertInfo) {
|
||||
}
|
||||
|
||||
// Registrations are just sent to voidstar
|
||||
if !ai.Hit {
|
||||
hit := ai.Hit
|
||||
if !hit {
|
||||
emitAssert(ai)
|
||||
return
|
||||
}
|
||||
|
||||
flag := &ti.passEmitted
|
||||
if !ai.Condition {
|
||||
flag = &ti.failEmitted
|
||||
}
|
||||
if flag.Load() {
|
||||
var err error
|
||||
cond := ai.Condition
|
||||
|
||||
trackerInfoMutex.Lock()
|
||||
defer trackerInfoMutex.Unlock()
|
||||
if cond {
|
||||
if ti.PassCount == 0 {
|
||||
err = emitAssert(ai)
|
||||
}
|
||||
if err == nil {
|
||||
ti.PassCount++
|
||||
}
|
||||
return
|
||||
}
|
||||
ti.emitMutex.Lock()
|
||||
defer ti.emitMutex.Unlock()
|
||||
if flag.Load() {
|
||||
return
|
||||
if ti.FailCount == 0 {
|
||||
err = emitAssert(ai)
|
||||
}
|
||||
// The flag is only set on success, so an assertion whose emission
|
||||
// failed is retried on its next evaluation (as before).
|
||||
if emitAssert(ai) == nil {
|
||||
flag.Store(true)
|
||||
if err == nil {
|
||||
ti.FailCount++
|
||||
}
|
||||
}
|
||||
|
||||
// Whether this assertion id has already emitted for this condition — i.e.
|
||||
// whether an evaluation can return before capturing its location.
|
||||
func trackerEmitted(id string, condition bool) bool {
|
||||
entry, ok := assertTracker.Load(id)
|
||||
if !ok {
|
||||
return false
|
||||
func versionMessage() {
|
||||
languageBlock := map[string]any{
|
||||
"name": "Go",
|
||||
"version": runtime.Version(),
|
||||
}
|
||||
ti := entry.(*trackerInfo)
|
||||
if condition {
|
||||
return ti.passEmitted.Load()
|
||||
versionBlock := map[string]any{
|
||||
"language": languageBlock,
|
||||
"sdk_version": internal.SDK_Version,
|
||||
"protocol_version": internal.Protocol_Version,
|
||||
}
|
||||
return ti.failEmitted.Load()
|
||||
internal.Json_data(map[string]any{"antithesis_sdk": versionBlock})
|
||||
}
|
||||
|
||||
// package-level flag
|
||||
var hasEmitted atomic.Bool // initialzed to false
|
||||
|
||||
func emitAssert(ai *assertInfo) error {
|
||||
// The version message is emitted by the internal package when the
|
||||
// handler initializes, before any output can happen.
|
||||
if hasEmitted.CompareAndSwap(false, true) {
|
||||
versionMessage()
|
||||
}
|
||||
return internal.Json_data(wrappedAssertInfo{ai})
|
||||
}
|
||||
+8
-87
@@ -3,12 +3,10 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
crand "crypto/rand"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"math/rand"
|
||||
"os"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func Json_data(v any) error {
|
||||
@@ -28,18 +26,6 @@ func Notify(edge uint64) bool {
|
||||
return handler.notify(edge)
|
||||
}
|
||||
|
||||
// NotifyV2 reports a coverage hit through the lease ABI (linkage v2); ok is
|
||||
// false when the loaded library does not support leases.
|
||||
func NotifyV2(edge uint64, hits uint64) (uint64, bool) {
|
||||
return handler.notify_v2(edge, hits)
|
||||
}
|
||||
|
||||
// LeaseGeneration reads the lease revocation word; ok is false when the
|
||||
// loaded library does not support leases.
|
||||
func LeaseGeneration() (uint64, bool) {
|
||||
return handler.lease_generation()
|
||||
}
|
||||
|
||||
func InitCoverage(num_edges uint64, symbols string) uint64 {
|
||||
return handler.init_coverage(num_edges, symbols)
|
||||
}
|
||||
@@ -48,8 +34,6 @@ type libHandler interface {
|
||||
output(message string)
|
||||
random() uint64
|
||||
notify(edge uint64) bool
|
||||
notify_v2(edge uint64, hits uint64) (uint64, bool)
|
||||
lease_generation() (uint64, bool)
|
||||
init_coverage(num_edges uint64, symbols string) uint64
|
||||
}
|
||||
|
||||
@@ -59,13 +43,6 @@ const (
|
||||
|
||||
var handler libHandler
|
||||
|
||||
// Mirrors the no_antithesis_sdk implementation of random.GetRandom.
|
||||
func osRandom() uint64 {
|
||||
var tmp [8]byte
|
||||
crand.Read(tmp[:])
|
||||
return binary.LittleEndian.Uint64(tmp[:])
|
||||
}
|
||||
|
||||
type localHandler struct {
|
||||
outputFile *os.File // can be nil
|
||||
}
|
||||
@@ -81,21 +58,13 @@ func (h *localHandler) output(message string) {
|
||||
}
|
||||
|
||||
func (h *localHandler) random() uint64 {
|
||||
return osRandom()
|
||||
return rand.Uint64()
|
||||
}
|
||||
|
||||
func (h *localHandler) notify(edge uint64) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (h *localHandler) notify_v2(edge uint64, hits uint64) (uint64, bool) {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
func (h *localHandler) lease_generation() (uint64, bool) {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
func (h *localHandler) init_coverage(num_edges uint64, symbols string) uint64 {
|
||||
return 0
|
||||
}
|
||||
@@ -106,32 +75,9 @@ func init() {
|
||||
// Otherwise fallback to the local handler.
|
||||
handler = openLocalHandler()
|
||||
}
|
||||
|
||||
// The version message is the first output of every run, emitted when the
|
||||
// handler comes up.
|
||||
emitVersionMessage()
|
||||
|
||||
if sdkRunningInDegradedMode {
|
||||
emitDegradedModeProperty()
|
||||
}
|
||||
}
|
||||
|
||||
func emitVersionMessage() {
|
||||
languageBlock := map[string]any{
|
||||
"name": "Go",
|
||||
"version": runtime.Version(),
|
||||
}
|
||||
versionBlock := map[string]any{
|
||||
"language": languageBlock,
|
||||
"sdk_version": SDK_Version,
|
||||
"protocol_version": Protocol_Version,
|
||||
}
|
||||
if data, err := json.Marshal(map[string]any{"antithesis_sdk": versionBlock}); err == nil {
|
||||
handler.output(string(data))
|
||||
}
|
||||
}
|
||||
|
||||
// If `localOutputEnvVar` is set to a non-empty path, attempt to open that path for appending
|
||||
// If `localOutputEnvVar` is set to a non-empty path, attempt to open that path and truncate the file
|
||||
// to serve as the log file of the local handler.
|
||||
// Otherwise, we don't have a log file, and logging is a no-op in the local handler.
|
||||
func openLocalHandler() *localHandler {
|
||||
@@ -140,40 +86,15 @@ func openLocalHandler() *localHandler {
|
||||
return &localHandler{nil}
|
||||
}
|
||||
|
||||
// Open the file for writing (create if needed and possible, use O_APPEND to support concurrent writers)
|
||||
file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
|
||||
// Open the file R/W (create if needed and possible)
|
||||
file, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, 0644)
|
||||
if err != nil {
|
||||
log.Printf("%s Failed to open path %s: %v", errorLogLinePrefix, path, err)
|
||||
file = nil
|
||||
} else if err = file.Truncate(0); err != nil {
|
||||
log.Printf("%s Failed to truncate file at %s: %v", errorLogLinePrefix, path, err)
|
||||
file = nil
|
||||
}
|
||||
|
||||
return &localHandler{file}
|
||||
}
|
||||
|
||||
const degradedModeProperty = "Go application under test compiled with CGO enabled"
|
||||
|
||||
func emitDegradedModeProperty() {
|
||||
Json_data(map[string]any{
|
||||
"antithesis_assert": map[string]any{
|
||||
"hit": true,
|
||||
"must_hit": true,
|
||||
"assert_type": "always",
|
||||
"display_type": "Always",
|
||||
"message": degradedModeProperty,
|
||||
"id": degradedModeProperty,
|
||||
"condition": false,
|
||||
"location": map[string]any{
|
||||
"class": "",
|
||||
"function": "",
|
||||
"file": "",
|
||||
"begin_line": 0,
|
||||
"begin_column": 0,
|
||||
},
|
||||
"details": map[string]any{
|
||||
"info": "This binary was built without CGO enabled, which is required for " +
|
||||
"coverage-guided fuzzing and thread pausing. Rebuild with CGO_ENABLED=1 so the " +
|
||||
"SDK can link " + defaultNativeLibraryPath + " to enable them.",
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
+1
-8
@@ -3,17 +3,10 @@ package internal
|
||||
// --------------------------------------------------------------------------------
|
||||
// Versions
|
||||
// --------------------------------------------------------------------------------
|
||||
const SDK_Version = "0.8.0"
|
||||
const SDK_Version = "0.7.2"
|
||||
const Protocol_Version = "1.1.0"
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Environment Vars
|
||||
// --------------------------------------------------------------------------------
|
||||
const localOutputEnvVar = "ANTITHESIS_SDK_LOCAL_OUTPUT"
|
||||
const outputDirEnvVar = "ANTITHESIS_OUTPUT_DIR"
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Paths
|
||||
// --------------------------------------------------------------------------------
|
||||
const defaultNativeLibraryPath = "/usr/lib/libvoidstar.so"
|
||||
const fallbackOutputFilename = "sdk.jsonl"
|
||||
+5
-75
@@ -5,7 +5,6 @@ package internal
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@@ -61,36 +60,18 @@ import (
|
||||
// return ((go_init_coverage_fn)f)(num_edges, symbols);
|
||||
// }
|
||||
//
|
||||
// typedef uint64_t (*go_notify_coverage_v2_fn)(size_t, uint64_t);
|
||||
// uint64_t
|
||||
// go_notify_coverage_v2(void *f, size_t edge, uint64_t hits) {
|
||||
// return ((go_notify_coverage_v2_fn)f)(edge, hits);
|
||||
// }
|
||||
//
|
||||
// typedef const uint64_t *(*go_lease_generation_addr_fn)(void);
|
||||
// const uint64_t *
|
||||
// go_lease_generation_addr(void *f) {
|
||||
// return ((go_lease_generation_addr_fn)f)();
|
||||
// }
|
||||
//
|
||||
// typedef uint64_t (*go_request_abi_version_fn)(uint64_t);
|
||||
// uint64_t
|
||||
// go_request_abi_version(void *f, uint64_t v) {
|
||||
// return ((go_request_abi_version_fn)f)(v);
|
||||
// }
|
||||
//
|
||||
import "C"
|
||||
|
||||
const (
|
||||
defaultNativeLibraryPath = "/usr/lib/libvoidstar.so"
|
||||
)
|
||||
|
||||
type voidstarHandler struct {
|
||||
fuzzJsonData unsafe.Pointer
|
||||
fuzzFlush unsafe.Pointer
|
||||
fuzzGetRandom unsafe.Pointer
|
||||
initCoverage unsafe.Pointer
|
||||
notifyCoverage unsafe.Pointer
|
||||
// Coverage-lease support (linkage ABI v2, instrumentation.h). Nil/zero
|
||||
// when the loaded library predates the mechanism or negotiation failed.
|
||||
notifyCoverageV2 unsafe.Pointer
|
||||
leaseGeneration *uint64
|
||||
}
|
||||
|
||||
func (h *voidstarHandler) output(message string) {
|
||||
@@ -119,23 +100,6 @@ func (h *voidstarHandler) notify(edge uint64) bool {
|
||||
return ival == 1
|
||||
}
|
||||
|
||||
func (h *voidstarHandler) notify_v2(edge uint64, hits uint64) (uint64, bool) {
|
||||
if h.notifyCoverageV2 == nil {
|
||||
return 0, false
|
||||
}
|
||||
return uint64(C.go_notify_coverage_v2(h.notifyCoverageV2, C.ulong(edge), C.uint64_t(hits))), true
|
||||
}
|
||||
|
||||
func (h *voidstarHandler) lease_generation() (uint64, bool) {
|
||||
if h.leaseGeneration == nil {
|
||||
return 0, false
|
||||
}
|
||||
// The header requires this read to be non-hoistable out of hot loops;
|
||||
// an atomic load has the required opaque semantics. The word lives for
|
||||
// the life of the process and is only ever written by the fuzzer.
|
||||
return atomic.LoadUint64(h.leaseGeneration), true
|
||||
}
|
||||
|
||||
// Attempt to load libvoidstar and some symbols from `path`
|
||||
func openSharedLib(path string) (*voidstarHandler, error) {
|
||||
cstrPath := C.CString(path)
|
||||
@@ -159,17 +123,6 @@ func openSharedLib(path string) (*voidstarHandler, error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Symbols absent from older library vintages must resolve softly: no
|
||||
// library version may fail the SDK's load (instrumentation.h, "Linkage
|
||||
// ABI versioning").
|
||||
loadOptional := func(name string) unsafe.Pointer {
|
||||
cstrName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cstrName))
|
||||
symbol := C.dlsym(sharedLib, cstrName)
|
||||
C.dlerror() // clear any lookup error
|
||||
return symbol
|
||||
}
|
||||
|
||||
fuzzJsonData, err := loadFunc("fuzz_json_data")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -190,32 +143,9 @@ func openSharedLib(path string) (*voidstarHandler, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
handler := &voidstarHandler{
|
||||
fuzzJsonData: fuzzJsonData,
|
||||
fuzzFlush: fuzzFlush,
|
||||
fuzzGetRandom: fuzzGetRandom,
|
||||
initCoverage: initCoverage,
|
||||
notifyCoverage: notifyCoverage,
|
||||
}
|
||||
|
||||
// Negotiate for coverage leases: request ABI v2 and gate on the granted
|
||||
// version (a grant above the request means "cannot negotiate").
|
||||
requestAbi := loadOptional("instrumentation_request_abi_version")
|
||||
notifyV2 := loadOptional("notify_coverage_v2")
|
||||
leaseAddr := loadOptional("coverage_lease_generation_addr")
|
||||
if requestAbi != nil && notifyV2 != nil && leaseAddr != nil {
|
||||
if granted := uint64(C.go_request_abi_version(requestAbi, 2)); granted == 2 {
|
||||
if addr := C.go_lease_generation_addr(leaseAddr); addr != nil {
|
||||
handler.notifyCoverageV2 = notifyV2
|
||||
handler.leaseGeneration = (*uint64)(unsafe.Pointer(addr))
|
||||
}
|
||||
}
|
||||
}
|
||||
return handler, nil
|
||||
return &voidstarHandler{fuzzJsonData, fuzzFlush, fuzzGetRandom, initCoverage, notifyCoverage}, nil
|
||||
}
|
||||
|
||||
const sdkRunningInDegradedMode = false
|
||||
|
||||
// If we have a file at `defaultNativeLibraryPath`, we load the shared library
|
||||
// (and panic on any error encountered during load).
|
||||
func init_in_antithesis() libHandler {
|
||||
|
||||
Generated
Vendored
-58
@@ -1,58 +0,0 @@
|
||||
//go:build enable_antithesis_sdk && linux && amd64 && !cgo
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
const sdkRunningInDegradedMode = true
|
||||
|
||||
type inAntithesisWithoutCgoHandler struct {
|
||||
outputFile *os.File
|
||||
}
|
||||
|
||||
func (h *inAntithesisWithoutCgoHandler) output(message string) {
|
||||
if len(message) == 0 {
|
||||
return
|
||||
}
|
||||
h.outputFile.WriteString(message + "\n")
|
||||
}
|
||||
|
||||
func (h *inAntithesisWithoutCgoHandler) random() uint64 {
|
||||
return osRandom()
|
||||
}
|
||||
|
||||
func (h *inAntithesisWithoutCgoHandler) notify(edge uint64) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (h *inAntithesisWithoutCgoHandler) init_coverage(num_edges uint64, symbols string) uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (h *inAntithesisWithoutCgoHandler) notify_v2(edge uint64, hits uint64) (uint64, bool) {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
func (h *inAntithesisWithoutCgoHandler) lease_generation() (uint64, bool) {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
func init_in_antithesis() libHandler {
|
||||
dir, is_set := os.LookupEnv(outputDirEnvVar)
|
||||
if !is_set || len(dir) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
path := filepath.Join(dir, fallbackOutputFilename)
|
||||
file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
|
||||
if err != nil {
|
||||
log.Printf("%s Failed to open path %s: %v", errorLogLinePrefix, path, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
return &inAntithesisWithoutCgoHandler{file}
|
||||
}
|
||||
Generated
Vendored
+1
-3
@@ -1,9 +1,7 @@
|
||||
//go:build enable_antithesis_sdk && (!linux || !amd64)
|
||||
//go:build enable_antithesis_sdk && (!linux || !amd64 || !cgo)
|
||||
|
||||
package internal
|
||||
|
||||
const sdkRunningInDegradedMode = false
|
||||
|
||||
func init_in_antithesis() libHandler {
|
||||
return nil
|
||||
}
|
||||
-19
@@ -1,22 +1,3 @@
|
||||
Release 1.8.1
|
||||
=============
|
||||
|
||||
**Fixes**
|
||||
|
||||
* Fixed a panic-causing bug in all Remove functions.
|
||||
|
||||
Release 1.8.0
|
||||
=============
|
||||
|
||||
**Changes**
|
||||
|
||||
* Added the `Remove` function to all token types, allowing for the easy
|
||||
removal of a token from its parent element.
|
||||
|
||||
**Fixes**
|
||||
|
||||
* Cleaned up several comments for clarity and typo corrections.
|
||||
|
||||
Release 1.7.1
|
||||
=============
|
||||
|
||||
|
||||
+26
-73
@@ -214,7 +214,6 @@ type Writer interface {
|
||||
type Token interface {
|
||||
Parent() *Element
|
||||
Index() int
|
||||
Remove() bool
|
||||
WriteTo(w Writer, s *WriteSettings)
|
||||
dup(parent *Element) Token
|
||||
setParent(parent *Element)
|
||||
@@ -1391,27 +1390,19 @@ func (e *Element) PrevSibling() *Element {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Parent returns the element's parent element, or nil if the element has no
|
||||
// parent.
|
||||
// Parent returns this element's parent element. It returns nil if this
|
||||
// element has no parent.
|
||||
func (e *Element) Parent() *Element {
|
||||
return e.parent
|
||||
}
|
||||
|
||||
// Index returns the index of the element within its parent element's list of
|
||||
// child tokens. If the element has no parent, the function returns -1.
|
||||
// Index returns the index of this element within its parent element's
|
||||
// list of child tokens. If this element has no parent, then the function
|
||||
// returns -1.
|
||||
func (e *Element) Index() int {
|
||||
return e.index
|
||||
}
|
||||
|
||||
// Remove attempts to remove the element from the parent element that contains
|
||||
// it. If the element has no parent, the function returns false.
|
||||
func (e *Element) Remove() bool {
|
||||
if e.parent == nil {
|
||||
return false
|
||||
}
|
||||
return e.parent.RemoveChild(e) != nil
|
||||
}
|
||||
|
||||
// WriteTo serializes the element to the writer w.
|
||||
func (e *Element) WriteTo(w Writer, s *WriteSettings) {
|
||||
w.WriteByte('<')
|
||||
@@ -1633,7 +1624,7 @@ func (c *CharData) SetData(text string) {
|
||||
}
|
||||
}
|
||||
|
||||
// IsCData returns true if this CharData token contains a CDATA section. It
|
||||
// IsCData returns true if this CharData token is contains a CDATA section. It
|
||||
// returns false if the CharData token contains simple text.
|
||||
func (c *CharData) IsCData() bool {
|
||||
return (c.flags & cdataFlag) != 0
|
||||
@@ -1644,30 +1635,20 @@ func (c *CharData) IsWhitespace() bool {
|
||||
return (c.flags & whitespaceFlag) != 0
|
||||
}
|
||||
|
||||
// Parent returns the CharData token's parent element, or nil if the token has
|
||||
// no parent.
|
||||
// Parent returns this CharData token's parent element, or nil if it has no
|
||||
// parent.
|
||||
func (c *CharData) Parent() *Element {
|
||||
return c.parent
|
||||
}
|
||||
|
||||
// Index returns the index of the CharData token within its parent element's
|
||||
// list of child tokens. If the CharData token has no parent, the function
|
||||
// returns -1.
|
||||
// Index returns the index of this CharData token within its parent element's
|
||||
// list of child tokens. If this CharData token has no parent, then the
|
||||
// function returns -1.
|
||||
func (c *CharData) Index() int {
|
||||
return c.index
|
||||
}
|
||||
|
||||
// Remove attempts to remove the CharData token from the parent element that
|
||||
// contains it. If the CharData token has no parent, the function returns
|
||||
// false.
|
||||
func (c *CharData) Remove() bool {
|
||||
if c.parent == nil {
|
||||
return false
|
||||
}
|
||||
return c.parent.RemoveChild(c) != nil
|
||||
}
|
||||
|
||||
// WriteTo serializes CharData token to the writer.
|
||||
// WriteTo serializes character data to the writer.
|
||||
func (c *CharData) WriteTo(w Writer, s *WriteSettings) {
|
||||
if c.IsCData() {
|
||||
w.WriteString(`<![CDATA[`)
|
||||
@@ -1738,28 +1719,19 @@ func (c *Comment) dup(parent *Element) Token {
|
||||
}
|
||||
}
|
||||
|
||||
// Parent returns the comment's parent element, or nil if the comment has no
|
||||
// parent.
|
||||
// Parent returns comment token's parent element, or nil if it has no parent.
|
||||
func (c *Comment) Parent() *Element {
|
||||
return c.parent
|
||||
}
|
||||
|
||||
// Index returns the index of the comment within its parent element's list of
|
||||
// child tokens. If the comment has no parent, the function returns -1.
|
||||
// Index returns the index of this Comment token within its parent element's
|
||||
// list of child tokens. If this Comment token has no parent, then the
|
||||
// function returns -1.
|
||||
func (c *Comment) Index() int {
|
||||
return c.index
|
||||
}
|
||||
|
||||
// Remove attempts to remove the comment from the parent element that contains
|
||||
// it. If the comment has no parent, the function returns false.
|
||||
func (c *Comment) Remove() bool {
|
||||
if c.parent == nil {
|
||||
return false
|
||||
}
|
||||
return c.parent.RemoveChild(c) != nil
|
||||
}
|
||||
|
||||
// WriteTo serializes the comment to the writer.
|
||||
// WriteTo serialies the comment to the writer.
|
||||
func (c *Comment) WriteTo(w Writer, s *WriteSettings) {
|
||||
w.WriteString("<!--")
|
||||
sanitizeComment(w, c.Data)
|
||||
@@ -1811,28 +1783,19 @@ func (d *Directive) dup(parent *Element) Token {
|
||||
}
|
||||
}
|
||||
|
||||
// Parent returns the XML directive's parent element, or nil if it has no
|
||||
// Parent returns directive token's parent element, or nil if it has no
|
||||
// parent.
|
||||
func (d *Directive) Parent() *Element {
|
||||
return d.parent
|
||||
}
|
||||
|
||||
// Index returns the index of the XML directive within its parent element's
|
||||
// list of child tokens. If the directive has no parent, the function returns
|
||||
// -1.
|
||||
// Index returns the index of this Directive token within its parent element's
|
||||
// list of child tokens. If this Directive token has no parent, then the
|
||||
// function returns -1.
|
||||
func (d *Directive) Index() int {
|
||||
return d.index
|
||||
}
|
||||
|
||||
// Remove attempts to remove the XML directive from the parent element that
|
||||
// contains it. If the directive has no parent, the function returns false.
|
||||
func (d *Directive) Remove() bool {
|
||||
if d.parent == nil {
|
||||
return false
|
||||
}
|
||||
return d.parent.RemoveChild(d) != nil
|
||||
}
|
||||
|
||||
// WriteTo serializes the XML directive to the writer.
|
||||
func (d *Directive) WriteTo(w Writer, s *WriteSettings) {
|
||||
w.WriteString("<!")
|
||||
@@ -1888,30 +1851,20 @@ func (p *ProcInst) dup(parent *Element) Token {
|
||||
}
|
||||
}
|
||||
|
||||
// Parent returns XML processing instruction's parent element, or nil if it
|
||||
// Parent returns processing instruction token's parent element, or nil if it
|
||||
// has no parent.
|
||||
func (p *ProcInst) Parent() *Element {
|
||||
return p.parent
|
||||
}
|
||||
|
||||
// Index returns the index of the XML processing instruction within its parent
|
||||
// element's list of child tokens. If the processing instruction has no
|
||||
// parent, the function returns -1.
|
||||
// Index returns the index of this ProcInst token within its parent element's
|
||||
// list of child tokens. If this ProcInst token has no parent, then the
|
||||
// function returns -1.
|
||||
func (p *ProcInst) Index() int {
|
||||
return p.index
|
||||
}
|
||||
|
||||
// Remove attempts to remove the XML processing instruction from the parent
|
||||
// element that contains it. If the processing instruction has no parent, the
|
||||
// function returns false.
|
||||
func (p *ProcInst) Remove() bool {
|
||||
if p.parent == nil {
|
||||
return false
|
||||
}
|
||||
return p.parent.RemoveChild(p) != nil
|
||||
}
|
||||
|
||||
// WriteTo serializes the XML processing instruction to the writer.
|
||||
// WriteTo serializes the processing instruction to the writer.
|
||||
func (p *ProcInst) WriteTo(w Writer, s *WriteSettings) {
|
||||
w.WriteString("<?")
|
||||
sanitizeProcInst(w, p.Target)
|
||||
|
||||
Loaded 100 of 624 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user