Skip to content

Commit 9661db0

Browse files
committed
feat: proxy-pac-url support
1 parent a4d7cbe commit 9661db0

File tree

8 files changed

+3282
-5844
lines changed

8 files changed

+3282
-5844
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/src/config.js
33
.terraform*
44
*.tfstate*
5+
.idea

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# syntax=docker/dockerfile:1.4.3
22

3-
FROM node:18.9.0-buster-slim AS build
3+
FROM node:24-slim AS build
44
WORKDIR /app
55
RUN apt-get update && apt-get install -y \
66
g++ make cmake unzip libcurl4-openssl-dev autoconf libtool python3 curl
77
COPY package.json package-lock.json ./
88
RUN npm ci
99

10-
FROM node:18.9.0-buster-slim
10+
FROM node:24-slim
1111
WORKDIR /app
1212
RUN apt-get update && apt-get install -y --no-install-recommends \
1313
libglib2.0-0 libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ After applying, Terraform outputs a `submit_url`. To submit a URL to the admin b
3737

3838
### GCP
3939

40-
2. Build and push the image to [`gcr.io`](https://cloud.google.com/container-registry) or [`pkg.dev`](https://cloud.google.com/artifact-registry).
41-
1. Use the [Terraform module](https://registry.terraform.io/modules/redpwn/admin-bot/google/latest) to deploy to Cloud Run.
40+
1. Build and push the image to [`gcr.io`](https://cloud.google.com/container-registry) or [`pkg.dev`](https://cloud.google.com/artifact-registry).
41+
2. Use the [Terraform module](https://registry.terraform.io/modules/redpwn/admin-bot/google/latest) to deploy to Cloud Run.
4242

4343
### AWS
4444

45-
2. Build and push the image to [ECR](https://aws.amazon.com/ecr/).
46-
1. Use the [Terraform module](https://registry.terraform.io/modules/redpwn/admin-bot/aws/latest) to deploy to Fargate and Lambda.
45+
1. Build and push the image to [ECR](https://aws.amazon.com/ecr/).
46+
2. Use the [Terraform module](https://registry.terraform.io/modules/redpwn/admin-bot/aws/latest) to deploy to Fargate and Lambda.
4747

4848
## Challenge Configuration
4949

@@ -54,11 +54,22 @@ The key of each entry is its challenge ID. To submit a URL to the admin bot, vis
5454
The value of each entry is an object with properties:
5555

5656
* `name`: the display name of the challenge
57+
* `restrict_domains`: see below for a more in-depth explanation
5758
* `timeout`: the timeout in milliseconds for each admin bot visit
5859
* `handler`: a function which returns a `Promise` and accepts the submitted URL and a [Puppeteer `BrowserContext`](https://pptr.dev/#?show=api-class-browsercontext)
5960
* `urlRegex` (optional): a regex to check the URL against (default: `/^https?:\/\//`)
6061

61-
To mitigate possible Chrome vulnerabilities, JIT/WebAssembly is disabled.
62+
To prevent cookie tossing (and other cheeses) from another vulnerable challenge on the same domain, we also support providing the
63+
`restrict_domains` option, where one can provide a list of domains and their subdomains that should be accessible. Any subdomain of a domain that is not part of the list will automatically
64+
fail. For example, if all challenges are hosted under `example.com`, one can restrict access to only the challenge-specific subdomain `one.example.com` with the following configuration:
65+
```js
66+
restrict_domains: {
67+
'example.com': ['one.example.com']
68+
}
69+
```
70+
Behind the scenes, the --proxy-pac-url flag is used to tell browser how the restricted URLs should be handled.
71+
72+
Additionally, to mitigate possible Chrome vulnerabilities, JIT/WebAssembly is disabled.
6273

6374
## Terraform Configuration
6475

examples/image/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ const sleep = time => new Promise(resolve => setTimeout(resolve, time))
33
const challenges = new Map([
44
['one', {
55
name: 'Challenge One',
6+
restrict_domains: {
7+
'example.com': ['one.example.com'],
8+
},
69
timeout: 10000,
710
handler: async (url, ctx) => {
811
const page = await ctx.newPage()

0 commit comments

Comments
 (0)