Skip to content

Commit 321430f

Browse files
authored
Merge pull request #881 from OWASP/challengeport
(WIP) Upgrading to wrongsecrets 1.12.0 (WIP)
2 parents eefebda + 78d63af commit 321430f

File tree

24 files changed

+2534
-2372
lines changed

24 files changed

+2534
-2372
lines changed

.github/workflows/minikube-k8s-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ jobs:
2323
- name: Start minikube
2424
uses: medyagh/setup-minikube@master
2525
with:
26-
minikube-version: 1.33.1
26+
minikube-version: 1.35.0
2727
driver: docker
28-
kubernetes-version: v1.30.0
28+
kubernetes-version: v1.32.0
2929
- name: test script
3030
run: |
3131
eval $(minikube docker-env)
@@ -48,9 +48,9 @@ jobs:
4848
- name: Start minikube
4949
uses: medyagh/setup-minikube@master
5050
with:
51-
minikube-version: 1.33.1
51+
minikube-version: 1.35.0
5252
driver: docker
53-
kubernetes-version: v1.30.0
53+
kubernetes-version: v1.32.0
5454
- name: test script
5555
run: |
5656
eval $(minikube docker-env)

build-and-deploy-container-minikube.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ source ./scripts/check-available-commands.sh
44
checkCommandsAvailable helm docker kubectl yq minikube
55

66
minikube delete
7-
minikube start --cpus=6 --memory=8000MB --network-plugin=cni --cni=calico --driver=docker --kubernetes-version=1.30.0
7+
minikube start --cpus=6 --memory=8000MB --network-plugin=cni --cni=calico --driver=docker --kubernetes-version=1.32.0
88
eval $(minikube docker-env)
99
./build-and-deploy-container.sh
1010

build-and-deploy-container.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ WRONGSECRETS_BALANCER_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.
1919
WRONGSECRETS_BALANCER_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.balancer.tag')
2020
WRONGSECRETS_CLEANER_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecretsCleanup.repository')
2121
WRONGSECRETS_CLEANER_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecretsCleanup.tag')
22+
echo "doing workaround for selaed secrets"
23+
helm repo add sealed-secrets https://bitnami-labs.github.io/sealed-secrets
24+
helm install my-release sealed-secrets/sealed-secrets
2225
echo "Pulling in required images to actually run $WRONGSECRETS_IMAGE:$WRONGSECRETS_TAG & $WEBTOP_IMAGE:$WEBTOP_TAG."
2326
echo "If you see an authentication failure: pull them manually by the following 2 commands"
2427
echo "'docker pull $WRONGSECRETS_IMAGE:$WRONGSECRETS_TAG'"

build-and-deploy-minikube.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ source ./scripts/check-available-commands.sh
44
checkCommandsAvailable helm docker kubectl yq minikube
55

66
minikube delete
7-
minikube start --cpus=6 --memory=8000MB --network-plugin=cni --cni=calico --driver=docker --kubernetes-version=1.30.0
7+
minikube start --cpus=8 --memory=12000MB --network-plugin=cni --cni=calico --driver=docker --kubernetes-version=1.32.0
88
eval $(minikube docker-env)
99
./build-and-deploy.sh
1010

11-
sleep 15
11+
echo "Waiting for wrongsecrets-balancer pods to be ready..."
12+
kubectl wait --for=condition=ready pod -l app=wrongsecrets-balancer --timeout=2s
1213

1314
echo "let's go!"
1415

16+
echo "password base64 encoded: " + $(kubectl get secrets wrongsecrets-balancer-secret -o=jsonpath='{.data.adminPassword}')
17+
18+
1519
kubectl port-forward service/wrongsecrets-balancer 3000:3000
1620

1721
kubectl port-forward service/prometheus-server 9090:80

build-and-deploy.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ checkCommandsAvailable helm docker kubectl yq
1212
version="$(uuidgen)"
1313
eval $(minikube docker-env)
1414
docker login
15-
WRONGSECRETS_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecrets.image')
16-
WRONGSECRETS_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecrets.tag')
17-
WEBTOP_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.virtualdesktop.image')
18-
WEBTOP_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.virtualdesktop.tag')
15+
WRONGSECRETS_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml | yq '.wrongsecrets.image')
16+
WRONGSECRETS_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml | yq '.wrongsecrets.tag')
17+
WEBTOP_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml | yq '.virtualdesktop.image')
18+
WEBTOP_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml | yq '.virtualdesktop.tag')
19+
echo "doing workaround for selaed secrets"
20+
helm repo add sealed-secrets https://bitnami-labs.github.io/sealed-secrets
21+
helm install ws-sealedsecrets sealed-secrets/sealed-secrets --namespace kube-system
1922
echo "Pulling in required images to actually run $WRONGSECRETS_IMAGE:$WRONGSECRETS_TAG & $WEBTOP_IMAGE:$WEBTOP_TAG."
2023
echo "If you see an authentication failure: pull them manually by the following 2 commands"
2124
echo "'docker pull $WRONGSECRETS_IMAGE:$WRONGSECRETS_TAG'"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Mock for @kubernetes/client-node
2+
class MockKubeConfig {
3+
loadFromCluster() {
4+
// Mock implementation
5+
}
6+
7+
makeApiClient(ApiClass) {
8+
return new ApiClass();
9+
}
10+
}
11+
12+
class MockAppsV1Api {
13+
listNamespacedDeployment() {
14+
return Promise.resolve({
15+
body: {
16+
items: []
17+
}
18+
});
19+
}
20+
}
21+
22+
class MockCoreV1Api {
23+
listNamespace() {
24+
return Promise.resolve({
25+
body: {
26+
items: []
27+
}
28+
});
29+
}
30+
31+
deleteNamespace() {
32+
return Promise.resolve({});
33+
}
34+
}
35+
36+
module.exports = {
37+
KubeConfig: MockKubeConfig,
38+
AppsV1Api: MockAppsV1Api,
39+
CoreV1Api: MockCoreV1Api
40+
};

cleaner/jest.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
module.exports = {
22
setupFiles: ['./.jest/setEnvVars.js'],
3-
// ... other configurations
3+
testEnvironment: 'node',
4+
moduleNameMapper: {
5+
'^@kubernetes/client-node$': '<rootDir>/.jest/__mocks__/@kubernetes/client-node.js'
6+
}
47
};

0 commit comments

Comments
 (0)