Files
higress/test/e2e/conformance/tests/go-wasm-replay-protection.yaml
yunmaoQu f45bc9008a feat: add replay protection plugin (#1672)
Co-authored-by: hanxiantao <601803023@qq.com>
2025-03-10 15:11:13 +08:00

88 lines
2.1 KiB
YAML

# Copyright (c) 2025 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Deploy Redis service
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: higress-conformance-infra
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:6.2
ports:
- containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: higress-conformance-infra
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: replay-protection
namespace: higress-conformance-infra
spec:
ingressClassName: higress
rules:
- host: "foo.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: infra-backend-v1
port:
number: 8080
---
# Configure WasmPlugin
apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
name: replay-protection
namespace: higress-system
spec:
defaultConfig:
force_nonce: true
nonce_ttl: 86400
nonce_header: "X-Higress-Nonce"
nonce_min_length: 8
nonce_max_length: 128
validate_base64: true
reject_code: 429
redis:
service_name: "redis.higress-conformance-infra.svc.cluster.local"
service_port: 6379
timeout: 1000
key_prefix: "replay-protection"
url: file:///opt/plugins/wasm-go/extensions/replay-protection/plugin.wasm