├── .bin ├── license-engine.sh ├── licenses └── list-licenses ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── BUG-REPORT.yml │ ├── DESIGN-DOC.yml │ ├── FEATURE-REQUEST.yml │ └── config.yml ├── auto_assign.yml ├── config.yml ├── pull_request_template.md └── workflows │ ├── closed_references.yml │ ├── conventional_commits.yml │ ├── labels.yml │ ├── licenses.yml │ └── stale.yml ├── .gitignore ├── .reference-ignore ├── .reports └── dep-licenses.csv ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── backend ├── Dockerfile ├── config.go ├── db.go ├── db_sqlite.go ├── flag_test.go ├── go.mod ├── go.sum ├── handler.go ├── handler_auth.go ├── handler_flag.go ├── handler_index.go ├── handler_test.go ├── main.go ├── results.go ├── static │ ├── fa-brands.min.css │ ├── fa-solid.min.css │ ├── fontawesome.min.css │ ├── html │ │ ├── component-wrapper.d.ts │ │ ├── component-wrapper.d.ts.map │ │ ├── index.d.ts │ │ └── index.d.ts.map │ ├── index.d.ts │ ├── index.d.ts.map │ ├── index.es.js │ ├── index.es.js.map │ ├── inter-font.css │ ├── inter │ │ ├── Inter-Bold.woff │ │ ├── Inter-Bold.woff2 │ │ ├── Inter-Regular.woff │ │ ├── Inter-Regular.woff2 │ │ ├── Inter-SemiBold.woff │ │ └── Inter-SemiBold.woff2 │ ├── main.css │ ├── normalize.css │ ├── style.css │ ├── theme │ │ ├── button-link.css.d.ts │ │ ├── button-link.css.d.ts.map │ │ ├── button-social.css.d.ts │ │ ├── button-social.css.d.ts.map │ │ ├── button.css.d.ts │ │ ├── button.css.d.ts.map │ │ ├── card.css.d.ts │ │ ├── card.css.d.ts.map │ │ ├── checkbox.css.d.ts │ │ ├── checkbox.css.d.ts.map │ │ ├── colors.css.d.ts │ │ ├── colors.css.d.ts.map │ │ ├── consts.d.ts │ │ ├── consts.d.ts.map │ │ ├── divider.css.d.ts │ │ ├── divider.css.d.ts.map │ │ ├── grid.css.d.ts │ │ ├── grid.css.d.ts.map │ │ ├── index.d.ts │ │ ├── index.d.ts.map │ │ ├── input-field.css.d.ts │ │ ├── input-field.css.d.ts.map │ │ ├── message.css.d.ts │ │ ├── message.css.d.ts.map │ │ ├── theme.css.d.ts │ │ ├── theme.css.d.ts.map │ │ ├── typography.css.d.ts │ │ └── typography.css.d.ts.map │ ├── theming.js │ ├── utils.d.ts │ ├── utils.d.ts.map │ ├── vite-env.d.ts │ └── webfonts │ │ ├── fa-brands-400.ttf │ │ ├── fa-brands-400.woff2 │ │ ├── fa-solid-900.ttf │ │ └── fa-solid-900.woff2 └── ui │ ├── error.html │ ├── index.html │ ├── leaderboard.html │ ├── login.html │ └── register.html ├── configs ├── identity.schema.json ├── keto.yml ├── keto_entrypoint.sh ├── kratos.yml ├── oathkeeper.yml └── oathkeeper_rules.json └── docker-compose.yml /.bin/license-engine.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script detects non-compliant licenses in the output of language-specific license checkers. 4 | 5 | # These licenses are allowed. 6 | # These are the exact and complete license strings for 100% legal certainty, no regexes. 7 | ALLOWED_LICENSES=( 8 | '0BSD' 9 | 'AFLv2.1' 10 | 'AFLv2.1,BSD' 11 | '(AFL-2.1 OR BSD-3-Clause)' 12 | 'Apache 2.0' 13 | 'Apache-2.0' 14 | '(Apache-2.0 OR MPL-1.1)' 15 | 'Apache-2.0 AND MIT' 16 | 'Apache License, Version 2.0' 17 | 'Apache*' 18 | 'Artistic-2.0' 19 | 'BlueOak-1.0.0' 20 | 'BSD' 21 | 'BSD*' 22 | 'BSD-2-Clause' 23 | '(BSD-2-Clause OR MIT OR Apache-2.0)' 24 | 'BSD-3-Clause' 25 | '(BSD-3-Clause OR GPL-2.0)' 26 | 'BSD-3-Clause OR MIT' 27 | '(BSD-3-Clause AND Apache-2.0)' 28 | 'CC0-1.0' 29 | 'CC-BY-3.0' 30 | 'CC-BY-4.0' 31 | '(CC-BY-4.0 AND MIT)' 32 | 'ISC' 33 | 'ISC*' 34 | 'LGPL-2.1' # LGPL allows commercial use, requires only that modifications to LGPL-protected libraries are published under a GPL-compatible license 35 | 'MIT' 36 | 'MIT*' 37 | 'MIT-0' 38 | 'MIT AND ISC' 39 | '(MIT AND BSD-3-Clause)' 40 | '(MIT AND Zlib)' 41 | '(MIT OR Apache-2.0)' 42 | '(MIT OR CC0-1.0)' 43 | '(MIT OR GPL-2.0)' 44 | 'MPL-2.0' 45 | '(MPL-2.0 OR Apache-2.0)' 46 | 'Public Domain' 47 | 'Python-2.0' # the Python-2.0 is a permissive license, see https://en.wikipedia.org/wiki/Python_License 48 | 'Unlicense' 49 | 'WTFPL' 50 | 'WTFPL OR ISC' 51 | '(WTFPL OR MIT)' 52 | '(MIT OR WTFPL)' 53 | 'LGPL-3.0-or-later' # Requires only that modifications to LGPL-protected libraries are published under a GPL-compatible license which is not the case at Ory 54 | ) 55 | 56 | # These modules don't work with the current license checkers 57 | # and have been manually verified to have a compatible license (regex format). 58 | APPROVED_MODULES=( 59 | 'https://github.com/ory-corp/cloud/' # Ory IP 60 | 'github.com/ory/hydra-client-go' # Apache-2.0 61 | 'github.com/ory/hydra-client-go/v2' # Apache-2.0 62 | 'github.com/ory/kratos-client-go' # Apache-2.0 63 | 'github.com/gobuffalo/github_flavored_markdown' # MIT 64 | 'buffers@0.1.1' # MIT: original source at http://github.com/substack/node-bufferlist is deleted but a fork at https://github.com/pkrumins/node-bufferlist/blob/master/LICENSE contains the original license by the original author (James Halliday) 65 | 'https://github.com/iconify/iconify/packages/react' # MIT: license is in root of monorepo at https://github.com/iconify/iconify/blob/main/license.txt 66 | 'github.com/gobuffalo/.*' # MIT: license is in root of monorepo at https://github.com/gobuffalo/github_flavored_markdown/blob/main/LICENSE 67 | 'github.com/ory-corp/cloud/.*' # Ory IP 68 | 'github.com/golang/freetype/.*' # FreeType license: https://freetype.sourceforge.net/FTL.TXT 69 | 'go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift' # Incorrect detection, actually Apache-2.0: https://github.com/open-telemetry/opentelemetry-go/blob/exporters/jaeger/v1.17.0/exporters/jaeger/internal/third_party/thrift/LICENSE 70 | 'go.uber.org/zap/exp/.*' # MIT license is in root of exp folder in monorepo at https://github.com/uber-go/zap/blob/master/exp/LICENSE 71 | 'github.com/ory/client-go' # Apache-2.0 72 | 'github.com/ian-kent/linkio' # BSD - https://github.com/ian-kent/linkio/blob/97566b8728870dac1c9863ba5b0f237c39166879/linkio.go#L1-L3 73 | 'github.com/t-k/fluent-logger-golang/fluent' # Apache-2.0 https://github.com/t-k/fluent-logger-golang/blob/master/LICENSE 74 | 'github.com/jmespath/go-jmespath' # Apache-2.0 https://github.com/jmespath/go-jmespath/blob/master/LICENSE 75 | 'github.com/ory/keto/proto/ory/keto/opl/v1alpha1' # Apache-2.0 - submodule of keto 76 | 'github.com/ory/keto/proto/ory/keto/relation_tuples/v1alpha2' # Apache-2.0 - submodule of keto 77 | '@ory-corp/.*' # Ory IP 78 | 'github.com/apache/arrow/.*' # Apache-2.0 https://github.com/apache/arrow/blob/main/LICENSE.txt 79 | 'github.com/ory-corp/webhook-target' # Ory IP 80 | '@ory/keto-grpc-client.*' # Apache-2.0 - submodule of keto 81 | 'golden-fleece@1.0.9' # MIT: https://github.com/Rich-Harris/golden-fleece/blob/master/LICENSE 82 | 'github.com/gogo/googleapis/.*' # Apache-2.0 https://github.com/gogo/googleapis/blob/master/LICENSE 83 | ) 84 | 85 | # These lines in the output should be ignored (plain text, no regex). 86 | IGNORE_LINES=( 87 | '"module name","licenses"' # header of license output for Node.js 88 | ) 89 | 90 | echo_green() { 91 | printf "\e[1;92m%s\e[0m\n" "$@" 92 | } 93 | 94 | echo_red() { 95 | printf "\e[0;91m%s\e[0m\n" "$@" 96 | } 97 | 98 | # capture STDIN 99 | input=$(cat -) 100 | 101 | # remove ignored lines 102 | for ignored in "${IGNORE_LINES[@]}"; do 103 | input=$(echo "$input" | grep -vF "$ignored") 104 | done 105 | 106 | # remove pre-approved modules 107 | for approved in "${APPROVED_MODULES[@]}"; do 108 | input=$(echo "$input" | grep -vE "\"${approved}\"") 109 | input=$(echo "$input" | grep -vE "\"Custom: ${approved}\"") 110 | done 111 | 112 | # remove allowed licenses 113 | for allowed in "${ALLOWED_LICENSES[@]}"; do 114 | input=$(echo "$input" | grep -vF "\"${allowed}\"") 115 | done 116 | 117 | # anything left in the input at this point is a module with an invalid license 118 | 119 | # print outcome 120 | if [ -z "$input" ]; then 121 | echo_green "Licenses are okay." 122 | else 123 | echo_red "Unknown licenses found!" 124 | echo "$input" 125 | exit 1 126 | fi 127 | -------------------------------------------------------------------------------- /.bin/licenses: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # Get the directory where this script is located 5 | bin_dir="$(cd "$(dirname "$0")" && pwd)" 6 | 7 | { echo "Checking licenses ..."; } 2>/dev/null 8 | "${bin_dir}/list-licenses" | "${bin_dir}/license-engine.sh" 9 | -------------------------------------------------------------------------------- /.bin/list-licenses: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | bin_dir="$(cd "$(dirname "$0")" && pwd)" 5 | 6 | # list Node licenses 7 | if [ -f package.json ]; then 8 | if jq -e '.dependencies and (.dependencies | keys | length > 0)' package.json >/dev/null; then 9 | npx --yes license-checker --production --csv --excludePrivatePackages --customPath "${bin_dir}"/license-template-node.json | grep -v '^$' 10 | echo 11 | else 12 | echo "No dependencies found in package.json" >&2 13 | echo 14 | fi 15 | fi 16 | 17 | # list Go licenses 18 | if [ -f go.mod ]; then 19 | # List all direct Go module dependencies, transform their paths to root module paths 20 | # (e.g., github.com/ory/x instead of github.com/ory/x/foo/bar), and generate a license report 21 | # for each unique root module. This ensures that the license report is generated for the root 22 | # module of a repository, where licenses are typically defined. 23 | go_modules=$( 24 | go list -f "{{if not .Indirect}}{{.Path}}{{end}}" -m ... | 25 | sort -u | 26 | awk -F/ '{ if ($1 == "github.com" && NF >= 3) { print $1"/"$2"/"$3 } else { print } }' | 27 | sort -u 28 | ) 29 | if [ -z "$go_modules" ]; then 30 | echo "No Go modules found" >&2 31 | else 32 | # Workaround until https://github.com/google/go-licenses/issues/307 is fixed 33 | # .bin/go-licenses report "$module_name" --template .bin/license-template-go.tpl 2>/dev/null 34 | # 35 | echo "$go_modules" | xargs -I {} sh -c '.bin/go-licenses report --template .bin/license-template-go.tpl {}' | grep -v '^$' 36 | echo 37 | fi 38 | fi 39 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/FUNDING.yml 3 | 4 | # These are supported funding model platforms 5 | 6 | # github: 7 | patreon: _ory 8 | open_collective: ory 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG-REPORT.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/ISSUE_TEMPLATE/BUG-REPORT.yml 3 | 4 | description: "Create a bug report" 5 | labels: 6 | - bug 7 | name: "Bug Report" 8 | body: 9 | - attributes: 10 | value: "Thank you for taking the time to fill out this bug report!\n" 11 | type: markdown 12 | - attributes: 13 | label: "Preflight checklist" 14 | options: 15 | - label: 16 | "I could not find a solution in the existing issues, docs, nor 17 | discussions." 18 | required: true 19 | - label: 20 | "I agree to follow this project's [Code of 21 | Conduct](https://github.com/ory/defcon-30-ctf/blob/master/CODE_OF_CONDUCT.md)." 22 | required: true 23 | - label: 24 | "I have read and am following this repository's [Contribution 25 | Guidelines](https://github.com/ory/defcon-30-ctf/blob/master/CONTRIBUTING.md)." 26 | required: true 27 | - label: 28 | "I have joined the [Ory Community Slack](https://slack.ory.sh)." 29 | - label: 30 | "I am signed up to the [Ory Security Patch 31 | Newsletter](https://www.ory.sh/l/sign-up-newsletter)." 32 | id: checklist 33 | type: checkboxes 34 | - attributes: 35 | description: 36 | "Enter the slug or API URL of the affected Ory Network project. Leave 37 | empty when you are self-hosting." 38 | label: "Ory Network Project" 39 | placeholder: "https://.projects.oryapis.com" 40 | id: ory-network-project 41 | type: input 42 | - attributes: 43 | description: "A clear and concise description of what the bug is." 44 | label: "Describe the bug" 45 | placeholder: "Tell us what you see!" 46 | id: describe-bug 47 | type: textarea 48 | validations: 49 | required: true 50 | - attributes: 51 | description: | 52 | Clear, formatted, and easy to follow steps to reproduce the behavior: 53 | placeholder: | 54 | Steps to reproduce the behavior: 55 | 56 | 1. Run `docker run ....` 57 | 2. Make API Request to with `curl ...` 58 | 3. Request fails with response: `{"some": "error"}` 59 | label: "Reproducing the bug" 60 | id: reproduce-bug 61 | type: textarea 62 | validations: 63 | required: true 64 | - attributes: 65 | description: 66 | "Please copy and paste any relevant log output. This will be 67 | automatically formatted into code, so no need for backticks. Please 68 | redact any sensitive information" 69 | label: "Relevant log output" 70 | render: shell 71 | placeholder: | 72 | log=error .... 73 | id: logs 74 | type: textarea 75 | - attributes: 76 | description: 77 | "Please copy and paste any relevant configuration. This will be 78 | automatically formatted into code, so no need for backticks. Please 79 | redact any sensitive information!" 80 | label: "Relevant configuration" 81 | render: yml 82 | placeholder: | 83 | server: 84 | admin: 85 | port: 1234 86 | id: config 87 | type: textarea 88 | - attributes: 89 | description: "What version of our software are you running?" 90 | label: Version 91 | id: version 92 | type: input 93 | validations: 94 | required: true 95 | - attributes: 96 | label: "On which operating system are you observing this issue?" 97 | options: 98 | - Ory Network 99 | - macOS 100 | - Linux 101 | - Windows 102 | - FreeBSD 103 | - Other 104 | id: operating-system 105 | type: dropdown 106 | - attributes: 107 | label: "In which environment are you deploying?" 108 | options: 109 | - Ory Network 110 | - Docker 111 | - "Docker Compose" 112 | - "Kubernetes with Helm" 113 | - Kubernetes 114 | - Binary 115 | - Other 116 | id: deployment 117 | type: dropdown 118 | - attributes: 119 | description: "Add any other context about the problem here." 120 | label: Additional Context 121 | id: additional 122 | type: textarea 123 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/DESIGN-DOC.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/ISSUE_TEMPLATE/DESIGN-DOC.yml 3 | 4 | description: 5 | "A design document is needed for non-trivial changes to the code base." 6 | labels: 7 | - rfc 8 | name: "Design Document" 9 | body: 10 | - attributes: 11 | value: | 12 | Thank you for writing this design document. 13 | 14 | One of the key elements of Ory's software engineering culture is the use of defining software designs through design docs. These are relatively informal documents that the primary author or authors of a software system or application create before they embark on the coding project. The design doc documents the high level implementation strategy and key design decisions with emphasis on the trade-offs that were considered during those decisions. 15 | 16 | Ory is leaning heavily on [Google's design docs process](https://www.industrialempathy.com/posts/design-docs-at-google/) 17 | and [Golang Proposals](https://github.com/golang/proposal). 18 | 19 | Writing a design doc before contributing your change ensures that your ideas are checked with 20 | the community and maintainers. It will save you a lot of time developing things that might need to be changed 21 | after code reviews, and your pull requests will be merged faster. 22 | type: markdown 23 | - attributes: 24 | label: "Preflight checklist" 25 | options: 26 | - label: 27 | "I could not find a solution in the existing issues, docs, nor 28 | discussions." 29 | required: true 30 | - label: 31 | "I agree to follow this project's [Code of 32 | Conduct](https://github.com/ory/defcon-30-ctf/blob/master/CODE_OF_CONDUCT.md)." 33 | required: true 34 | - label: 35 | "I have read and am following this repository's [Contribution 36 | Guidelines](https://github.com/ory/defcon-30-ctf/blob/master/CONTRIBUTING.md)." 37 | required: true 38 | - label: 39 | "I have joined the [Ory Community Slack](https://slack.ory.sh)." 40 | - label: 41 | "I am signed up to the [Ory Security Patch 42 | Newsletter](https://www.ory.sh/l/sign-up-newsletter)." 43 | id: checklist 44 | type: checkboxes 45 | - attributes: 46 | description: 47 | "Enter the slug or API URL of the affected Ory Network project. Leave 48 | empty when you are self-hosting." 49 | label: "Ory Network Project" 50 | placeholder: "https://.projects.oryapis.com" 51 | id: ory-network-project 52 | type: input 53 | - attributes: 54 | description: | 55 | This section gives the reader a very rough overview of the landscape in which the new system is being built and what is actually being built. This isn’t a requirements doc. Keep it succinct! The goal is that readers are brought up to speed but some previous knowledge can be assumed and detailed info can be linked to. This section should be entirely focused on objective background facts. 56 | label: "Context and scope" 57 | id: scope 58 | type: textarea 59 | validations: 60 | required: true 61 | 62 | - attributes: 63 | description: | 64 | A short list of bullet points of what the goals of the system are, and, sometimes more importantly, what non-goals are. Note, that non-goals aren’t negated goals like “The system shouldn’t crash”, but rather things that could reasonably be goals, but are explicitly chosen not to be goals. A good example would be “ACID compliance”; when designing a database, you’d certainly want to know whether that is a goal or non-goal. And if it is a non-goal you might still select a solution that provides it, if it doesn’t introduce trade-offs that prevent achieving the goals. 65 | label: "Goals and non-goals" 66 | id: goals 67 | type: textarea 68 | validations: 69 | required: true 70 | 71 | - attributes: 72 | description: | 73 | This section should start with an overview and then go into details. 74 | The design doc is the place to write down the trade-offs you made in designing your software. Focus on those trade-offs to produce a useful document with long-term value. That is, given the context (facts), goals and non-goals (requirements), the design doc is the place to suggest solutions and show why a particular solution best satisfies those goals. 75 | 76 | The point of writing a document over a more formal medium is to provide the flexibility to express the problem at hand in an appropriate manner. Because of this, there is no explicit guidance on how to actually describe the design. 77 | label: "The design" 78 | id: design 79 | type: textarea 80 | validations: 81 | required: true 82 | 83 | - attributes: 84 | description: | 85 | If the system under design exposes an API, then sketching out that API is usually a good idea. In most cases, however, one should withstand the temptation to copy-paste formal interface or data definitions into the doc as these are often verbose, contain unnecessary detail and quickly get out of date. Instead, focus on the parts that are relevant to the design and its trade-offs. 86 | label: "APIs" 87 | id: apis 88 | type: textarea 89 | 90 | - attributes: 91 | description: | 92 | Systems that store data should likely discuss how and in what rough form this happens. Similar to the advice on APIs, and for the same reasons, copy-pasting complete schema definitions should be avoided. Instead, focus on the parts that are relevant to the design and its trade-offs. 93 | label: "Data storage" 94 | id: persistence 95 | type: textarea 96 | 97 | - attributes: 98 | description: | 99 | Design docs should rarely contain code, or pseudo-code except in situations where novel algorithms are described. As appropriate, link to prototypes that show the feasibility of the design. 100 | label: "Code and pseudo-code" 101 | id: pseudocode 102 | type: textarea 103 | 104 | - attributes: 105 | description: | 106 | One of the primary factors that would influence the shape of a software design and hence the design doc, is the degree of constraint of the solution space. 107 | 108 | On one end of the extreme is the “greenfield software project”, where all we know are the goals, and the solution can be whatever makes the most sense. Such a document may be wide-ranging, but it also needs to quickly define a set of rules that allow zooming in on a manageable set of solutions. 109 | 110 | On the other end are systems where the possible solutions are very well defined, but it isn't at all obvious how they could even be combined to achieve the goals. This may be a legacy system that is difficult to change and wasn't designed to do what you want it to do or a library design that needs to operate within the constraints of the host programming language. 111 | 112 | In this situation, you may be able to enumerate all the things you can do relatively easily, but you need to creatively put those things together to achieve the goals. There may be multiple solutions, and none of them are great, and hence such a document should focus on selecting the best way given all identified trade-offs. 113 | label: "Degree of constraint" 114 | id: constrait 115 | type: textarea 116 | 117 | - attributes: 118 | description: | 119 | This section lists alternative designs that would have reasonably achieved similar outcomes. The focus should be on the trade-offs that each respective design makes and how those trade-offs led to the decision to select the design that is the primary topic of the document. 120 | 121 | While it is fine to be succinct about a solution that ended up not being selected, this section is one of the most important ones as it shows very explicitly why the selected solution is the best given the project goals and how other solutions, that the reader may be wondering about, introduce trade-offs that are less desirable given the goals. 122 | 123 | label: Alternatives considered 124 | id: alternatives 125 | type: textarea 126 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml 3 | 4 | description: 5 | "Suggest an idea for this project without a plan for implementation" 6 | labels: 7 | - feat 8 | name: "Feature Request" 9 | body: 10 | - attributes: 11 | value: | 12 | Thank you for suggesting an idea for this project! 13 | 14 | If you already have a plan to implement a feature or a change, please create a [design document](https://github.com/aeneasr/gh-template-test/issues/new?assignees=&labels=rfc&template=DESIGN-DOC.yml) instead if the change is non-trivial! 15 | type: markdown 16 | - attributes: 17 | label: "Preflight checklist" 18 | options: 19 | - label: 20 | "I could not find a solution in the existing issues, docs, nor 21 | discussions." 22 | required: true 23 | - label: 24 | "I agree to follow this project's [Code of 25 | Conduct](https://github.com/ory/defcon-30-ctf/blob/master/CODE_OF_CONDUCT.md)." 26 | required: true 27 | - label: 28 | "I have read and am following this repository's [Contribution 29 | Guidelines](https://github.com/ory/defcon-30-ctf/blob/master/CONTRIBUTING.md)." 30 | required: true 31 | - label: 32 | "I have joined the [Ory Community Slack](https://slack.ory.sh)." 33 | - label: 34 | "I am signed up to the [Ory Security Patch 35 | Newsletter](https://www.ory.sh/l/sign-up-newsletter)." 36 | id: checklist 37 | type: checkboxes 38 | - attributes: 39 | description: 40 | "Enter the slug or API URL of the affected Ory Network project. Leave 41 | empty when you are self-hosting." 42 | label: "Ory Network Project" 43 | placeholder: "https://.projects.oryapis.com" 44 | id: ory-network-project 45 | type: input 46 | - attributes: 47 | description: 48 | "Is your feature request related to a problem? Please describe." 49 | label: "Describe your problem" 50 | placeholder: 51 | "A clear and concise description of what the problem is. Ex. I'm always 52 | frustrated when [...]" 53 | id: problem 54 | type: textarea 55 | validations: 56 | required: true 57 | - attributes: 58 | description: | 59 | Describe the solution you'd like 60 | placeholder: | 61 | A clear and concise description of what you want to happen. 62 | label: "Describe your ideal solution" 63 | id: solution 64 | type: textarea 65 | validations: 66 | required: true 67 | - attributes: 68 | description: "Describe alternatives you've considered" 69 | label: "Workarounds or alternatives" 70 | id: alternatives 71 | type: textarea 72 | validations: 73 | required: true 74 | - attributes: 75 | description: "What version of our software are you running?" 76 | label: Version 77 | id: version 78 | type: input 79 | validations: 80 | required: true 81 | - attributes: 82 | description: 83 | "Add any other context or screenshots about the feature request here." 84 | label: Additional Context 85 | id: additional 86 | type: textarea 87 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/ISSUE_TEMPLATE/config.yml 3 | 4 | blank_issues_enabled: false 5 | contact_links: 6 | - name: Ory defcon-30-ctf Forum 7 | url: https://github.com/orgs/ory/discussions 8 | about: 9 | Please ask and answer questions here, show your implementations and 10 | discuss ideas. 11 | - name: Ory Chat 12 | url: https://www.ory.sh/chat 13 | about: 14 | Hang out with other Ory community members to ask and answer questions. 15 | -------------------------------------------------------------------------------- /.github/auto_assign.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/auto_assign.yml 3 | 4 | # Set to true to add reviewers to pull requests 5 | addReviewers: true 6 | 7 | # Set to true to add assignees to pull requests 8 | addAssignees: true 9 | 10 | # A list of reviewers to be added to pull requests (GitHub user name) 11 | assignees: 12 | - ory/maintainers 13 | 14 | # A number of reviewers added to the pull request 15 | # Set 0 to add all the reviewers (default: 0) 16 | numberOfReviewers: 0 17 | -------------------------------------------------------------------------------- /.github/config.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/config.yml 3 | 4 | todo: 5 | keyword: "@todo" 6 | label: todo 7 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | ## Related Issue or Design Document 14 | 15 | 29 | 30 | ## Checklist 31 | 32 | 36 | 37 | - [ ] I have read the [contributing guidelines](../blob/master/CONTRIBUTING.md) and signed the CLA. 38 | - [ ] I have referenced an issue containing the design document if my change introduces a new feature. 39 | - [ ] I have read the [security policy](../security/policy). 40 | - [ ] I confirm that this pull request does not address a security vulnerability. 41 | If this pull request addresses a security vulnerability, 42 | I confirm that I got approval (please contact [security@ory.sh](mailto:security@ory.sh)) from the maintainers to push the changes. 43 | - [ ] I have added tests that prove my fix is effective or that my feature works. 44 | - [ ] I have added the necessary documentation within the code base (if appropriate). 45 | 46 | ## Further comments 47 | 48 | 52 | -------------------------------------------------------------------------------- /.github/workflows/closed_references.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/workflows/closed_references.yml 3 | 4 | name: Closed Reference Notifier 5 | 6 | on: 7 | schedule: 8 | - cron: "0 0 * * *" 9 | workflow_dispatch: 10 | inputs: 11 | issueLimit: 12 | description: Max. number of issues to create 13 | required: true 14 | default: "5" 15 | 16 | jobs: 17 | find_closed_references: 18 | if: github.repository_owner == 'ory' 19 | runs-on: ubuntu-latest 20 | name: Find closed references 21 | steps: 22 | - uses: actions/checkout@v2 23 | - uses: actions/setup-node@v2-beta 24 | with: 25 | node-version: "14" 26 | - uses: ory/closed-reference-notifier@v1 27 | with: 28 | token: ${{ secrets.GITHUB_TOKEN }} 29 | issueLabels: upstream,good first issue,help wanted 30 | issueLimit: ${{ github.event.inputs.issueLimit || '5' }} 31 | -------------------------------------------------------------------------------- /.github/workflows/conventional_commits.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/workflows/conventional_commits.yml 3 | 4 | name: Conventional commits 5 | 6 | # This GitHub CI Action enforces that pull request titles follow conventional commits. 7 | # More info at https://www.conventionalcommits.org. 8 | # 9 | # The Ory-wide defaults for commit titles and scopes are below. 10 | # Your repository can add/replace elements via a configuration file at the path below. 11 | # More info at https://github.com/ory/ci/blob/master/conventional_commit_config/README.md 12 | 13 | on: 14 | pull_request_target: 15 | types: 16 | - edited 17 | - opened 18 | - ready_for_review 19 | - reopened 20 | # pull_request: # for debugging, uses config in local branch but supports only Pull Requests from this repo 21 | 22 | jobs: 23 | main: 24 | name: Validate PR title 25 | runs-on: ubuntu-latest 26 | steps: 27 | - uses: actions/checkout@v3 28 | - id: config 29 | uses: ory/ci/conventional_commit_config@master 30 | with: 31 | config_path: .github/conventional_commits.json 32 | default_types: | 33 | feat 34 | fix 35 | revert 36 | docs 37 | style 38 | refactor 39 | test 40 | build 41 | autogen 42 | security 43 | ci 44 | chore 45 | default_scopes: | 46 | deps 47 | docs 48 | default_require_scope: false 49 | - uses: amannn/action-semantic-pull-request@v4 50 | env: 51 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 52 | with: 53 | types: ${{ steps.config.outputs.types }} 54 | scopes: ${{ steps.config.outputs.scopes }} 55 | requireScope: ${{ steps.config.outputs.requireScope }} 56 | subjectPattern: ^(?![A-Z]).+$ 57 | subjectPatternError: | 58 | The subject should start with a lowercase letter, yours is uppercase: 59 | "{subject}" 60 | -------------------------------------------------------------------------------- /.github/workflows/labels.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/workflows/labels.yml 3 | 4 | name: Synchronize Issue Labels 5 | 6 | on: 7 | workflow_dispatch: 8 | push: 9 | branches: 10 | - master 11 | 12 | jobs: 13 | milestone: 14 | if: github.repository_owner == 'ory' 15 | name: Synchronize Issue Labels 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v2 20 | - name: Synchronize Issue Labels 21 | uses: ory/label-sync-action@v0 22 | with: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | dry: false 25 | forced: true 26 | -------------------------------------------------------------------------------- /.github/workflows/licenses.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/workflows/licenses.yml 3 | 4 | name: Licenses 5 | 6 | on: 7 | pull_request: 8 | push: 9 | branches: 10 | - main 11 | - v3 12 | - master 13 | 14 | jobs: 15 | licenses: 16 | name: License compliance 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Install script 20 | uses: ory/ci/licenses/setup@master 21 | with: 22 | token: ${{ secrets.ORY_BOT_PAT || secrets.GITHUB_TOKEN }} 23 | - name: Check licenses 24 | uses: ory/ci/licenses/check@master 25 | - name: Write, commit, push licenses 26 | uses: ory/ci/licenses/write@master 27 | if: 28 | ${{ github.ref == 'refs/heads/main' || github.ref == 29 | 'refs/heads/master' || github.ref == 'refs/heads/v3' }} 30 | with: 31 | author-email: 32 | ${{ secrets.ORY_BOT_PAT && 33 | '60093411+ory-bot@users.noreply.github.com' || 34 | format('{0}@users.noreply.github.com', github.actor) }} 35 | author-name: ${{ secrets.ORY_BOT_PAT && 'ory-bot' || github.actor }} 36 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED, DO NOT EDIT! 2 | # Please edit the original at https://github.com/ory/meta/blob/master/templates/repository/common/.github/workflows/stale.yml 3 | 4 | name: "Close Stale Issues" 5 | on: 6 | workflow_dispatch: 7 | schedule: 8 | - cron: "0 0 * * *" 9 | 10 | jobs: 11 | stale: 12 | if: github.repository_owner == 'ory' 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/stale@v4 16 | with: 17 | repo-token: ${{ secrets.GITHUB_TOKEN }} 18 | stale-issue-message: | 19 | Hello contributors! 20 | 21 | I am marking this issue as stale as it has not received any engagement from the community or maintainers for a year. That does not imply that the issue has no merit! If you feel strongly about this issue 22 | 23 | - open a PR referencing and resolving the issue; 24 | - leave a comment on it and discuss ideas on how you could contribute towards resolving it; 25 | - leave a comment and describe in detail why this issue is critical for your use case; 26 | - open a new issue with updated details and a plan for resolving the issue. 27 | 28 | Throughout its lifetime, Ory has received over 10.000 issues and PRs. To sustain that growth, we need to prioritize and focus on issues that are important to the community. A good indication of importance, and thus priority, is activity on a topic. 29 | 30 | Unfortunately, [burnout](https://www.jeffgeerling.com/blog/2016/why-i-close-prs-oss-project-maintainer-notes) has become a [topic](https://opensource.guide/best-practices/#its-okay-to-hit-pause) of [concern](https://docs.brew.sh/Maintainers-Avoiding-Burnout) amongst open-source projects. 31 | 32 | It can lead to severe personal and health issues as well as [opening](https://haacked.com/archive/2019/05/28/maintainer-burnout/) catastrophic [attack vectors](https://www.gradiant.org/en/blog/open-source-maintainer-burnout-as-an-attack-surface/). 33 | 34 | The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone. 35 | 36 | If this issue was marked as stale erroneously you can exempt it by adding the `backlog` label, assigning someone, or setting a milestone for it. 37 | 38 | Thank you for your understanding and to anyone who participated in the conversation! And as written above, please do participate in the conversation if this topic is important to you! 39 | 40 | Thank you 🙏✌️ 41 | stale-issue-label: "stale" 42 | exempt-issue-labels: "bug,blocking,docs,backlog" 43 | days-before-stale: 365 44 | days-before-close: 30 45 | exempt-milestones: true 46 | exempt-assignees: true 47 | only-pr-labels: "stale" 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.remote.yml 2 | .idea -------------------------------------------------------------------------------- /.reference-ignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /.reports/dep-licenses.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/.reports/dep-licenses.csv -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # Contributor Covenant Code of Conduct 5 | 6 | ## Our Pledge 7 | 8 | We as members, contributors, and leaders pledge to make participation in our 9 | community a harassment-free experience for everyone, regardless of age, body 10 | size, visible or invisible disability, ethnicity, sex characteristics, gender 11 | identity and expression, level of experience, education, socio-economic status, 12 | nationality, personal appearance, race, caste, color, religion, or sexual 13 | identity and orientation. 14 | 15 | We pledge to act and interact in ways that contribute to an open, welcoming, 16 | diverse, inclusive, and healthy community. 17 | 18 | ## Our Standards 19 | 20 | Examples of behavior that contributes to a positive environment for our 21 | community include: 22 | 23 | - Demonstrating empathy and kindness toward other people 24 | - Being respectful of differing opinions, viewpoints, and experiences 25 | - Giving and gracefully accepting constructive feedback 26 | - Accepting responsibility and apologizing to those affected by our mistakes, 27 | and learning from the experience 28 | - Focusing on what is best not just for us as individuals, but for the overall 29 | community 30 | 31 | Examples of unacceptable behavior include: 32 | 33 | - The use of sexualized language or imagery, and sexual attention or advances of 34 | any kind 35 | - Trolling, insulting or derogatory comments, and personal or political attacks 36 | - Public or private harassment 37 | - Publishing others' private information, such as a physical or email address, 38 | without their explicit permission 39 | - Other conduct which could reasonably be considered inappropriate in a 40 | professional setting 41 | 42 | ## Open Source Community Support 43 | 44 | Ory Open source software is collaborative and based on contributions by 45 | developers in the Ory community. There is no obligation from Ory to help with 46 | individual problems. If Ory open source software is used in production in a 47 | for-profit company or enterprise environment, we mandate a paid support contract 48 | where Ory is obligated under their service level agreements (SLAs) to offer a 49 | defined level of availability and responsibility. For more information about 50 | paid support please contact us at sales@ory.sh. 51 | 52 | ## Enforcement Responsibilities 53 | 54 | Community leaders are responsible for clarifying and enforcing our standards of 55 | acceptable behavior and will take appropriate and fair corrective action in 56 | response to any behavior that they deem inappropriate, threatening, offensive, 57 | or harmful. 58 | 59 | Community leaders have the right and responsibility to remove, edit, or reject 60 | comments, commits, code, wiki edits, issues, and other contributions that are 61 | not aligned to this Code of Conduct, and will communicate reasons for moderation 62 | decisions when appropriate. 63 | 64 | ## Scope 65 | 66 | This Code of Conduct applies within all community spaces, and also applies when 67 | an individual is officially representing the community in public spaces. 68 | Examples of representing our community include using an official e-mail address, 69 | posting via an official social media account, or acting as an appointed 70 | representative at an online or offline event. 71 | 72 | ## Enforcement 73 | 74 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 75 | reported to the community leaders responsible for enforcement at 76 | [office@ory.sh](mailto:office@ory.sh). All complaints will be reviewed and 77 | investigated promptly and fairly. 78 | 79 | All community leaders are obligated to respect the privacy and security of the 80 | reporter of any incident. 81 | 82 | ## Enforcement Guidelines 83 | 84 | Community leaders will follow these Community Impact Guidelines in determining 85 | the consequences for any action they deem in violation of this Code of Conduct: 86 | 87 | ### 1. Correction 88 | 89 | **Community Impact**: Use of inappropriate language or other behavior deemed 90 | unprofessional or unwelcome in the community. 91 | 92 | **Consequence**: A private, written warning from community leaders, providing 93 | clarity around the nature of the violation and an explanation of why the 94 | behavior was inappropriate. A public apology may be requested. 95 | 96 | ### 2. Warning 97 | 98 | **Community Impact**: A violation through a single incident or series of 99 | actions. 100 | 101 | **Consequence**: A warning with consequences for continued behavior. No 102 | interaction with the people involved, including unsolicited interaction with 103 | those enforcing the Code of Conduct, for a specified period of time. This 104 | includes avoiding interactions in community spaces as well as external channels 105 | like social media. Violating these terms may lead to a temporary or permanent 106 | ban. 107 | 108 | ### 3. Temporary Ban 109 | 110 | **Community Impact**: A serious violation of community standards, including 111 | sustained inappropriate behavior. 112 | 113 | **Consequence**: A temporary ban from any sort of interaction or public 114 | communication with the community for a specified period of time. No public or 115 | private interaction with the people involved, including unsolicited interaction 116 | with those enforcing the Code of Conduct, is allowed during this period. 117 | Violating these terms may lead to a permanent ban. 118 | 119 | ### 4. Permanent Ban 120 | 121 | **Community Impact**: Demonstrating a pattern of violation of community 122 | standards, including sustained inappropriate behavior, harassment of an 123 | individual, or aggression toward or disparagement of classes of individuals. 124 | 125 | **Consequence**: A permanent ban from any sort of public interaction within the 126 | community. 127 | 128 | ## Attribution 129 | 130 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 131 | version 2.1, available at 132 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 133 | 134 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 135 | enforcement ladder][mozilla coc]. 136 | 137 | For answers to common questions about this code of conduct, see the FAQ at 138 | [https://www.contributor-covenant.org/faq][faq]. Translations are available at 139 | [https://www.contributor-covenant.org/translations][translations]. 140 | 141 | [homepage]: https://www.contributor-covenant.org 142 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 143 | [mozilla coc]: https://github.com/mozilla/diversity 144 | [faq]: https://www.contributor-covenant.org/faq 145 | [translations]: https://www.contributor-covenant.org/translations 146 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # Contribute to Ory defcon-30-ctf 5 | 6 | 7 | 8 | 9 | - [Introduction](#introduction) 10 | - [FAQ](#faq) 11 | - [How can I contribute?](#how-can-i-contribute) 12 | - [Communication](#communication) 13 | - [Contribute examples or community projects](#contribute-examples-or-community-projects) 14 | - [Contribute code](#contribute-code) 15 | - [Contribute documentation](#contribute-documentation) 16 | - [Disclosing vulnerabilities](#disclosing-vulnerabilities) 17 | - [Code style](#code-style) 18 | - [Working with forks](#working-with-forks) 19 | - [Conduct](#conduct) 20 | 21 | 22 | 23 | ## Introduction 24 | 25 | _Please note_: We take Ory defcon-30-ctf's security and our users' trust very 26 | seriously. If you believe you have found a security issue in Ory defcon-30-ctf, 27 | please disclose it by contacting us at security@ory.sh. 28 | 29 | There are many ways in which you can contribute. The goal of this document is to 30 | provide a high-level overview of how you can get involved in Ory. 31 | 32 | As a potential contributor, your changes and ideas are welcome at any hour of 33 | the day or night, on weekdays, weekends, and holidays. Please do not ever 34 | hesitate to ask a question or send a pull request. 35 | 36 | If you are unsure, just ask or submit the issue or pull request anyways. You 37 | won't be yelled at for giving it your best effort. The worst that can happen is 38 | that you'll be politely asked to change something. We appreciate any sort of 39 | contributions and don't want a wall of rules to get in the way of that. 40 | 41 | That said, if you want to ensure that a pull request is likely to be merged, 42 | talk to us! You can find out our thoughts and ensure that your contribution 43 | won't clash with Ory 44 | defcon-30-ctf's direction. A great way to 45 | do this is via 46 | [Ory defcon-30-ctf Discussions](https://github.com/orgs/ory/discussions) 47 | or the [Ory Chat](https://www.ory.sh/chat). 48 | 49 | ## FAQ 50 | 51 | - I am new to the community. Where can I find the 52 | [Ory Community Code of Conduct?](https://github.com/ory/defcon-30-ctf/blob/master/CODE_OF_CONDUCT.md) 53 | 54 | - I have a question. Where can I get 55 | [answers to questions regarding Ory defcon-30-ctf?](#communication) 56 | 57 | - I would like to contribute but I am not sure how. Are there 58 | [easy ways to contribute?](#how-can-i-contribute) 59 | [Or good first issues?](https://github.com/search?l=&o=desc&q=label%3A%22help+wanted%22+label%3A%22good+first+issue%22+is%3Aopen+user%3Aory+user%3Aory-corp&s=updated&type=Issues) 60 | 61 | - I want to talk to other Ory defcon-30-ctf users. 62 | [How can I become a part of the community?](#communication) 63 | 64 | - I would like to know what I am agreeing to when I contribute to Ory 65 | defcon-30-ctf. 66 | Does Ory have 67 | [a Contributors License Agreement?](https://cla-assistant.io/ory/defcon-30-ctf) 68 | 69 | - I would like updates about new versions of Ory defcon-30-ctf. 70 | [How are new releases announced?](https://www.ory.sh/l/sign-up-newsletter) 71 | 72 | ## How can I contribute? 73 | 74 | If you want to start to contribute code right away, take a look at the 75 | [list of good first issues](https://github.com/ory/defcon-30-ctf/labels/good%20first%20issue). 76 | 77 | There are many other ways you can contribute. Here are a few things you can do 78 | to help out: 79 | 80 | - **Give us a star.** It may not seem like much, but it really makes a 81 | difference. This is something that everyone can do to help out Ory defcon-30-ctf. 82 | Github stars help the project gain visibility and stand out. 83 | 84 | - **Join the community.** Sometimes helping people can be as easy as listening 85 | to their problems and offering a different perspective. Join our Slack, have a 86 | look at discussions in the forum and take part in community events. More info 87 | on this in [Communication](#communication). 88 | 89 | - **Answer discussions.** At all times, there are several unanswered discussions 90 | on GitHub. You can see an 91 | [overview here](https://github.com/discussions?discussions_q=is%3Aunanswered+org%3Aory+sort%3Aupdated-desc). 92 | If you think you know an answer or can provide some information that might 93 | help, please share it! Bonus: You get GitHub achievements for answered 94 | discussions. 95 | 96 | - **Help with open issues.** We have a lot of open issues for Ory defcon-30-ctf and 97 | some of them may lack necessary information, some are duplicates of older 98 | issues. You can help out by guiding people through the process of filling out 99 | the issue template, asking for clarifying information or pointing them to 100 | existing issues that match their description of the problem. 101 | 102 | - **Review documentation changes.** Most documentation just needs a review for 103 | proper spelling and grammar. If you think a document can be improved in any 104 | way, feel free to hit the `edit` button at the top of the page. More info on 105 | contributing to the documentation [here](#contribute-documentation). 106 | 107 | - **Help with tests.** Pull requests may lack proper tests or test plans. These 108 | are needed for the change to be implemented safely. 109 | 110 | ## Communication 111 | 112 | We use [Slack](https://www.ory.sh/chat). You are welcome to drop in and ask 113 | questions, discuss bugs and feature requests, talk to other users of Ory, etc. 114 | 115 | Check out [Ory defcon-30-ctf Discussions](https://github.com/orgs/ory/discussions). This is a great place for 116 | in-depth discussions and lots of code examples, logs and similar data. 117 | 118 | You can also join our community calls if you want to speak to the Ory team 119 | directly or ask some questions. You can find more info and participate in 120 | [Slack](https://www.ory.sh/chat) in the #community-call channel. 121 | 122 | If you want to receive regular notifications about updates to Ory defcon-30-ctf, 123 | consider joining the mailing list. We will _only_ send you vital information on 124 | the projects that you are interested in. 125 | 126 | Also, [follow us on Twitter](https://twitter.com/orycorp). 127 | 128 | ## Contribute examples or community projects 129 | 130 | One of the most impactful ways to contribute is by adding code examples or other 131 | Ory-related code. You can find an overview of community code in the 132 | [awesome-ory](https://github.com/ory/awesome-ory) repository. 133 | 134 | _If you would like to contribute a new example, we would love to hear from you!_ 135 | 136 | Please [open a pull request at awesome-ory](https://github.com/ory/awesome-ory/) 137 | to add your example or Ory-related project to the awesome-ory README. 138 | 139 | ## Contribute code 140 | 141 | Unless you are fixing a known bug, we **strongly** recommend discussing it with 142 | the core team via a GitHub issue or [in our chat](https://www.ory.sh/chat) 143 | before getting started to ensure your work is consistent with Ory defcon-30-ctf's 144 | roadmap and architecture. 145 | 146 | All contributions are made via pull requests. To make a pull request, you will 147 | need a GitHub account; if you are unclear on this process, see GitHub's 148 | documentation on [forking](https://help.github.com/articles/fork-a-repo) and 149 | [pull requests](https://help.github.com/articles/using-pull-requests). Pull 150 | requests should be targeted at the `master` branch. Before creating a pull 151 | request, go through this checklist: 152 | 153 | 1. Create a feature branch off of `master` so that changes do not get mixed up. 154 | 1. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your local 155 | changes against the `master` branch. 156 | 1. Run the full project test suite with the `go test -tags sqlite ./...` (or 157 | equivalent) command and confirm that it passes. 158 | 1. Run `make format` 159 | 1. Add a descriptive prefix to commits. This ensures a uniform commit history 160 | and helps structure the changelog. Please refer to this 161 | [Convential Commits configuration](https://github.com/ory/defcon-30-ctf/blob/master/.github/workflows/conventional_commits.yml) 162 | for the list of accepted prefixes. You can read more about the Conventional 163 | Commit specification 164 | [at their site](https://www.conventionalcommits.org/en/v1.0.0/). 165 | 166 | If a pull request is not ready to be reviewed yet 167 | [it should be marked as a "Draft"](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request). 168 | 169 | Before your contributions can be reviewed you need to sign our 170 | [Contributor License Agreement](https://cla-assistant.io/ory/defcon-30-ctf). 171 | 172 | This agreement defines the terms under which your code is contributed to Ory. 173 | More specifically it declares that you have the right to, and actually do, grant 174 | us the rights to use your contribution. You can see the Apache 2.0 license under 175 | which our projects are published 176 | [here](https://github.com/ory/meta/blob/master/LICENSE). 177 | 178 | When pull requests fail the automated testing stages (for example unit or E2E 179 | tests), authors are expected to update their pull requests to address the 180 | failures until the tests pass. 181 | 182 | Pull requests eligible for review 183 | 184 | 1. follow the repository's code formatting conventions; 185 | 2. include tests that prove that the change works as intended and does not add 186 | regressions; 187 | 3. document the changes in the code and/or the project's documentation; 188 | 4. pass the CI pipeline; 189 | 5. have signed our 190 | [Contributor License Agreement](https://cla-assistant.io/ory/defcon-30-ctf); 191 | 6. include a proper git commit message following the 192 | [Conventional Commit Specification](https://www.conventionalcommits.org/en/v1.0.0/). 193 | 194 | If all of these items are checked, the pull request is ready to be reviewed and 195 | you should change the status to "Ready for review" and 196 | [request review from a maintainer](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review). 197 | 198 | Reviewers will approve the pull request once they are satisfied with the patch. 199 | 200 | ## Contribute documentation 201 | 202 | Please provide documentation when changing, removing, or adding features. All 203 | Ory Documentation resides in the 204 | [Ory documentation repository](https://github.com/ory/docs/). For further 205 | instructions please head over to the Ory Documentation 206 | [README.md](https://github.com/ory/docs/blob/master/README.md). 207 | 208 | ## Disclosing vulnerabilities 209 | 210 | Please disclose vulnerabilities exclusively to 211 | [security@ory.sh](mailto:security@ory.sh). Do not use GitHub issues. 212 | 213 | ## Code style 214 | 215 | Please run `make format` to format all source code following the Ory standard. 216 | 217 | ### Working with forks 218 | 219 | ```bash 220 | # First you clone the original repository 221 | git clone git@github.com:ory/ory/defcon-30-ctf.git 222 | 223 | # Next you add a git remote that is your fork: 224 | git remote add fork git@github.com:/ory/defcon-30-ctf.git 225 | 226 | # Next you fetch the latest changes from origin for master: 227 | git fetch origin 228 | git checkout master 229 | git pull --rebase 230 | 231 | # Next you create a new feature branch off of master: 232 | git checkout my-feature-branch 233 | 234 | # Now you do your work and commit your changes: 235 | git add -A 236 | git commit -a -m "fix: this is the subject line" -m "This is the body line. Closes #123" 237 | 238 | # And the last step is pushing this to your fork 239 | git push -u fork my-feature-branch 240 | ``` 241 | 242 | Now go to the project's GitHub Pull Request page and click "New pull request" 243 | 244 | ## Conduct 245 | 246 | Whether you are a regular contributor or a newcomer, we care about making this 247 | community a safe place for you and we've got your back. 248 | 249 | [Ory Community Code of Conduct](https://github.com/ory/defcon-30-ctf/blob/master/CODE_OF_CONDUCT.md) 250 | 251 | We welcome discussion about creating a welcoming, safe, and productive 252 | environment for the community. If you have any questions, feedback, or concerns 253 | [please let us know](https://www.ory.sh/chat). 254 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Capture The Flag // Voting Village // Def Con 30 2 | 3 | Welcome to the github.com/ory CTF at DEF CON 30! Explore a vulnerable, open-source digital election system and capture the flag! 4 | 5 | Join the [community slack](https://slack.ory.sh) or have a look at the video summary: 6 | 7 | [![Ory Capture The Flag Interactive Summary](https://img.youtube.com/vi/Mx8LNRndsO8/0.jpg)](https://www.youtube.com/watch?v=Mx8LNRndsO8 "Ory Capture The Flag Interactive Summary") 8 | 9 | ## Targets 10 | 11 | This challenge runs five services. They mock a basic election system used by **authenticated** users (election workers) to submit their voting districts results. This is not a service for voters. However, everyone can sign up and see the already submitted results. 12 | 13 | The services are all open source: 14 | 15 | - [Ory Oathkeeper](https://github.com/ory/oathkeeper): reverse proxy for all other services 16 | - [Ory Kratos](https://github.com/ory/kratos): authentication and session management 17 | - [Ory Keto](https://github.com/ory/keto): authorization and access control 18 | - Backend (this repo): the actual election system backend 19 | - Postgres: the database 20 | 21 | The target of this CTF is the **backend** service. Vulnerabilities found in the open source **Ory Oathkeeper**, **Ory Kratos**, and **Ory Keto** projects can be reported through our [bug bounty program](https://hackerone.com/ory_corp) and give you bounties between 100$ (low) and 3,000$ (critical). On top, we will add another 100$ for any submission done during DEF CON 30 after you talked to us personally at the Voting Machine village. 22 | 23 | ## Running Locally 24 | 25 | Open source also means you can investigate the services locally. 26 | 27 | You'll need to have Docker installed and this repository checked out to start the challenge: 28 | 29 | ```bash 30 | $ git clone https://github.com/ory/defcon-30-ctf.git 31 | $ cd defcon-30-ctf 32 | $ docker compose up -d --build --force-recreate 33 | ``` 34 | 35 | Once the services are running, you are able to access them at: 36 | 37 | ``` 38 | http://localhost:5050 39 | ``` 40 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # Ory Security Policy 5 | 6 | This policy outlines Ory's security commitments and practices for users across 7 | different licensing and deployment models. 8 | 9 | To learn more about Ory's security service level agreements (SLAs) and 10 | processes, please [contact us](https://www.ory.sh/contact/). 11 | 12 | ## Ory Network Users 13 | 14 | - **Security SLA:** Ory addresses vulnerabilities in the Ory Network according 15 | to the following guidelines: 16 | - Critical: Typically addressed within 14 days. 17 | - High: Typically addressed within 30 days. 18 | - Medium: Typically addressed within 90 days. 19 | - Low: Typically addressed within 180 days. 20 | - Informational: Addressed as necessary. 21 | These timelines are targets and may vary based on specific circumstances. 22 | - **Release Schedule:** Updates are deployed to the Ory Network as 23 | vulnerabilities are resolved. 24 | - **Version Support:** The Ory Network always runs the latest version, ensuring 25 | up-to-date security fixes. 26 | 27 | ## Ory Enterprise License Customers 28 | 29 | - **Security SLA:** Ory addresses vulnerabilities based on their severity: 30 | - Critical: Typically addressed within 14 days. 31 | - High: Typically addressed within 30 days. 32 | - Medium: Typically addressed within 90 days. 33 | - Low: Typically addressed within 180 days. 34 | - Informational: Addressed as necessary. 35 | These timelines are targets and may vary based on specific circumstances. 36 | - **Release Schedule:** Updates are made available as vulnerabilities are 37 | resolved. Ory works closely with enterprise customers to ensure timely updates 38 | that align with their operational needs. 39 | - **Version Support:** Ory may provide security support for multiple versions, 40 | depending on the terms of the enterprise agreement. 41 | 42 | ## Apache 2.0 License Users 43 | 44 | - **Security SLA:** Ory does not provide a formal SLA for security issues under 45 | the Apache 2.0 License. 46 | - **Release Schedule:** Releases prioritize new functionality and include fixes 47 | for known security vulnerabilities at the time of release. While major 48 | releases typically occur one to two times per year, Ory does not guarantee a 49 | fixed release schedule. 50 | - **Version Support:** Security patches are only provided for the latest release 51 | version. 52 | 53 | ## Reporting a Vulnerability 54 | 55 | For details on how to report security vulnerabilities, visit our 56 | [security policy documentation](https://www.ory.sh/docs/ecosystem/security). 57 | -------------------------------------------------------------------------------- /backend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.19-alpine3.16 AS builder 2 | 3 | RUN apk -U --no-cache add build-base git gcc 4 | 5 | WORKDIR /go/src/github.com/ory/defcon-30-ctf 6 | 7 | ADD go.mod go.mod 8 | ADD go.sum go.sum 9 | 10 | RUN go mod download 11 | 12 | ADD . . 13 | 14 | RUN go build -o /usr/bin/backend . 15 | 16 | FROM alpine:3.16 17 | 18 | RUN addgroup -S ory; \ 19 | adduser -S ory -G ory -D -h /home/ory -s /bin/nologin; \ 20 | chown -R ory:ory /home/ory 21 | 22 | COPY --from=builder /usr/bin/backend /usr/bin/backend 23 | 24 | USER ory 25 | 26 | ENTRYPOINT ["backend"] 27 | -------------------------------------------------------------------------------- /backend/config.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "os" 4 | 5 | type Config struct { 6 | ListenAddress string 7 | DataSourceName string 8 | FlagSeed string 9 | } 10 | 11 | func fromEnvOrDefault(key, defaultVal string) string { 12 | if val, ok := os.LookupEnv(key); ok { 13 | return val 14 | } 15 | return defaultVal 16 | } 17 | 18 | func newConfig() (*Config, error) { 19 | return &Config{ 20 | ListenAddress: fromEnvOrDefault("LISTEN_ADDRESS", ":8000"), 21 | DataSourceName: fromEnvOrDefault("DSN", "sqlite3://file::memory:?cache=shared"), 22 | FlagSeed: fromEnvOrDefault("FLAG_SEED", ""), 23 | }, nil 24 | } 25 | -------------------------------------------------------------------------------- /backend/db.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | _ "github.com/jackc/pgx/v4/stdlib" 6 | "github.com/jmoiron/sqlx" 7 | "strings" 8 | "time" 9 | ) 10 | 11 | type sqlRepo struct { 12 | db *sqlx.DB 13 | } 14 | 15 | func NewRepo(c *Config) (*sqlRepo, error) { 16 | driver, dsn, _ := strings.Cut(c.DataSourceName, "://") 17 | db, err := sqlx.Open(driver, dsn) 18 | if err != nil { 19 | return nil, err 20 | } 21 | repo := &sqlRepo{ 22 | db: db, 23 | } 24 | if err := repo.createTables(); err != nil { 25 | return nil, err 26 | } 27 | return repo, nil 28 | } 29 | 30 | func (repo *sqlRepo) createTables() error { 31 | _, err := repo.db.Exec(` 32 | CREATE TABLE IF NOT EXISTS results ( 33 | district text NOT NULL PRIMARY KEY, 34 | democrats integer NOT NULL, 35 | republicans integer NOT NULL, 36 | invalid integer NOT NULL 37 | ); 38 | 39 | CREATE TABLE IF NOT EXISTS flags ( 40 | "when" integer NOT NULL, 41 | "user" text NOT NULL, 42 | flag text NOT NULL, 43 | email text NOT NULL PRIMARY KEY 44 | ); 45 | `) 46 | return err 47 | } 48 | 49 | func (repo *sqlRepo) List(ctx context.Context) (res []*result, err error) { 50 | res = make([]*result, 0) 51 | row, err := repo.db.QueryContext(ctx, `SELECT * FROM results ORDER BY district`) 52 | if err != nil { 53 | return res, err 54 | } 55 | 56 | defer row.Close() 57 | for row.Next() { 58 | r := &result{} 59 | if err := row.Scan(&r.District, &r.Democrats, &r.Republicans, &r.Invalid); err != nil { 60 | return nil, err 61 | } 62 | res = append(res, r) 63 | } 64 | 65 | return res, nil 66 | } 67 | 68 | func (repo *sqlRepo) Submit(ctx context.Context, district string, r *result) error { 69 | _, err := repo.db.ExecContext(ctx, 70 | repo.db.Rebind("INSERT INTO results(district, democrats, republicans, invalid) VALUES (?, ?, ?, ?)"), 71 | district, r.Democrats, r.Republicans, r.Invalid) 72 | return err 73 | } 74 | 75 | func (repo *sqlRepo) FlagSubmission(ctx context.Context, when, user, flag, email string) error { 76 | _, err := repo.db.ExecContext(ctx, 77 | repo.db.Rebind("INSERT INTO flags(\"when\", \"user\", flag, email) VALUES (?, ?, ?, ?)"), 78 | when, user, flag, email) 79 | return err 80 | } 81 | 82 | type flagSubmission struct { 83 | User, Flag, Email string 84 | When time.Time 85 | WhenUnix int64 86 | } 87 | 88 | var vegasTime = time.FixedZone("PDT", -7*60*60) 89 | 90 | func (repo *sqlRepo) ListFlags(ctx context.Context) (res []*flagSubmission, err error) { 91 | res = make([]*flagSubmission, 0) 92 | row, err := repo.db.QueryContext(ctx, `SELECT "when", "user" FROM flags ORDER BY "when" ASC LIMIT 100`) 93 | if err != nil { 94 | return res, err 95 | } 96 | 97 | defer row.Close() 98 | for row.Next() { 99 | r := &flagSubmission{} 100 | if err := row.Scan(&r.WhenUnix, &r.User); err != nil { 101 | return nil, err 102 | } 103 | r.When = time.Unix(r.WhenUnix, 0).In(vegasTime) 104 | res = append(res, r) 105 | } 106 | 107 | return res, nil 108 | } 109 | 110 | func (repo *sqlRepo) TotalFlags(ctx context.Context) (int, error) { 111 | var count int 112 | return count, repo.db.GetContext(ctx, &count, repo.db.Rebind("SELECT COUNT(*) FROM flags")) 113 | } 114 | -------------------------------------------------------------------------------- /backend/db_sqlite.go: -------------------------------------------------------------------------------- 1 | //go:build sqlite 2 | // +build sqlite 3 | 4 | package main 5 | 6 | import ( 7 | _ "github.com/mattn/go-sqlite3" 8 | ) 9 | -------------------------------------------------------------------------------- /backend/flag_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/stretchr/testify/assert" 5 | "github.com/stretchr/testify/require" 6 | "testing" 7 | ) 8 | 9 | func TestFlag(t *testing.T) { 10 | flag := encodeFlag("now", "user", "seed") 11 | when, user, err := decodeFlag(flag, "seed") 12 | require.NoError(t, err) 13 | assert.Equal(t, "now", when) 14 | assert.Equal(t, "user", user) 15 | } 16 | -------------------------------------------------------------------------------- /backend/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/ory/defcon-30-ctf/backend 2 | 3 | go 1.18 4 | 5 | require ( 6 | github.com/jackc/pgx/v4 v4.17.0 7 | github.com/jmoiron/sqlx v1.3.5 8 | github.com/julienschmidt/httprouter v1.3.0 9 | github.com/mattn/go-sqlite3 v1.14.14 10 | github.com/ory/client-go v0.2.0-alpha.4 11 | github.com/ory/graceful v0.1.3 12 | ) 13 | 14 | require ( 15 | github.com/cespare/xxhash v1.1.0 // indirect 16 | github.com/davecgh/go-spew v1.1.1 // indirect 17 | github.com/dgraph-io/ristretto v0.0.2 // indirect 18 | github.com/fsnotify/fsnotify v1.4.9 // indirect 19 | github.com/golang/protobuf v1.5.2 // indirect 20 | github.com/google/uuid v1.1.2 // indirect 21 | github.com/hashicorp/hcl v1.0.0 // indirect 22 | github.com/inconshreveable/mousetrap v1.0.0 // indirect 23 | github.com/jackc/chunkreader/v2 v2.0.1 // indirect 24 | github.com/jackc/pgconn v1.13.0 // indirect 25 | github.com/jackc/pgio v1.0.0 // indirect 26 | github.com/jackc/pgpassfile v1.0.0 // indirect 27 | github.com/jackc/pgproto3/v2 v2.3.1 // indirect 28 | github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect 29 | github.com/jackc/pgtype v1.12.0 // indirect 30 | github.com/jandelgado/gcov2lcov v1.0.5 // indirect 31 | github.com/magiconair/properties v1.8.1 // indirect 32 | github.com/mitchellh/mapstructure v1.3.2 // indirect 33 | github.com/ory/go-acc v0.2.6 // indirect 34 | github.com/ory/keto/proto v0.9.0-alpha.0 35 | github.com/ory/viper v1.7.5 // indirect 36 | github.com/pborman/uuid v1.2.0 // indirect 37 | github.com/pelletier/go-toml v1.8.0 // indirect 38 | github.com/pmezard/go-difflib v1.0.0 // indirect 39 | github.com/spf13/afero v1.2.2 // indirect 40 | github.com/spf13/cast v1.3.1 // indirect 41 | github.com/spf13/cobra v1.0.0 // indirect 42 | github.com/spf13/jwalterweatherman v1.1.0 // indirect 43 | github.com/spf13/pflag v1.0.5 // indirect 44 | github.com/subosito/gotenv v1.2.0 // indirect 45 | golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect 46 | golang.org/x/mod v0.4.2 // indirect 47 | golang.org/x/net v0.0.0-20220622184535-263ec571b305 // indirect 48 | golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 // indirect 49 | golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664 // indirect 50 | golang.org/x/text v0.3.7 // indirect 51 | golang.org/x/tools v0.1.7 // indirect 52 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect 53 | google.golang.org/appengine v1.6.6 // indirect 54 | google.golang.org/genproto v0.0.0-20220622171453-ea41d75dfa0f // indirect 55 | google.golang.org/grpc v1.48.0 56 | google.golang.org/protobuf v1.28.1 // indirect 57 | gopkg.in/ini.v1 v1.57.0 // indirect 58 | gopkg.in/yaml.v2 v2.3.0 // indirect 59 | gopkg.in/yaml.v3 v3.0.1 // indirect 60 | ) 61 | 62 | require ( 63 | github.com/ory/herodot v0.9.13 64 | github.com/pkg/errors v0.9.1 // indirect 65 | github.com/stretchr/testify v1.8.0 66 | ) 67 | -------------------------------------------------------------------------------- /backend/handler.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "embed" 5 | _ "embed" 6 | "fmt" 7 | "io/fs" 8 | "log" 9 | "net/http" 10 | 11 | "github.com/julienschmidt/httprouter" 12 | "github.com/ory/client-go" 13 | "github.com/ory/herodot" 14 | rts "github.com/ory/keto/proto/ory/keto/relation_tuples/v1alpha2" 15 | "google.golang.org/grpc" 16 | "google.golang.org/grpc/credentials/insecure" 17 | ) 18 | 19 | type handler struct { 20 | repo *sqlRepo 21 | config *Config 22 | jw *herodot.JSONWriter 23 | tw *herodot.TextWriter 24 | c *client.APIClient 25 | ketoCheck rts.CheckServiceClient 26 | ketoWrite rts.WriteServiceClient 27 | } 28 | 29 | type logReporter struct{} 30 | 31 | func (logReporter) ReportError(r *http.Request, code int, err error, args ...interface{}) { 32 | log.Printf("ERROR: %s\n Request: %v\n Response Code: %d\n Further Info: %v\n", err, r, code, args) 33 | } 34 | 35 | func NewHandler(repo *sqlRepo, config *Config) (http.Handler, error) { 36 | // TODO cluster-internal mTLS 37 | ketoRead, err := grpc.Dial("keto:4466", grpc.WithTransportCredentials(insecure.NewCredentials())) 38 | if err != nil { 39 | return nil, err 40 | } 41 | // TODO cluster-internal mTLS 42 | ketoWrite, err := grpc.Dial("keto:4467", grpc.WithTransportCredentials(insecure.NewCredentials())) 43 | if err != nil { 44 | return nil, err 45 | } 46 | r := httprouter.New() 47 | h := &handler{ 48 | repo: repo, 49 | config: config, 50 | jw: herodot.NewJSONWriter(logReporter{}), 51 | tw: herodot.NewTextWriter(logReporter{}, "html"), 52 | c: client.NewAPIClient(&client.Configuration{ 53 | Servers: client.ServerConfigurations{{ 54 | // TODO cluster-internal mTLS 55 | URL: "http://kratos:4433", 56 | }}, 57 | }), 58 | ketoCheck: rts.NewCheckServiceClient(ketoRead), 59 | ketoWrite: rts.NewWriteServiceClient(ketoWrite), 60 | } 61 | 62 | r.GET("/login", requireFlow(h.login, "login")) 63 | r.GET("/register", requireFlow(h.register, "registration")) 64 | r.GET("/error", h.error) 65 | r.GET("/", h.index) 66 | r.POST("/results", h.submit) 67 | r.POST("/grant-access", h.grantAccess) 68 | r.GET("/flag", h.getFlag) 69 | r.POST("/flag", h.submitFlag) 70 | r.GET("/static/*filepath", h.static) 71 | r.GET("/leaderboard", h.leaderboard) 72 | 73 | return withAccessLog(r), nil 74 | } 75 | 76 | func withAccessLog(next http.Handler) http.Handler { 77 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 78 | log.Printf("%s %s\n", r.Method, r.URL) 79 | next.ServeHTTP(w, r) 80 | }) 81 | } 82 | 83 | func requireFlow(next httprouter.Handle, flow string) httprouter.Handle { 84 | return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 85 | if r.URL.Query().Has("flow") { 86 | next(w, r, nil) 87 | return 88 | } 89 | http.Redirect(w, r, fmt.Sprintf("/self-service/%s/browser", flow), http.StatusSeeOther) 90 | } 91 | } 92 | 93 | //go:embed static/* 94 | var staticFiles embed.FS 95 | 96 | func (h *handler) static(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 97 | statics, err := fs.Sub(staticFiles, "static") 98 | if err != nil { 99 | h.jw.WriteError(w, r, err) 100 | return 101 | } 102 | http.StripPrefix("/static/", http.FileServer(http.FS(statics))).ServeHTTP(w, r) 103 | } 104 | -------------------------------------------------------------------------------- /backend/handler_auth.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | _ "embed" 5 | "encoding/json" 6 | "html/template" 7 | "net/http" 8 | "os" 9 | 10 | "github.com/julienschmidt/httprouter" 11 | "github.com/ory/client-go" 12 | "github.com/ory/herodot" 13 | rts "github.com/ory/keto/proto/ory/keto/relation_tuples/v1alpha2" 14 | ) 15 | 16 | //go:embed ui/login.html 17 | var loginPage string 18 | 19 | //go:embed ui/register.html 20 | var registerPage string 21 | 22 | //go:embed ui/error.html 23 | var errorPage string 24 | 25 | func (h *handler) login(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 26 | flow, err := getFlow(r, h.c.V0alpha2Api.GetSelfServiceLoginFlowExecute) 27 | if err != nil { 28 | h.jw.WriteError(w, r, err) 29 | return 30 | } 31 | t, err := template.New("login").Parse(loginPage) 32 | if err != nil { 33 | h.jw.WriteError(w, r, err) 34 | return 35 | } 36 | if err := t.Execute(w, flow); err != nil { 37 | h.jw.WriteError(w, r, err) 38 | return 39 | } 40 | } 41 | 42 | func (h *handler) register(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 43 | flow, err := getFlow(r, h.c.V0alpha2Api.GetSelfServiceRegistrationFlowExecute) 44 | if err != nil { 45 | h.jw.WriteError(w, r, err) 46 | return 47 | } 48 | t, err := template.New("register").Parse(registerPage) 49 | if err != nil { 50 | h.jw.WriteError(w, r, err) 51 | return 52 | } 53 | if err := t.Execute(w, flow); err != nil { 54 | h.jw.WriteError(w, r, err) 55 | return 56 | } 57 | } 58 | 59 | func (h *handler) error(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 60 | e, _, err := h.c.V0alpha2Api.GetSelfServiceErrorExecute(client.V0alpha2ApiGetSelfServiceErrorRequest{}.Id(r.URL.Query().Get("id"))) 61 | if err != nil { 62 | h.jw.WriteError(w, r, err) 63 | return 64 | } 65 | t, err := template.New("error").Parse(errorPage) 66 | if err != nil { 67 | h.jw.WriteError(w, r, err) 68 | return 69 | } 70 | if err := t.Execute(w, struct{ Error *client.SelfServiceError }{Error: e}); err != nil { 71 | h.jw.WriteError(w, r, err) 72 | return 73 | } 74 | } 75 | 76 | type flowData struct { 77 | Action, CSRFToken, Messages, WebAuthNScript, Identifier string 78 | WebAuthNCallback template.JS 79 | } 80 | 81 | func getFlow[F interface { 82 | GetUi() client.UiContainer 83 | }, R interface { 84 | Cookie(string) R 85 | Id(string) R 86 | }](r *http.Request, fetch func(R) (F, *http.Response, error)) (*flowData, error) { 87 | flowID := r.URL.Query().Get("flow") 88 | var req R 89 | flow, _, err := fetch(req. 90 | Cookie(r.Header.Get("Cookie")). 91 | Id(flowID)) 92 | if err != nil { 93 | return nil, err 94 | } 95 | enc := json.NewEncoder(os.Stdout) 96 | enc.SetIndent("", " ") 97 | enc.Encode(flow.GetUi()) 98 | data := flowData{ 99 | Action: flow.GetUi().Action, 100 | } 101 | msg := flow.GetUi().Messages 102 | for _, node := range flow.GetUi().Nodes { 103 | if attrs := node.Attributes.UiNodeInputAttributes; attrs != nil { 104 | if attrs.Name == "csrf_token" { 105 | data.CSRFToken = attrs.Value.(string) 106 | } else if attrs.Name == "webauthn_register_trigger" || attrs.Name == "webauthn_login_trigger" { 107 | data.WebAuthNCallback = template.JS(*attrs.Onclick) 108 | } else if attrs.Name == "identifier" { 109 | data.Identifier = attrs.Value.(string) 110 | } 111 | } 112 | msg = append(msg, node.Messages...) 113 | } 114 | msgRaw, err := json.Marshal(msg) 115 | if err != nil { 116 | return nil, err 117 | } 118 | data.Messages = string(msgRaw) 119 | if len(msg) == 0 { 120 | data.Messages = "no error messages right now" 121 | } 122 | return &data, nil 123 | } 124 | 125 | func (h *handler) grantAccess(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 126 | sub, rel, nspace, obj := r.FormValue("subject"), r.FormValue("relation"), r.FormValue("namespace"), r.FormValue("object") 127 | 128 | self, err := h.ketoCheck.Check(r.Context(), &rts.CheckRequest{ 129 | Tuple: &rts.RelationTuple{ 130 | Namespace: nspace, 131 | Object: obj, 132 | Relation: rel, 133 | Subject: rts.NewSubjectID(r.Header.Get("X-Username")), 134 | }, 135 | }) 136 | if err != nil { 137 | h.jw.WriteError(w, r, err) 138 | return 139 | } 140 | if !self.Allowed { 141 | h.jw.WriteError(w, r, herodot.ErrForbidden.WithError("You don't have the relation yourself, how could you grant it to someone else?")) 142 | return 143 | } 144 | 145 | _, err = h.ketoWrite.TransactRelationTuples(r.Context(), &rts.TransactRelationTuplesRequest{ 146 | RelationTupleDeltas: []*rts.RelationTupleDelta{{ 147 | Action: rts.RelationTupleDelta_ACTION_INSERT, 148 | RelationTuple: &rts.RelationTuple{ 149 | Namespace: nspace, 150 | Object: obj, 151 | Relation: rel, 152 | Subject: rts.NewSubjectID(sub), 153 | }, 154 | }}, 155 | }) 156 | if err != nil { 157 | h.jw.WriteError(w, r, err) 158 | return 159 | } 160 | h.tw.Write(w, r, "Ok, done.") 161 | } 162 | -------------------------------------------------------------------------------- /backend/handler_flag.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "crypto/hmac" 6 | "crypto/sha512" 7 | _ "embed" 8 | "encoding/base64" 9 | "fmt" 10 | "html/template" 11 | "io" 12 | "net/http" 13 | "strconv" 14 | "strings" 15 | "time" 16 | 17 | "github.com/julienschmidt/httprouter" 18 | "github.com/ory/herodot" 19 | rts "github.com/ory/keto/proto/ory/keto/relation_tuples/v1alpha2" 20 | ) 21 | 22 | func encodeFlag(now, user, seed string) string { 23 | buf := bytes.Buffer{} 24 | _, _ = buf.WriteString("flag_") 25 | enc := base64.NewEncoder(base64.URLEncoding, &buf) 26 | sum := hmac.New(sha512.New, []byte(seed)).Sum([]byte(now + user)) 27 | fmt.Printf("sum enc: %v\n", sum) 28 | _, _ = enc.Write([]byte(now + "_")) 29 | _, _ = enc.Write([]byte(user + "_")) 30 | _, _ = enc.Write(sum) 31 | _ = enc.Close() 32 | return buf.String() 33 | } 34 | 35 | func decodeFlag(flag, seed string) (when, user string, err error) { 36 | dec, err := io.ReadAll(base64.NewDecoder(base64.URLEncoding, bytes.NewBufferString(strings.TrimPrefix(flag, "flag_")))) 37 | if err != nil { 38 | return "", "", err 39 | } 40 | parts := bytes.Split(dec, []byte("_")) 41 | if len(parts) != 3 { 42 | return "", "", herodot.ErrBadRequest.WithError("Invalid flag format") 43 | } 44 | whenB, userB, sum := parts[0], parts[1], parts[2] 45 | sumDec := hmac.New(sha512.New, []byte(seed)).Sum(append(whenB, userB...)) 46 | fmt.Printf("sum dec: %v\nact sum: %v\n", sumDec, sum) 47 | if !hmac.Equal(sumDec, sum) { 48 | return "", "", herodot.ErrBadRequest.WithError("Invalid flag") 49 | } 50 | return string(whenB), string(userB), nil 51 | } 52 | 53 | func (h *handler) getFlag(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 54 | user := r.Header.Get("X-User") 55 | res, err := h.ketoCheck.Check(r.Context(), &rts.CheckRequest{ 56 | Tuple: &rts.RelationTuple{ 57 | Namespace: "flags", 58 | Object: "new_flag", 59 | Relation: "create", 60 | Subject: rts.NewSubjectID(user), 61 | }, 62 | }) 63 | if err != nil { 64 | h.jw.WriteError(w, r, err) 65 | return 66 | } 67 | if !res.Allowed { 68 | h.jw.WriteError(w, r, herodot.ErrForbidden.WithError("Sorry, no flag for you...")) 69 | return 70 | } 71 | 72 | flag := encodeFlag(strconv.Itoa(int(time.Now().Unix())), user, h.config.FlagSeed) 73 | h.tw.Write(w, r, flag+"\n\nCongrats! Go and submit your flag. Please keep a copy in case the data get lost because of unforeseen events.\n") 74 | } 75 | 76 | func (h *handler) submitFlag(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 77 | flag := r.FormValue("flag") 78 | when, user, err := decodeFlag(flag, h.config.FlagSeed) 79 | if err != nil { 80 | h.jw.WriteError(w, r, err) 81 | return 82 | } 83 | if user != r.Header.Get("X-User") { 84 | h.jw.WriteError(w, r, herodot.ErrBadRequest.WithError("This flag was issued for another user")) 85 | return 86 | } 87 | if err := h.repo.FlagSubmission(r.Context(), when, user, flag, r.FormValue("email")); err != nil { 88 | h.jw.WriteError(w, r, err) 89 | return 90 | } 91 | h.jw.Write(w, r, "Thanks, we will reach out to you about your swag!") 92 | } 93 | 94 | //go:embed ui/leaderboard.html 95 | var leaderboardPage string 96 | 97 | type leaderboardData struct { 98 | Submissions []*flagSubmission 99 | Total int 100 | } 101 | 102 | func (h *handler) leaderboard(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 103 | submissions, err := h.repo.ListFlags(r.Context()) 104 | if err != nil { 105 | h.jw.WriteError(w, r, err) 106 | return 107 | } 108 | total, err := h.repo.TotalFlags(r.Context()) 109 | if err != nil { 110 | h.jw.WriteError(w, r, err) 111 | return 112 | } 113 | t, err := template.New("leaderboard").Parse(leaderboardPage) 114 | if err != nil { 115 | h.jw.WriteError(w, r, err) 116 | return 117 | } 118 | if err := t.Execute(w, &leaderboardData{ 119 | Submissions: submissions, 120 | Total: total, 121 | }); err != nil { 122 | h.jw.WriteError(w, r, err) 123 | return 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /backend/handler_index.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | _ "embed" 6 | "encoding/json" 7 | "github.com/julienschmidt/httprouter" 8 | "github.com/ory/herodot" 9 | rts "github.com/ory/keto/proto/ory/keto/relation_tuples/v1alpha2" 10 | "html/template" 11 | "net/http" 12 | "strconv" 13 | ) 14 | 15 | //go:embed ui/index.html 16 | var indexPage string 17 | 18 | type indexData struct { 19 | IdentityID, Username, Results, Email string 20 | } 21 | 22 | func (h *handler) index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 23 | res, err := h.repo.List(r.Context()) 24 | if err != nil { 25 | h.jw.WriteError(w, r, err) 26 | return 27 | } 28 | buf := bytes.Buffer{} 29 | enc := json.NewEncoder(&buf) 30 | enc.SetIndent("", " ") 31 | if err := enc.Encode(res); err != nil { 32 | h.jw.WriteError(w, r, err) 33 | return 34 | } 35 | t, err := template.New("index").Parse(indexPage) 36 | if err != nil { 37 | h.jw.WriteError(w, r, err) 38 | return 39 | } 40 | if err := t.Execute(w, &indexData{ 41 | IdentityID: r.Header.Get("X-User"), 42 | Username: r.Header.Get("X-Username"), 43 | Email: r.Header.Get("X-Useremail"), 44 | Results: buf.String(), 45 | }); err != nil { 46 | h.jw.WriteError(w, r, err) 47 | return 48 | } 49 | } 50 | 51 | func (h *handler) submit(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { 52 | getCount := func(name string) uint { 53 | count, err := strconv.ParseUint(r.FormValue(name), 10, 0) 54 | if err != nil { 55 | return 0 56 | } 57 | return uint(count) 58 | } 59 | res := &result{ 60 | District: r.FormValue("district"), 61 | Democrats: getCount("democrats"), 62 | Republicans: getCount("republicans"), 63 | Invalid: getCount("invalid"), 64 | } 65 | 66 | resp, err := h.ketoCheck.Check(r.Context(), &rts.CheckRequest{ 67 | Tuple: &rts.RelationTuple{ 68 | Namespace: "districts", 69 | Object: res.District, 70 | Relation: "submit", 71 | Subject: rts.NewSubjectID(r.Header.Get("X-User")), 72 | }, 73 | }) 74 | if err != nil { 75 | h.jw.WriteError(w, r, err) 76 | return 77 | } 78 | if !resp.Allowed { 79 | h.jw.WriteError(w, r, herodot.ErrForbidden.WithError("not allowed")) 80 | return 81 | } 82 | 83 | if err := h.repo.Submit(r.Context(), res.District, res); err != nil { 84 | h.jw.WriteError(w, r, herodot.ErrBadRequest.WithError(err.Error())) 85 | return 86 | } 87 | h.jw.WriteCreated(w, r, "/results", "") 88 | } 89 | -------------------------------------------------------------------------------- /backend/handler_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "github.com/stretchr/testify/require" 7 | "net/http" 8 | "net/http/httptest" 9 | "testing" 10 | 11 | "github.com/stretchr/testify/assert" 12 | ) 13 | 14 | func testHandlers(t *testing.T) http.Handler { 15 | t.Helper() 16 | repo, err := NewRepo(&Config{ 17 | DataSourceName: "sqlite3://:memory:", 18 | }) 19 | if err != nil { 20 | t.Fatal(err) 21 | } 22 | h, err := NewHandler(repo, nil) 23 | if err != nil { 24 | t.Fatal(err) 25 | } 26 | return h 27 | } 28 | 29 | func submit(t *testing.T, handler http.HandlerFunc, r *result) *httptest.ResponseRecorder { 30 | t.Helper() 31 | w := httptest.NewRecorder() 32 | bs, err := json.Marshal(r) 33 | require.NoError(t, err) 34 | 35 | req, err := http.NewRequest("POST", "/results/"+r.District, bytes.NewBuffer(bs)) 36 | require.NoError(t, err) 37 | 38 | handler(w, req) 39 | return w 40 | } 41 | 42 | func TestSubmitAndGet(t *testing.T) { 43 | t.Parallel() 44 | api := testHandlers(t).ServeHTTP 45 | 46 | assert.HTTPBodyContains(t, api, "GET", "/results", nil, "[]") 47 | 48 | results := []*result{{ 49 | District: "District 1", 50 | Democrats: 1, 51 | Republicans: 1, 52 | Invalid: 0, 53 | }, { 54 | District: "District 2", 55 | Democrats: 2, 56 | Republicans: 0, 57 | Invalid: 1, 58 | }} 59 | 60 | for _, r := range results { 61 | res := submit(t, api, r) 62 | assert.Equal(t, http.StatusCreated, res.Code, "%s", res.Body.String()) 63 | } 64 | 65 | expected, _ := json.Marshal(results) 66 | actual := assert.HTTPBody(api, "GET", "/results", nil) 67 | assert.JSONEq(t, string(expected), actual) 68 | } 69 | 70 | func TestSubmitUniqueDistrictIDs(t *testing.T) { 71 | t.Parallel() 72 | api := testHandlers(t).ServeHTTP 73 | 74 | res := submit(t, api, &result{District: "foo"}) 75 | assert.Equal(t, http.StatusCreated, res.Code, "first creat should succeed: %s", res.Body.String()) 76 | 77 | res = submit(t, api, &result{District: "foo"}) 78 | assert.Equal(t, http.StatusBadRequest, res.Code, "second create should fail: %s", res.Body.String()) 79 | } 80 | -------------------------------------------------------------------------------- /backend/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "net/http" 6 | 7 | "github.com/ory/graceful" 8 | ) 9 | 10 | func main() { 11 | config, err := newConfig() 12 | if err != nil { 13 | log.Fatal(err) 14 | } 15 | 16 | repo, err := NewRepo(config) 17 | if err != nil { 18 | log.Fatal(err) 19 | } 20 | 21 | h, err := NewHandler(repo, config) 22 | if err != nil { 23 | log.Fatal(err) 24 | } 25 | 26 | server := graceful.WithDefaults(&http.Server{ 27 | Addr: config.ListenAddress, 28 | Handler: h, 29 | }) 30 | 31 | if err := graceful.Graceful(func() error { 32 | log.Printf("Listening on http://%s", config.ListenAddress) 33 | return server.ListenAndServe() 34 | }, server.Shutdown); err != nil { 35 | log.Fatalf("Unable to gracefully shutdown HTTP(s) server because %v", err) 36 | return 37 | } 38 | log.Println("HTTP server was shutdown gracefully") 39 | } 40 | -------------------------------------------------------------------------------- /backend/results.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | ) 6 | 7 | type ( 8 | result struct { 9 | District string `json:"district"` 10 | Democrats uint `json:"democrats"` 11 | Republicans uint `json:"republicans"` 12 | Invalid uint `json:"invalid"` 13 | } 14 | 15 | repository interface { 16 | List(ctx context.Context) ([]*result, error) 17 | Submit(ctx context.Context, district string, r *result) error 18 | } 19 | ) 20 | -------------------------------------------------------------------------------- /backend/static/fa-brands.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome Free 6.1.2 by @fontawesome - https://fontawesome.com 3 | * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) 4 | * Copyright 2022 Fonticons, Inc. 5 | */ 6 | :host,:root{--fa-font-brands:normal 400 1em/1 "Font Awesome 6 Brands"}@font-face{font-family:"Font Awesome 6 Brands";font-style:normal;font-weight:400;font-display:block;src:url(webfonts/fa-brands-400.woff2) format("woff2"),url(webfonts/fa-brands-400.ttf) format("truetype")}.fa-brands,.fab{font-family:"Font Awesome 6 Brands";font-weight:400}.fa-42-group:before,.fa-innosoft:before{content:"\e080"}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-adn:before{content:"\f170"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-alipay:before{content:"\f642"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-amilia:before{content:"\f36d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-pay:before{content:"\f415"}.fa-artstation:before{content:"\f77a"}.fa-asymmetrik:before{content:"\f372"}.fa-atlassian:before{content:"\f77b"}.fa-audible:before{content:"\f373"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-aws:before{content:"\f375"}.fa-bandcamp:before{content:"\f2d5"}.fa-battle-net:before{content:"\f835"}.fa-behance:before{content:"\f1b4"}.fa-bilibili:before{content:"\e3d9"}.fa-bimobject:before{content:"\f378"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bootstrap:before{content:"\f836"}.fa-bots:before{content:"\e340"}.fa-btc:before{content:"\f15a"}.fa-buffer:before{content:"\f837"}.fa-buromobelexperte:before{content:"\f37f"}.fa-buy-n-large:before{content:"\f8a6"}.fa-buysellads:before{content:"\f20d"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-chrome:before{content:"\f268"}.fa-chromecast:before{content:"\f838"}.fa-cloudflare:before{content:"\e07d"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cmplid:before{content:"\e360"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cotton-bureau:before{content:"\f89e"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-critical-role:before{content:"\f6c9"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dailymotion:before{content:"\e052"}.fa-dashcube:before{content:"\f210"}.fa-deezer:before{content:"\e077"}.fa-delicious:before{content:"\f1a5"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dhl:before{content:"\f790"}.fa-diaspora:before{content:"\f791"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-draft2digital:before{content:"\f396"}.fa-dribbble:before{content:"\f17d"}.fa-dropbox:before{content:"\f16b"}.fa-drupal:before{content:"\f1a9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edge-legacy:before{content:"\e078"}.fa-elementor:before{content:"\f430"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envira:before{content:"\f299"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-etsy:before{content:"\f2d7"}.fa-evernote:before{content:"\f839"}.fa-expeditedssl:before{content:"\f23e"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-figma:before{content:"\f799"}.fa-firefox:before{content:"\f269"}.fa-firefox-browser:before{content:"\e007"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-fly:before{content:"\f417"}.fa-font-awesome-flag:before,.fa-font-awesome-logo-full:before,.fa-font-awesome:before{content:"\f2b4"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-fulcrum:before{content:"\f50b"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-git:before{content:"\f1d3"}.fa-git-alt:before{content:"\f841"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-gofore:before{content:"\f3a7"}.fa-golang:before{content:"\e40f"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-pay:before{content:"\e079"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-wallet:before{content:"\f1ee"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guilded:before{content:"\e07e"}.fa-gulp:before{content:"\f3ae"}.fa-hacker-news:before{content:"\f1d4"}.fa-hackerrank:before{content:"\f5f7"}.fa-hashnode:before{content:"\e499"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-hive:before{content:"\e07f"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-hotjar:before{content:"\f3b1"}.fa-houzz:before{content:"\f27c"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-ideal:before{content:"\e013"}.fa-imdb:before{content:"\f2d8"}.fa-instagram:before{content:"\f16d"}.fa-instalod:before{content:"\e081"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-itch-io:before{content:"\f83a"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joomla:before{content:"\f1aa"}.fa-js:before{content:"\f3b8"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaggle:before{content:"\f5fa"}.fa-keybase:before{content:"\f4f5"}.fa-keycdn:before{content:"\f3ba"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-korvue:before{content:"\f42f"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-leanpub:before{content:"\f212"}.fa-less:before{content:"\f41d"}.fa-line:before{content:"\f3c0"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-mailchimp:before{content:"\f59e"}.fa-mandalorian:before{content:"\f50f"}.fa-markdown:before{content:"\f60f"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-mdb:before{content:"\f8ca"}.fa-medapps:before{content:"\f3c6"}.fa-medium-m:before,.fa-medium:before{content:"\f23a"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-mendeley:before{content:"\f7b3"}.fa-meta:before{content:"\e49b"}.fa-microblog:before{content:"\e01a"}.fa-microsoft:before{content:"\f3ca"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mixer:before{content:"\e056"}.fa-mizuni:before{content:"\f3cc"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-nfc-directional:before{content:"\e530"}.fa-nfc-symbol:before{content:"\e531"}.fa-nimblr:before{content:"\f5a8"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-octopus-deploy:before{content:"\e082"}.fa-odnoklassniki:before{content:"\f263"}.fa-old-republic:before{content:"\f510"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-orcid:before{content:"\f8d2"}.fa-osi:before{content:"\f41a"}.fa-padlet:before{content:"\e4a0"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-palfed:before{content:"\f3d8"}.fa-patreon:before{content:"\f3d9"}.fa-paypal:before{content:"\f1ed"}.fa-perbyte:before{content:"\e083"}.fa-periscope:before{content:"\f3da"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pix:before{content:"\e43a"}.fa-playstation:before{content:"\f3df"}.fa-product-hunt:before{content:"\f288"}.fa-pushed:before{content:"\f3e1"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-r-project:before{content:"\f4f7"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-redhat:before{content:"\f7bc"}.fa-renren:before{content:"\f18b"}.fa-replyd:before{content:"\f3e6"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-rev:before{content:"\f5b2"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-rust:before{content:"\e07a"}.fa-safari:before{content:"\f267"}.fa-salesforce:before{content:"\f83b"}.fa-sass:before{content:"\f41e"}.fa-schlix:before{content:"\f3ea"}.fa-screenpal:before{content:"\e570"}.fa-scribd:before{content:"\f28a"}.fa-searchengin:before{content:"\f3eb"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-servicestack:before{content:"\f3ec"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shopify:before{content:"\e057"}.fa-shopware:before{content:"\f5b5"}.fa-simplybuilt:before{content:"\f215"}.fa-sistrix:before{content:"\f3ee"}.fa-sith:before{content:"\f512"}.fa-sitrox:before{content:"\e44a"}.fa-sketch:before{content:"\f7c6"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack-hash:before,.fa-slack:before{content:"\f198"}.fa-slideshare:before{content:"\f1e7"}.fa-snapchat-ghost:before,.fa-snapchat:before{content:"\f2ab"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-space-awesome:before{content:"\e5ac"}.fa-speakap:before{content:"\f3f3"}.fa-speaker-deck:before{content:"\f83c"}.fa-spotify:before{content:"\f1bc"}.fa-behance-square:before,.fa-square-behance:before{content:"\f1b5"}.fa-dribbble-square:before,.fa-square-dribbble:before{content:"\f397"}.fa-facebook-square:before,.fa-square-facebook:before{content:"\f082"}.fa-square-font-awesome:before{content:"\e5ad"}.fa-font-awesome-alt:before,.fa-square-font-awesome-stroke:before{content:"\f35c"}.fa-git-square:before,.fa-square-git:before{content:"\f1d2"}.fa-github-square:before,.fa-square-github:before{content:"\f092"}.fa-gitlab-square:before,.fa-square-gitlab:before{content:"\e5ae"}.fa-google-plus-square:before,.fa-square-google-plus:before{content:"\f0d4"}.fa-hacker-news-square:before,.fa-square-hacker-news:before{content:"\f3af"}.fa-instagram-square:before,.fa-square-instagram:before{content:"\e055"}.fa-js-square:before,.fa-square-js:before{content:"\f3b9"}.fa-lastfm-square:before,.fa-square-lastfm:before{content:"\f203"}.fa-odnoklassniki-square:before,.fa-square-odnoklassniki:before{content:"\f264"}.fa-pied-piper-square:before,.fa-square-pied-piper:before{content:"\e01e"}.fa-pinterest-square:before,.fa-square-pinterest:before{content:"\f0d3"}.fa-reddit-square:before,.fa-square-reddit:before{content:"\f1a2"}.fa-snapchat-square:before,.fa-square-snapchat:before{content:"\f2ad"}.fa-square-steam:before,.fa-steam-square:before{content:"\f1b7"}.fa-square-tumblr:before,.fa-tumblr-square:before{content:"\f174"}.fa-square-twitter:before,.fa-twitter-square:before{content:"\f081"}.fa-square-viadeo:before,.fa-viadeo-square:before{content:"\f2aa"}.fa-square-vimeo:before,.fa-vimeo-square:before{content:"\f194"}.fa-square-whatsapp:before,.fa-whatsapp-square:before{content:"\f40c"}.fa-square-xing:before,.fa-xing-square:before{content:"\f169"}.fa-square-youtube:before,.fa-youtube-square:before{content:"\f431"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stackpath:before{content:"\f842"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-symbol:before{content:"\f3f6"}.fa-sticker-mule:before{content:"\f3f7"}.fa-strava:before{content:"\f428"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-superpowers:before{content:"\f2dd"}.fa-supple:before{content:"\f3f9"}.fa-suse:before{content:"\f7d6"}.fa-swift:before{content:"\f8e1"}.fa-symfony:before{content:"\f83d"}.fa-teamspeak:before{content:"\f4f9"}.fa-telegram-plane:before,.fa-telegram:before{content:"\f2c6"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-the-red-yeti:before{content:"\f69d"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-think-peaks:before{content:"\f731"}.fa-tiktok:before{content:"\e07b"}.fa-trade-federation:before{content:"\f513"}.fa-trello:before{content:"\f181"}.fa-tumblr:before{content:"\f173"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbraco:before{content:"\f8e8"}.fa-uncharted:before{content:"\e084"}.fa-uniregistry:before{content:"\f404"}.fa-unity:before{content:"\e049"}.fa-unsplash:before{content:"\e07c"}.fa-untappd:before{content:"\f405"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-vaadin:before{content:"\f408"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viber:before{content:"\f409"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-vuejs:before{content:"\f41f"}.fa-watchman-monitoring:before{content:"\e087"}.fa-waze:before{content:"\f83f"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whmcs:before{content:"\f40d"}.fa-wikipedia-w:before{content:"\f266"}.fa-windows:before{content:"\f17a"}.fa-wirsindhandwerk:before,.fa-wsh:before{content:"\e2d0"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wodu:before{content:"\e088"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-rendact:before,.fa-wpressr:before{content:"\f3e4"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yammer:before{content:"\f840"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-zhihu:before{content:"\f63f"} -------------------------------------------------------------------------------- /backend/static/fa-solid.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome Free 6.1.2 by @fontawesome - https://fontawesome.com 3 | * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) 4 | * Copyright 2022 Fonticons, Inc. 5 | */ 6 | :host,:root{--fa-font-solid:normal 900 1em/1 "Font Awesome 6 Free"}@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:900;font-display:block;src:url(webfonts/fa-solid-900.woff2) format("woff2"),url(webfonts/fa-solid-900.ttf) format("truetype")}.fa-solid,.fas{font-family:"Font Awesome 6 Free";font-weight:900} -------------------------------------------------------------------------------- /backend/static/html/component-wrapper.d.ts: -------------------------------------------------------------------------------- 1 | import { ReactElement } from "react"; 2 | export declare const ComponentWrapper: (children: ReactElement) => string; 3 | //# sourceMappingURL=component-wrapper.d.ts.map -------------------------------------------------------------------------------- /backend/static/html/component-wrapper.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"component-wrapper.d.ts","sourceRoot":"","sources":["component-wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,OAAO,CAAC;AAEnC,eAAO,MAAM,gBAAgB,aAAc,YAAY,WAEtD,CAAA"} -------------------------------------------------------------------------------- /backend/static/html/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './component-wrapper'; 2 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /backend/static/html/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"} -------------------------------------------------------------------------------- /backend/static/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './theme'; 2 | export * from './react'; 3 | export * from './html'; 4 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /backend/static/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"} -------------------------------------------------------------------------------- /backend/static/index.es.js: -------------------------------------------------------------------------------- 1 | const pxToRem = (...px) => px.map((x) => `${x / 16}rem`).join(" "); 2 | const defaultBreakpoints = { 3 | sm: pxToRem(640), 4 | md: pxToRem(768), 5 | lg: pxToRem(1024), 6 | xl: pxToRem(1280), 7 | xl2: pxToRem(1536) 8 | }; 9 | const defaultFont = { 10 | fontFamily: "Inter", 11 | fontStyle: "normal" 12 | }; 13 | ({ 14 | fontFamily: "Inter", 15 | textDecoration: "none", 16 | fontSize: pxToRem(16), 17 | lineHeight: pxToRem(28) 18 | }); 19 | const defaultLightTheme = { 20 | ...defaultFont, 21 | accent: { 22 | def: "#3D53F5", 23 | muted: "#6475F7", 24 | emphasis: "#3142C4", 25 | disabled: "#E0E0E0", 26 | subtle: "#eceefe" 27 | }, 28 | foreground: { 29 | def: "#171717", 30 | muted: "#616161", 31 | subtle: "#9E9E9E", 32 | disabled: "#BDBDBD", 33 | onDark: "#FFFFFF", 34 | onAccent: "#FFFFFF", 35 | onDisabled: "#e0e0e0" 36 | }, 37 | background: { 38 | surface: "#FFFFFF", 39 | canvas: "#FCFCFC" 40 | }, 41 | error: { 42 | def: "#9c0f2e", 43 | subtle: "#fce8ec", 44 | muted: "#e95c7b", 45 | emphasis: "#DF1642" 46 | }, 47 | success: { 48 | emphasis: "#18A957" 49 | }, 50 | border: { 51 | def: "#E0E0E0" 52 | }, 53 | text: { 54 | def: "#FFFFFF", 55 | disabled: "#757575" 56 | }, 57 | input: { 58 | background: "#FFFFFF", 59 | disabled: "#E0E0E0", 60 | placeholder: "#9E9E9E", 61 | text: "#424242" 62 | } 63 | }; 64 | const defaultDarkTheme = { 65 | ...defaultFont, 66 | accent: { 67 | def: "#6475f7", 68 | disabled: "#757575", 69 | muted: "#3142c4", 70 | emphasis: "#3d53f5", 71 | subtle: "#0c1131" 72 | }, 73 | foreground: { 74 | def: "#FFFFFF", 75 | muted: "#ddd9f7", 76 | subtle: "#9a8ce8", 77 | onDark: "#FFFFFF", 78 | onAccent: "#FFFFFF", 79 | onDisabled: "#e0e0e0", 80 | disabled: "#bdbdbd" 81 | }, 82 | background: { 83 | surface: "#110d2b", 84 | canvas: "#090616" 85 | }, 86 | border: { 87 | def: "#221956" 88 | }, 89 | error: { 90 | def: "#e95c7b", 91 | subtle: "#2d040d", 92 | muted: "#9c0f2e", 93 | emphasis: "#df1642" 94 | }, 95 | success: { 96 | emphasis: "#18a957" 97 | }, 98 | input: { 99 | background: "#FFFFFF", 100 | text: "#424242", 101 | placeholder: "#9e9e9e", 102 | disabled: "#eeeeee" 103 | }, 104 | text: { 105 | def: "#FFFFFF", 106 | disabled: "#757575" 107 | } 108 | }; 109 | var theme_css_ts_vanilla = ""; 110 | var card_css_ts_vanilla = ""; 111 | function _defineProperty$1(obj, key, value) { 112 | if (key in obj) { 113 | Object.defineProperty(obj, key, { 114 | value, 115 | enumerable: true, 116 | configurable: true, 117 | writable: true 118 | }); 119 | } else { 120 | obj[key] = value; 121 | } 122 | return obj; 123 | } 124 | function ownKeys$1(object, enumerableOnly) { 125 | var keys = Object.keys(object); 126 | if (Object.getOwnPropertySymbols) { 127 | var symbols = Object.getOwnPropertySymbols(object); 128 | if (enumerableOnly) { 129 | symbols = symbols.filter(function(sym) { 130 | return Object.getOwnPropertyDescriptor(object, sym).enumerable; 131 | }); 132 | } 133 | keys.push.apply(keys, symbols); 134 | } 135 | return keys; 136 | } 137 | function _objectSpread2$1(target) { 138 | for (var i = 1; i < arguments.length; i++) { 139 | var source = arguments[i] != null ? arguments[i] : {}; 140 | if (i % 2) { 141 | ownKeys$1(Object(source), true).forEach(function(key) { 142 | _defineProperty$1(target, key, source[key]); 143 | }); 144 | } else if (Object.getOwnPropertyDescriptors) { 145 | Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 146 | } else { 147 | ownKeys$1(Object(source)).forEach(function(key) { 148 | Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 149 | }); 150 | } 151 | } 152 | return target; 153 | } 154 | var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => { 155 | for (var key of Object.keys(compoundCheck)) { 156 | var _selections$key; 157 | if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) { 158 | return false; 159 | } 160 | } 161 | return true; 162 | }; 163 | var createRuntimeFn = (config) => (options) => { 164 | var className = config.defaultClassName; 165 | var selections = _objectSpread2$1(_objectSpread2$1({}, config.defaultVariants), options); 166 | for (var variantName in selections) { 167 | var _selections$variantNa; 168 | var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName]; 169 | if (variantSelection != null) { 170 | var selection = variantSelection; 171 | if (typeof selection === "boolean") { 172 | selection = selection === true ? "true" : "false"; 173 | } 174 | var selectionClassName = config.variantClassNames[variantName][selection]; 175 | if (selectionClassName) { 176 | className += " " + selectionClassName; 177 | } 178 | } 179 | } 180 | for (var [compoundCheck, compoundClassName] of config.compoundVariants) { 181 | if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) { 182 | className += " " + compoundClassName; 183 | } 184 | } 185 | return className; 186 | }; 187 | var cardStyle = createRuntimeFn({ defaultClassName: "_660nzl0", variantClassNames: {}, defaultVariants: {}, compoundVariants: [] }); 188 | var cardTitleStyle = "_660nzl1"; 189 | var message_css_ts_vanilla = ""; 190 | var messageStyle = createRuntimeFn({ defaultClassName: "_1qj4dn90", variantClassNames: { severity: { error: "_1qj4dn91", success: "_1qj4dn92", disabled: "_1qj4dn93" } }, defaultVariants: {}, compoundVariants: [] }); 191 | var divider_css_ts_vanilla = ""; 192 | var dividerStyle = createRuntimeFn({ defaultClassName: "_3ldkmt0", variantClassNames: { sizes: { fullWidth: "_3ldkmt1" } }, defaultVariants: {}, compoundVariants: [] }); 193 | var typography_css_ts_vanilla = ""; 194 | var inputTypographyStyle = createRuntimeFn({ defaultClassName: "_1j36fun0", variantClassNames: { size: { "16": "_1j36fun1", "18": "_1j36fun2" }, type: { regular: "_1j36fun3", semiBold: "_1j36fun4" } }, defaultVariants: { size: 16, type: "regular" }, compoundVariants: [] }); 195 | var typographyStyle = createRuntimeFn({ defaultClassName: "_1j36fun5", variantClassNames: { size: { tiny: "_1j36fun6", xsmall: "_1j36fun7", small: "_1j36fun8", caption: "_1j36fun9", body: "_1j36funa", lead: "_1j36funb", headline21: "_1j36func", headline26: "_1j36fund", headline31: "_1j36fune", headline37: "_1j36funf", headline48: "_1j36fung", display: "_1j36funh", hero: "_1j36funi", uber: "_1j36funj", colossus: "_1j36funk" }, type: { regular: "_1j36funl", bold: "_1j36funm" } }, defaultVariants: { type: "regular" }, compoundVariants: [] }); 196 | var button_css_ts_vanilla = ""; 197 | var buttonStyle = createRuntimeFn({ defaultClassName: "_164adwm0", variantClassNames: { size: { medium: "_164adwm1", small: "_164adwm2", large: "_164adwm3" }, variant: { regular: "_164adwm4", semibold: "_164adwm5" } }, defaultVariants: {}, compoundVariants: [] }); 198 | var buttonLink_css_ts_vanilla = ""; 199 | var buttonLinkStyle = createRuntimeFn({ defaultClassName: "_1wdteob0", variantClassNames: {}, defaultVariants: {}, compoundVariants: [] }); 200 | var buttonSocial_css_ts_vanilla = ""; 201 | var buttonSocialIconStyle = createRuntimeFn({ defaultClassName: "_1ddohgb7", variantClassNames: { size: { small: "_1ddohgb8", medium: "_1ddohgb9", large: "_1ddohgba" } }, defaultVariants: {}, compoundVariants: [] }); 202 | var buttonSocialStyle = createRuntimeFn({ defaultClassName: "_1ddohgb0", variantClassNames: { size: { small: "_1ddohgb1", medium: "_1ddohgb2", large: "_1ddohgb3" }, variant: { regular: "_1ddohgb4", semibold: "_1ddohgb5" } }, defaultVariants: {}, compoundVariants: [] }); 203 | var buttonSocialTitleStyle = "_1ddohgb6"; 204 | var colors_css_ts_vanilla = ""; 205 | function _defineProperty(obj, key, value) { 206 | if (key in obj) { 207 | Object.defineProperty(obj, key, { 208 | value, 209 | enumerable: true, 210 | configurable: true, 211 | writable: true 212 | }); 213 | } else { 214 | obj[key] = value; 215 | } 216 | return obj; 217 | } 218 | function ownKeys(object, enumerableOnly) { 219 | var keys = Object.keys(object); 220 | if (Object.getOwnPropertySymbols) { 221 | var symbols = Object.getOwnPropertySymbols(object); 222 | if (enumerableOnly) { 223 | symbols = symbols.filter(function(sym) { 224 | return Object.getOwnPropertyDescriptor(object, sym).enumerable; 225 | }); 226 | } 227 | keys.push.apply(keys, symbols); 228 | } 229 | return keys; 230 | } 231 | function _objectSpread2(target) { 232 | for (var i = 1; i < arguments.length; i++) { 233 | var source = arguments[i] != null ? arguments[i] : {}; 234 | if (i % 2) { 235 | ownKeys(Object(source), true).forEach(function(key) { 236 | _defineProperty(target, key, source[key]); 237 | }); 238 | } else if (Object.getOwnPropertyDescriptors) { 239 | Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 240 | } else { 241 | ownKeys(Object(source)).forEach(function(key) { 242 | Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 243 | }); 244 | } 245 | } 246 | return target; 247 | } 248 | var createSprinkles$1 = (composeStyles2) => function() { 249 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 250 | args[_key] = arguments[_key]; 251 | } 252 | var sprinklesStyles = Object.assign({}, ...args.map((a) => a.styles)); 253 | var sprinklesKeys = Object.keys(sprinklesStyles); 254 | var shorthandNames = sprinklesKeys.filter((property) => "mappings" in sprinklesStyles[property]); 255 | var sprinklesFn = (props) => { 256 | var classNames = []; 257 | var shorthands = {}; 258 | var nonShorthands = _objectSpread2({}, props); 259 | var hasShorthands = false; 260 | for (var shorthand of shorthandNames) { 261 | var value = props[shorthand]; 262 | if (value != null) { 263 | var sprinkle = sprinklesStyles[shorthand]; 264 | hasShorthands = true; 265 | for (var propMapping of sprinkle.mappings) { 266 | shorthands[propMapping] = value; 267 | if (nonShorthands[propMapping] == null) { 268 | delete nonShorthands[propMapping]; 269 | } 270 | } 271 | } 272 | } 273 | var finalProps = hasShorthands ? _objectSpread2(_objectSpread2({}, shorthands), nonShorthands) : props; 274 | for (var prop in finalProps) { 275 | var propValue = finalProps[prop]; 276 | var _sprinkle = sprinklesStyles[prop]; 277 | try { 278 | if (_sprinkle.mappings) { 279 | continue; 280 | } 281 | if (typeof propValue === "string" || typeof propValue === "number") { 282 | if (false) 283 | ; 284 | classNames.push(_sprinkle.values[propValue].defaultClass); 285 | } else if (Array.isArray(propValue)) { 286 | for (var responsiveIndex = 0; responsiveIndex < propValue.length; responsiveIndex++) { 287 | var responsiveValue = propValue[responsiveIndex]; 288 | if (responsiveValue != null) { 289 | var conditionName = _sprinkle.responsiveArray[responsiveIndex]; 290 | if (false) 291 | ; 292 | classNames.push(_sprinkle.values[responsiveValue].conditions[conditionName]); 293 | } 294 | } 295 | } else { 296 | for (var _conditionName in propValue) { 297 | var _value = propValue[_conditionName]; 298 | if (_value != null) { 299 | if (false) 300 | ; 301 | classNames.push(_sprinkle.values[_value].conditions[_conditionName]); 302 | } 303 | } 304 | } 305 | } catch (e) { 306 | throw e; 307 | } 308 | } 309 | return composeStyles2(classNames.join(" ")); 310 | }; 311 | return Object.assign(sprinklesFn, { 312 | properties: new Set(sprinklesKeys) 313 | }); 314 | }; 315 | var composeStyles = (classList) => classList; 316 | var createSprinkles = function createSprinkles2() { 317 | return createSprinkles$1(composeStyles)(...arguments); 318 | }; 319 | var colorProperties = { conditions: void 0, styles: { color: { values: { accentDisabled: { defaultClass: "bf9b9v0" }, accentDefault: { defaultClass: "bf9b9v1" }, accentMuted: { defaultClass: "bf9b9v2" }, accentSubtle: { defaultClass: "bf9b9v3" }, accentEmphasis: { defaultClass: "bf9b9v4" }, foregroundDefault: { defaultClass: "bf9b9v5" }, foregroundMuted: { defaultClass: "bf9b9v6" }, foregroundSubtle: { defaultClass: "bf9b9v7" }, foregroundDisabled: { defaultClass: "bf9b9v8" }, foregroundOnDark: { defaultClass: "bf9b9v9" }, foregroundOnAccent: { defaultClass: "bf9b9va" }, backgroundSurface: { defaultClass: "bf9b9vb" }, backgroundCanvas: { defaultClass: "bf9b9vc" }, errorDefault: { defaultClass: "bf9b9vd" }, errorSubtle: { defaultClass: "bf9b9ve" }, errorMuted: { defaultClass: "bf9b9vf" }, errorEmphasis: { defaultClass: "bf9b9vg" }, successEmphasis: { defaultClass: "bf9b9vh" }, borderDefault: { defaultClass: "bf9b9vi" }, textDefault: { defaultClass: "bf9b9vj" }, textDisabled: { defaultClass: "bf9b9vk" }, inputBackground: { defaultClass: "bf9b9vl" }, inputDisabled: { defaultClass: "bf9b9vm" }, inputPlaceholder: { defaultClass: "bf9b9vn" }, inputText: { defaultClass: "bf9b9vo" } } } } }; 320 | var colorSprinkle = createSprinkles({ conditions: void 0, styles: { color: { values: { accentDisabled: { defaultClass: "bf9b9v0" }, accentDefault: { defaultClass: "bf9b9v1" }, accentMuted: { defaultClass: "bf9b9v2" }, accentSubtle: { defaultClass: "bf9b9v3" }, accentEmphasis: { defaultClass: "bf9b9v4" }, foregroundDefault: { defaultClass: "bf9b9v5" }, foregroundMuted: { defaultClass: "bf9b9v6" }, foregroundSubtle: { defaultClass: "bf9b9v7" }, foregroundDisabled: { defaultClass: "bf9b9v8" }, foregroundOnDark: { defaultClass: "bf9b9v9" }, foregroundOnAccent: { defaultClass: "bf9b9va" }, backgroundSurface: { defaultClass: "bf9b9vb" }, backgroundCanvas: { defaultClass: "bf9b9vc" }, errorDefault: { defaultClass: "bf9b9vd" }, errorSubtle: { defaultClass: "bf9b9ve" }, errorMuted: { defaultClass: "bf9b9vf" }, errorEmphasis: { defaultClass: "bf9b9vg" }, successEmphasis: { defaultClass: "bf9b9vh" }, borderDefault: { defaultClass: "bf9b9vi" }, textDefault: { defaultClass: "bf9b9vj" }, textDisabled: { defaultClass: "bf9b9vk" }, inputBackground: { defaultClass: "bf9b9vl" }, inputDisabled: { defaultClass: "bf9b9vm" }, inputPlaceholder: { defaultClass: "bf9b9vn" }, inputText: { defaultClass: "bf9b9vo" } } } } }); 321 | var oryTheme = { fontFamily: "var(--ory-theme-font-family)", fontStyle: "var(--ory-theme-font-style)", accent: { def: "var(--ory-theme-accent-def)", muted: "var(--ory-theme-accent-muted)", emphasis: "var(--ory-theme-accent-emphasis)", disabled: "var(--ory-theme-accent-disabled)", subtle: "var(--ory-theme-accent-subtle)" }, foreground: { def: "var(--ory-theme-foreground-def)", muted: "var(--ory-theme-foreground-muted)", subtle: "var(--ory-theme-foreground-subtle)", disabled: "var(--ory-theme-foreground-disabled)", onDark: "var(--ory-theme-foreground-on-dark)", onAccent: "var(--ory-theme-foreground-on-accent)", onDisabled: "var(--ory-theme-foreground-on-disabled)" }, background: { surface: "var(--ory-theme-background-surface)", canvas: "var(--ory-theme-background-canvas)" }, error: { def: "var(--ory-theme-error-def)", subtle: "var(--ory-theme-error-subtle)", muted: "var(--ory-theme-error-muted)", emphasis: "var(--ory-theme-error-emphasis)" }, success: { emphasis: "var(--ory-theme-success-emphasis)" }, border: { def: "var(--ory-theme-border-def)" }, text: { def: "var(--ory-theme-text-def)", disabled: "var(--ory-theme-text-disabled)" }, input: { background: "var(--ory-theme-input-background)", disabled: "var(--ory-theme-input-disabled)", placeholder: "var(--ory-theme-input-placeholder)", text: "var(--ory-theme-input-text)" } }; 322 | var grid_css_ts_vanilla = ""; 323 | var gridStyle = createRuntimeFn({ defaultClassName: "juizgb0", variantClassNames: { direction: { row: "juizgb1", column: "juizgb2" }, gap: { "4": "juizgb3", "8": "juizgb4", "16": "juizgb5", "32": "juizgb6", "64": "juizgb7" } }, defaultVariants: {}, compoundVariants: [] }); 324 | var checkbox_css_ts_vanilla = ""; 325 | var checkboxInputStyle = "_1m7dk2l1"; 326 | var checkboxStyle = "_1m7dk2l0"; 327 | var inputField_css_ts_vanilla = ""; 328 | var inputFieldStyle = "a0s6411"; 329 | var inputFieldTitleStyle = "a0s6410"; 330 | export { buttonLinkStyle, buttonSocialIconStyle, buttonSocialStyle, buttonSocialTitleStyle, buttonStyle, cardStyle, cardTitleStyle, checkboxInputStyle, checkboxStyle, colorProperties, colorSprinkle, defaultBreakpoints, defaultDarkTheme, defaultFont, defaultLightTheme, dividerStyle, gridStyle, inputFieldStyle, inputFieldTitleStyle, inputTypographyStyle, messageStyle, oryTheme, typographyStyle }; 331 | //# sourceMappingURL=index.es.js.map 332 | -------------------------------------------------------------------------------- /backend/static/inter-font.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Inter'; 3 | font-style: normal; 4 | font-weight: 400; 5 | font-display: swap; 6 | src: url("inter/Inter-Regular.woff2?v=3.19") format("woff2"), 7 | url("inter/Inter-Regular.woff?v=3.19") format("woff"); 8 | } 9 | 10 | @font-face { 11 | font-family: 'Inter'; 12 | font-style: normal; 13 | font-weight: 700; 14 | font-display: swap; 15 | src: url("inter/Inter-Bold.woff2?v=3.19") format("woff2"), 16 | url("inter/Inter-Bold.woff?v=3.19") format("woff"); 17 | } 18 | 19 | @font-face { 20 | font-family: 'Inter'; 21 | font-style: normal; 22 | font-weight: 600; 23 | font-display: swap; 24 | src: url("inter/Inter-SemiBold.woff2?v=3.19") format("woff2"), 25 | url("inter/Inter-SemiBold.woff?v=3.19") format("woff"); 26 | } 27 | -------------------------------------------------------------------------------- /backend/static/inter/Inter-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/backend/static/inter/Inter-Bold.woff -------------------------------------------------------------------------------- /backend/static/inter/Inter-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/backend/static/inter/Inter-Bold.woff2 -------------------------------------------------------------------------------- /backend/static/inter/Inter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/backend/static/inter/Inter-Regular.woff -------------------------------------------------------------------------------- /backend/static/inter/Inter-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/backend/static/inter/Inter-Regular.woff2 -------------------------------------------------------------------------------- /backend/static/inter/Inter-SemiBold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/backend/static/inter/Inter-SemiBold.woff -------------------------------------------------------------------------------- /backend/static/inter/Inter-SemiBold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/backend/static/inter/Inter-SemiBold.woff2 -------------------------------------------------------------------------------- /backend/static/main.css: -------------------------------------------------------------------------------- 1 | @import url("style.css"); 2 | 3 | body { 4 | padding-top: 32px; 5 | padding-bottom: 32px; 6 | margin: auto; 7 | min-height: 100vh; 8 | min-width: 100vw; 9 | background: var(--ory-theme-background-canvas); 10 | display: flex; 11 | flex-direction: column; 12 | align-items: center; 13 | } 14 | 15 | input[type="submit"], 16 | input[type="text"] { 17 | width: 100%; 18 | } 19 | -------------------------------------------------------------------------------- /backend/static/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ 2 | 3 | /* Document 4 | ========================================================================== */ 5 | 6 | /** 7 | * 1. Correct the line height in all browsers. 8 | * 2. Prevent adjustments of font size after orientation changes in iOS. 9 | */ 10 | 11 | html { 12 | line-height: 1.15; /* 1 */ 13 | -webkit-text-size-adjust: 100%; /* 2 */ 14 | } 15 | 16 | /* Sections 17 | ========================================================================== */ 18 | 19 | /** 20 | * Remove the margin in all browsers. 21 | */ 22 | 23 | body { 24 | margin: 0; 25 | } 26 | 27 | /** 28 | * Render the `main` element consistently in IE. 29 | */ 30 | 31 | main { 32 | display: block; 33 | } 34 | 35 | /** 36 | * Correct the font size and margin on `h1` elements within `section` and 37 | * `article` contexts in Chrome, Firefox, and Safari. 38 | */ 39 | 40 | h1 { 41 | font-size: 2em; 42 | margin: 0.67em 0; 43 | } 44 | 45 | /* Grouping content 46 | ========================================================================== */ 47 | 48 | /** 49 | * 1. Add the correct box sizing in Firefox. 50 | * 2. Show the overflow in Edge and IE. 51 | */ 52 | 53 | hr { 54 | box-sizing: content-box; /* 1 */ 55 | height: 0; /* 1 */ 56 | overflow: visible; /* 2 */ 57 | } 58 | 59 | /** 60 | * 1. Correct the inheritance and scaling of font size in all browsers. 61 | * 2. Correct the odd `em` font sizing in all browsers. 62 | */ 63 | 64 | pre { 65 | font-family: monospace, monospace; /* 1 */ 66 | font-size: 1em; /* 2 */ 67 | } 68 | 69 | /* Text-level semantics 70 | ========================================================================== */ 71 | 72 | /** 73 | * Remove the gray background on active links in IE 10. 74 | */ 75 | 76 | a { 77 | background-color: transparent; 78 | } 79 | 80 | /** 81 | * 1. Remove the bottom border in Chrome 57- 82 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. 83 | */ 84 | 85 | abbr[title] { 86 | border-bottom: none; /* 1 */ 87 | text-decoration: underline; /* 2 */ 88 | text-decoration: underline dotted; /* 2 */ 89 | } 90 | 91 | /** 92 | * Add the correct font weight in Chrome, Edge, and Safari. 93 | */ 94 | 95 | b, 96 | strong { 97 | font-weight: bolder; 98 | } 99 | 100 | /** 101 | * 1. Correct the inheritance and scaling of font size in all browsers. 102 | * 2. Correct the odd `em` font sizing in all browsers. 103 | */ 104 | 105 | code, 106 | kbd, 107 | samp { 108 | font-family: monospace, monospace; /* 1 */ 109 | font-size: 1em; /* 2 */ 110 | } 111 | 112 | /** 113 | * Add the correct font size in all browsers. 114 | */ 115 | 116 | small { 117 | font-size: 80%; 118 | } 119 | 120 | /** 121 | * Prevent `sub` and `sup` elements from affecting the line height in 122 | * all browsers. 123 | */ 124 | 125 | sub, 126 | sup { 127 | font-size: 75%; 128 | line-height: 0; 129 | position: relative; 130 | vertical-align: baseline; 131 | } 132 | 133 | sub { 134 | bottom: -0.25em; 135 | } 136 | 137 | sup { 138 | top: -0.5em; 139 | } 140 | 141 | /* Embedded content 142 | ========================================================================== */ 143 | 144 | /** 145 | * Remove the border on images inside links in IE 10. 146 | */ 147 | 148 | img { 149 | border-style: none; 150 | } 151 | 152 | /* Forms 153 | ========================================================================== */ 154 | 155 | /** 156 | * 1. Change the font styles in all browsers. 157 | * 2. Remove the margin in Firefox and Safari. 158 | */ 159 | 160 | button, 161 | input, 162 | optgroup, 163 | select, 164 | textarea { 165 | font-family: inherit; /* 1 */ 166 | font-size: 100%; /* 1 */ 167 | line-height: 1.15; /* 1 */ 168 | margin: 0; /* 2 */ 169 | } 170 | 171 | /** 172 | * Show the overflow in IE. 173 | * 1. Show the overflow in Edge. 174 | */ 175 | 176 | button, 177 | input { /* 1 */ 178 | overflow: visible; 179 | } 180 | 181 | /** 182 | * Remove the inheritance of text transform in Edge, Firefox, and IE. 183 | * 1. Remove the inheritance of text transform in Firefox. 184 | */ 185 | 186 | button, 187 | select { /* 1 */ 188 | text-transform: none; 189 | } 190 | 191 | /** 192 | * Correct the inability to style clickable types in iOS and Safari. 193 | */ 194 | 195 | button, 196 | [type="button"], 197 | [type="reset"], 198 | [type="submit"] { 199 | -webkit-appearance: button; 200 | } 201 | 202 | /** 203 | * Remove the inner border and padding in Firefox. 204 | */ 205 | 206 | button::-moz-focus-inner, 207 | [type="button"]::-moz-focus-inner, 208 | [type="reset"]::-moz-focus-inner, 209 | [type="submit"]::-moz-focus-inner { 210 | border-style: none; 211 | padding: 0; 212 | } 213 | 214 | /** 215 | * Restore the focus styles unset by the previous rule. 216 | */ 217 | 218 | button:-moz-focusring, 219 | [type="button"]:-moz-focusring, 220 | [type="reset"]:-moz-focusring, 221 | [type="submit"]:-moz-focusring { 222 | outline: 1px dotted ButtonText; 223 | } 224 | 225 | /** 226 | * Correct the padding in Firefox. 227 | */ 228 | 229 | fieldset { 230 | padding: 0.35em 0.75em 0.625em; 231 | } 232 | 233 | /** 234 | * 1. Correct the text wrapping in Edge and IE. 235 | * 2. Correct the color inheritance from `fieldset` elements in IE. 236 | * 3. Remove the padding so developers are not caught out when they zero out 237 | * `fieldset` elements in all browsers. 238 | */ 239 | 240 | legend { 241 | box-sizing: border-box; /* 1 */ 242 | color: inherit; /* 2 */ 243 | display: table; /* 1 */ 244 | max-width: 100%; /* 1 */ 245 | padding: 0; /* 3 */ 246 | white-space: normal; /* 1 */ 247 | } 248 | 249 | /** 250 | * Add the correct vertical alignment in Chrome, Firefox, and Opera. 251 | */ 252 | 253 | progress { 254 | vertical-align: baseline; 255 | } 256 | 257 | /** 258 | * Remove the default vertical scrollbar in IE 10+. 259 | */ 260 | 261 | textarea { 262 | overflow: auto; 263 | } 264 | 265 | /** 266 | * 1. Add the correct box sizing in IE 10. 267 | * 2. Remove the padding in IE 10. 268 | */ 269 | 270 | [type="checkbox"], 271 | [type="radio"] { 272 | box-sizing: border-box; /* 1 */ 273 | padding: 0; /* 2 */ 274 | } 275 | 276 | /** 277 | * Correct the cursor style of increment and decrement buttons in Chrome. 278 | */ 279 | 280 | [type="number"]::-webkit-inner-spin-button, 281 | [type="number"]::-webkit-outer-spin-button { 282 | height: auto; 283 | } 284 | 285 | /** 286 | * 1. Correct the odd appearance in Chrome and Safari. 287 | * 2. Correct the outline style in Safari. 288 | */ 289 | 290 | [type="search"] { 291 | -webkit-appearance: textfield; /* 1 */ 292 | outline-offset: -2px; /* 2 */ 293 | } 294 | 295 | /** 296 | * Remove the inner padding in Chrome and Safari on macOS. 297 | */ 298 | 299 | [type="search"]::-webkit-search-decoration { 300 | -webkit-appearance: none; 301 | } 302 | 303 | /** 304 | * 1. Correct the inability to style clickable types in iOS and Safari. 305 | * 2. Change font properties to `inherit` in Safari. 306 | */ 307 | 308 | ::-webkit-file-upload-button { 309 | -webkit-appearance: button; /* 1 */ 310 | font: inherit; /* 2 */ 311 | } 312 | 313 | /* Interactive 314 | ========================================================================== */ 315 | 316 | /* 317 | * Add the correct display in Edge, IE 10+, and Firefox. 318 | */ 319 | 320 | details { 321 | display: block; 322 | } 323 | 324 | /* 325 | * Add the correct display in all browsers. 326 | */ 327 | 328 | summary { 329 | display: list-item; 330 | } 331 | 332 | /* Misc 333 | ========================================================================== */ 334 | 335 | /** 336 | * Add the correct display in IE 10+. 337 | */ 338 | 339 | template { 340 | display: none; 341 | } 342 | 343 | /** 344 | * Add the correct display in IE 10. 345 | */ 346 | 347 | [hidden] { 348 | display: none; 349 | } 350 | -------------------------------------------------------------------------------- /backend/static/theme/button-link.css.d.ts: -------------------------------------------------------------------------------- 1 | export declare const buttonLinkStyle: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn; 2 | //# sourceMappingURL=button-link.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/button-link.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"button-link.css.d.ts","sourceRoot":"","sources":["button-link.css.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,wJAkB1B,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/button-social.css.d.ts: -------------------------------------------------------------------------------- 1 | import { RecipeVariants } from '@vanilla-extract/recipes'; 2 | export declare const buttonSocialStyle: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{ 3 | size: { 4 | small: { 5 | fontSize: string; 6 | lineHeight: string; 7 | }; 8 | medium: { 9 | fontSize: string; 10 | lineHeight: string; 11 | }; 12 | large: { 13 | fontSize: string; 14 | lineHeight: string; 15 | padding: string; 16 | }; 17 | }; 18 | variant: { 19 | regular: { 20 | fontWeight: number; 21 | fontStyle: "normal"; 22 | }; 23 | semibold: { 24 | fontWeight: number; 25 | fontStyle: "normal"; 26 | }; 27 | }; 28 | }>; 29 | export declare const buttonSocialTitleStyle: string; 30 | export declare const buttonSocialIconStyle: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{ 31 | size: { 32 | small: {}; 33 | medium: {}; 34 | large: { 35 | paddingRight: string; 36 | fontSize: string; 37 | }; 38 | }; 39 | }>; 40 | export declare type ButtonSocialStyle = RecipeVariants; 41 | //# sourceMappingURL=button-social.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/button-social.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"button-social.css.d.ts","sourceRoot":"","sources":["button-social.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAKlE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;EAkF5B,CAAC;AAEH,eAAO,MAAM,sBAAsB,QAKjC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;EAmBhC,CAAC;AAGH,oBAAY,iBAAiB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/button.css.d.ts: -------------------------------------------------------------------------------- 1 | import { RecipeVariants } from '@vanilla-extract/recipes'; 2 | export declare const buttonStyle: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{ 3 | size: { 4 | medium: { 5 | fontSize: string; 6 | lineHeight: string; 7 | }; 8 | small: { 9 | fontSize: string; 10 | lineHeight: string; 11 | }; 12 | large: { 13 | fontSize: string; 14 | lineHeight: string; 15 | padding: string; 16 | }; 17 | }; 18 | variant: { 19 | regular: { 20 | fontWeight: number; 21 | fontStyle: "normal"; 22 | }; 23 | semibold: { 24 | fontWeight: number; 25 | fontStyle: "normal"; 26 | }; 27 | }; 28 | }>; 29 | export declare type ButtonStyle = RecipeVariants; 30 | //# sourceMappingURL=button.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/button.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"button.css.d.ts","sourceRoot":"","sources":["button.css.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGlE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;EAuEtB,CAAC;AAGH,oBAAY,WAAW,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/card.css.d.ts: -------------------------------------------------------------------------------- 1 | import { RecipeVariants } from '@vanilla-extract/recipes'; 2 | export declare const cardTitleStyle: string; 3 | export declare const cardStyle: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn; 4 | export declare type CardStyle = RecipeVariants; 5 | //# sourceMappingURL=card.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/card.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"card.css.d.ts","sourceRoot":"","sources":["card.css.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAuBlE,eAAO,MAAM,cAAc,QAEzB,CAAC;AAIH,eAAO,MAAM,SAAS,wJAEpB,CAAC;AAGH,oBAAY,SAAS,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/checkbox.css.d.ts: -------------------------------------------------------------------------------- 1 | export declare const checkboxStyle: string; 2 | export declare const checkboxInputStyle: string; 3 | //# sourceMappingURL=checkbox.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/checkbox.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"checkbox.css.d.ts","sourceRoot":"","sources":["checkbox.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,QAKxB,CAAC;AAEH,eAAO,MAAM,kBAAkB,QA4B7B,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/colors.css.d.ts: -------------------------------------------------------------------------------- 1 | export declare const colorProperties: { 2 | conditions: never; 3 | styles: { 4 | color: { 5 | values: { 6 | accentDisabled: { 7 | defaultClass: string; 8 | }; 9 | accentDefault: { 10 | defaultClass: string; 11 | }; 12 | accentMuted: { 13 | defaultClass: string; 14 | }; 15 | accentSubtle: { 16 | defaultClass: string; 17 | }; 18 | accentEmphasis: { 19 | defaultClass: string; 20 | }; 21 | foregroundDefault: { 22 | defaultClass: string; 23 | }; 24 | foregroundMuted: { 25 | defaultClass: string; 26 | }; 27 | foregroundSubtle: { 28 | defaultClass: string; 29 | }; 30 | foregroundDisabled: { 31 | defaultClass: string; 32 | }; 33 | foregroundOnDark: { 34 | defaultClass: string; 35 | }; 36 | foregroundOnAccent: { 37 | defaultClass: string; 38 | }; 39 | backgroundSurface: { 40 | defaultClass: string; 41 | }; 42 | backgroundCanvas: { 43 | defaultClass: string; 44 | }; 45 | errorDefault: { 46 | defaultClass: string; 47 | }; 48 | errorSubtle: { 49 | defaultClass: string; 50 | }; 51 | errorMuted: { 52 | defaultClass: string; 53 | }; 54 | errorEmphasis: { 55 | defaultClass: string; 56 | }; 57 | successEmphasis: { 58 | defaultClass: string; 59 | }; 60 | borderDefault: { 61 | defaultClass: string; 62 | }; 63 | textDefault: { 64 | defaultClass: string; 65 | }; 66 | textDisabled: { 67 | defaultClass: string; 68 | }; 69 | inputBackground: { 70 | defaultClass: string; 71 | }; 72 | inputDisabled: { 73 | defaultClass: string; 74 | }; 75 | inputPlaceholder: { 76 | defaultClass: string; 77 | }; 78 | inputText: { 79 | defaultClass: string; 80 | }; 81 | }; 82 | }; 83 | }; 84 | }; 85 | export declare const colorSprinkle: import("@vanilla-extract/sprinkles/dist/declarations/src/createSprinkles").SprinklesFn<[{ 86 | conditions: never; 87 | styles: { 88 | color: { 89 | values: { 90 | accentDisabled: { 91 | defaultClass: string; 92 | }; 93 | accentDefault: { 94 | defaultClass: string; 95 | }; 96 | accentMuted: { 97 | defaultClass: string; 98 | }; 99 | accentSubtle: { 100 | defaultClass: string; 101 | }; 102 | accentEmphasis: { 103 | defaultClass: string; 104 | }; 105 | foregroundDefault: { 106 | defaultClass: string; 107 | }; 108 | foregroundMuted: { 109 | defaultClass: string; 110 | }; 111 | foregroundSubtle: { 112 | defaultClass: string; 113 | }; 114 | foregroundDisabled: { 115 | defaultClass: string; 116 | }; 117 | foregroundOnDark: { 118 | defaultClass: string; 119 | }; 120 | foregroundOnAccent: { 121 | defaultClass: string; 122 | }; 123 | backgroundSurface: { 124 | defaultClass: string; 125 | }; 126 | backgroundCanvas: { 127 | defaultClass: string; 128 | }; 129 | errorDefault: { 130 | defaultClass: string; 131 | }; 132 | errorSubtle: { 133 | defaultClass: string; 134 | }; 135 | errorMuted: { 136 | defaultClass: string; 137 | }; 138 | errorEmphasis: { 139 | defaultClass: string; 140 | }; 141 | successEmphasis: { 142 | defaultClass: string; 143 | }; 144 | borderDefault: { 145 | defaultClass: string; 146 | }; 147 | textDefault: { 148 | defaultClass: string; 149 | }; 150 | textDisabled: { 151 | defaultClass: string; 152 | }; 153 | inputBackground: { 154 | defaultClass: string; 155 | }; 156 | inputDisabled: { 157 | defaultClass: string; 158 | }; 159 | inputPlaceholder: { 160 | defaultClass: string; 161 | }; 162 | inputText: { 163 | defaultClass: string; 164 | }; 165 | }; 166 | }; 167 | }; 168 | }]>; 169 | export declare type ColorSprinkle = Parameters[0]; 170 | //# sourceMappingURL=colors.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/colors.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"colors.css.d.ts","sourceRoot":"","sources":["colors.css.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B1B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmC,CAAC;AAG9D,oBAAY,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/consts.d.ts: -------------------------------------------------------------------------------- 1 | export declare type Font = { 2 | fontFamily: string; 3 | fontStyle: string; 4 | }; 5 | export declare type BreakPoints = { 6 | sm: string; 7 | md: string; 8 | lg: string; 9 | xl: string; 10 | xl2: string; 11 | }; 12 | export declare const defaultBreakpoints: BreakPoints; 13 | export declare type Theme = { 14 | accent: { 15 | def: string; 16 | muted: string; 17 | emphasis: string; 18 | disabled: string; 19 | subtle: string; 20 | }; 21 | foreground: { 22 | def: string; 23 | muted: string; 24 | subtle: string; 25 | disabled: string; 26 | onDark: string; 27 | onAccent: string; 28 | onDisabled: string; 29 | }; 30 | background: { 31 | surface: string; 32 | canvas: string; 33 | }; 34 | error: { 35 | def: string; 36 | subtle: string; 37 | muted: string; 38 | emphasis: string; 39 | }; 40 | success: { 41 | emphasis: string; 42 | }; 43 | border: { 44 | def: string; 45 | }; 46 | text: { 47 | def: string; 48 | disabled: string; 49 | }; 50 | input: { 51 | background: string; 52 | disabled: string; 53 | placeholder: string; 54 | text: string; 55 | }; 56 | } & Font; 57 | export declare const defaultFont: { 58 | fontFamily: string; 59 | fontStyle: string; 60 | }; 61 | export declare const defaultLightTheme: Theme; 62 | export declare const defaultDarkTheme: Theme; 63 | //# sourceMappingURL=consts.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/consts.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["consts.ts"],"names":[],"mappings":"AAEA,oBAAY,IAAI,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oBAAY,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,WAMhC,CAAC;AAEF,oBAAY,KAAK,GAAG;IAClB,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,UAAU,EAAE;QACV,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,GAAG,IAAI,CAAC;AAET,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AASF,eAAO,MAAM,iBAAiB,EAAE,KA4C/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KA4C9B,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/divider.css.d.ts: -------------------------------------------------------------------------------- 1 | import { RecipeVariants } from '@vanilla-extract/recipes'; 2 | export declare const dividerStyle: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{ 3 | sizes: { 4 | fullWidth: { 5 | width: "100%"; 6 | }; 7 | }; 8 | }>; 9 | export declare type DividerStyle = RecipeVariants; 10 | //# sourceMappingURL=divider.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/divider.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"divider.css.d.ts","sourceRoot":"","sources":["divider.css.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAElE,eAAO,MAAM,YAAY;;;;;;EAkBvB,CAAC;AAGH,oBAAY,YAAY,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/grid.css.d.ts: -------------------------------------------------------------------------------- 1 | import { RecipeVariants } from '@vanilla-extract/recipes'; 2 | export declare const gridStyle: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{ 3 | direction: { 4 | row: { 5 | flexDirection: "row"; 6 | }; 7 | column: { 8 | flexDirection: "column"; 9 | }; 10 | }; 11 | gap: { 12 | 4: { 13 | gap: string; 14 | }; 15 | 8: { 16 | gap: string; 17 | }; 18 | 16: { 19 | gap: string; 20 | }; 21 | 32: { 22 | gap: string; 23 | }; 24 | 64: { 25 | gap: string; 26 | }; 27 | }; 28 | }>; 29 | export declare type GridStyle = RecipeVariants; 30 | //# sourceMappingURL=grid.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/grid.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"grid.css.d.ts","sourceRoot":"","sources":["grid.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGlE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCpB,CAAC;AAGH,oBAAY,SAAS,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './consts'; 2 | export * from './card.css'; 3 | export * from './message.css'; 4 | export * from './divider.css'; 5 | export * from './typography.css'; 6 | export * from './button.css'; 7 | export * from './button-link.css'; 8 | export * from './button-social.css'; 9 | export * from './colors.css'; 10 | export * from './theme.css'; 11 | export * from './grid.css'; 12 | export * from './checkbox.css'; 13 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/input-field.css.d.ts: -------------------------------------------------------------------------------- 1 | export declare const inputFieldTitleStyle: string; 2 | export declare const inputFieldStyle: string; 3 | //# sourceMappingURL=input-field.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/input-field.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"input-field.css.d.ts","sourceRoot":"","sources":["input-field.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,QAE/B,CAAC;AAEH,eAAO,MAAM,eAAe,QA6B1B,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/message.css.d.ts: -------------------------------------------------------------------------------- 1 | import { RecipeVariants } from '@vanilla-extract/recipes'; 2 | export declare const messageStyle: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{ 3 | severity: { 4 | error: { 5 | color: import("@vanilla-extract/private").CSSVarFunction; 6 | }; 7 | success: { 8 | color: import("@vanilla-extract/private").CSSVarFunction; 9 | }; 10 | disabled: { 11 | color: import("@vanilla-extract/private").CSSVarFunction; 12 | }; 13 | }; 14 | }>; 15 | export declare type MessageStyle = RecipeVariants; 16 | //# sourceMappingURL=message.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/message.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"message.css.d.ts","sourceRoot":"","sources":["message.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAElE,eAAO,MAAM,YAAY;;;;;;;;;;;;EAsBvB,CAAC;AAEH,oBAAY,YAAY,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/theme.css.d.ts: -------------------------------------------------------------------------------- 1 | export declare const oryTheme: import("@vanilla-extract/private").MapLeafNodes<{ 2 | fontFamily: string; 3 | fontStyle: string; 4 | accent: { 5 | def: string; 6 | muted: string; 7 | emphasis: string; 8 | disabled: string; 9 | subtle: string; 10 | }; 11 | foreground: { 12 | def: string; 13 | muted: string; 14 | subtle: string; 15 | disabled: string; 16 | onDark: string; 17 | onAccent: string; 18 | onDisabled: string; 19 | }; 20 | background: { 21 | surface: string; 22 | canvas: string; 23 | }; 24 | error: { 25 | def: string; 26 | subtle: string; 27 | muted: string; 28 | emphasis: string; 29 | }; 30 | success: { 31 | emphasis: string; 32 | }; 33 | border: { 34 | def: string; 35 | }; 36 | text: { 37 | def: string; 38 | disabled: string; 39 | }; 40 | input: { 41 | background: string; 42 | disabled: string; 43 | placeholder: string; 44 | text: string; 45 | }; 46 | }, import("@vanilla-extract/private").CSSVarFunction>; 47 | //# sourceMappingURL=theme.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/theme.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"theme.css.d.ts","sourceRoot":"","sources":["theme.css.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qDAgDpB,CAAC"} -------------------------------------------------------------------------------- /backend/static/theme/typography.css.d.ts: -------------------------------------------------------------------------------- 1 | import { RecipeVariants } from '@vanilla-extract/recipes'; 2 | export declare const inputTypographyStyle: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{ 3 | size: { 4 | 16: { 5 | fontSize: string; 6 | lineHeight: string; 7 | }; 8 | 18: { 9 | fontSize: string; 10 | lineHeight: string; 11 | }; 12 | }; 13 | type: { 14 | regular: { 15 | fontWeight: number; 16 | fontStyle: "normal"; 17 | }; 18 | semiBold: { 19 | fontWeight: number; 20 | fontStyle: "normal"; 21 | }; 22 | }; 23 | }>; 24 | export declare type InputTypographyStyle = RecipeVariants; 25 | export declare const typographyStyle: import("@vanilla-extract/recipes/dist/declarations/src/types").RuntimeFn<{ 26 | size: { 27 | tiny: { 28 | fontSize: string; 29 | lineHeight: string; 30 | }; 31 | xsmall: { 32 | fontSize: string; 33 | lineHeight: string; 34 | }; 35 | small: { 36 | fontSize: string; 37 | lineHeight: string; 38 | }; 39 | caption: { 40 | fontSize: string; 41 | lineHeight: string; 42 | }; 43 | body: { 44 | fontSize: string; 45 | lineHeight: string; 46 | }; 47 | lead: { 48 | fontSize: string; 49 | lineHeight: string; 50 | }; 51 | headline21: { 52 | fontSize: string; 53 | lineHeight: string; 54 | }; 55 | headline26: { 56 | fontSize: string; 57 | lineHeight: string; 58 | }; 59 | headline31: { 60 | fontSize: string; 61 | lineHeight: string; 62 | }; 63 | headline37: { 64 | fontSize: string; 65 | lineHeight: string; 66 | }; 67 | headline48: { 68 | fontSize: string; 69 | lineHeight: string; 70 | }; 71 | display: { 72 | fontSize: string; 73 | lineHeight: string; 74 | }; 75 | hero: { 76 | fontSize: string; 77 | lineHeight: string; 78 | }; 79 | uber: { 80 | fontSize: string; 81 | lineHeight: string; 82 | }; 83 | colossus: { 84 | fontSize: string; 85 | lineHeight: string; 86 | }; 87 | }; 88 | type: { 89 | regular: { 90 | fontWeight: number; 91 | fontStyle: "normal"; 92 | }; 93 | bold: { 94 | fontWeight: number; 95 | fontStyle: "normal"; 96 | }; 97 | }; 98 | }>; 99 | export declare type TypographyStyle = RecipeVariants; 100 | //# sourceMappingURL=typography.css.d.ts.map -------------------------------------------------------------------------------- /backend/static/theme/typography.css.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"typography.css.d.ts","sourceRoot":"","sources":["typography.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGlE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;EAiC/B,CAAC;AAEH,oBAAY,oBAAoB,GAAG,cAAc,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE/E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoF1B,CAAC;AAEH,oBAAY,eAAe,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC"} -------------------------------------------------------------------------------- /backend/static/theming.js: -------------------------------------------------------------------------------- 1 | import { 2 | inputFieldStyle, 3 | dividerStyle, 4 | cardStyle, 5 | buttonStyle, 6 | gridStyle, 7 | cardTitleStyle, 8 | typographyStyle, 9 | colorSprinkle, 10 | buttonLinkStyle, 11 | messageStyle, 12 | } from "./index.es.js"; 13 | 14 | const headings = document.querySelectorAll("h1"); 15 | for (const heading of headings) { 16 | heading.classList.add(...typographyStyle({ size: "headline-37" }).split(" ")); 17 | } 18 | 19 | const inputs = document.querySelectorAll('input[type="text"]'); 20 | for (const e of inputs) { 21 | e.classList.add( 22 | inputFieldStyle, 23 | ...typographyStyle({ size: "small", type: "regular" }).split(" ") 24 | ); 25 | } 26 | 27 | const textFieldLabels = document.querySelectorAll(".text-field-label"); 28 | for (const e of textFieldLabels) { 29 | e.classList.add( 30 | ...typographyStyle({ size: "small", type: "regular" }).split(" ") 31 | ); 32 | } 33 | 34 | const dividers = document.querySelectorAll("hr"); 35 | console.log(dividerStyle()); 36 | for (const e of dividers) { 37 | e.classList.add(dividerStyle()); 38 | } 39 | 40 | const cards = document.querySelectorAll(".card"); 41 | for (const e of cards) { 42 | e.classList.add(cardStyle()); 43 | } 44 | 45 | const cardTitles = document.querySelectorAll(".card-title"); 46 | for (const e of cardTitles) { 47 | e.classList.add(cardTitleStyle); 48 | } 49 | 50 | const submitBtns = document.querySelectorAll('[type="submit"]'); 51 | for (const e of submitBtns) { 52 | e.classList.add(...buttonStyle({ size: "regular" }).split(" ")); 53 | } 54 | 55 | const buttons = document.querySelectorAll('[type="button"]'); 56 | for (const e of buttons) { 57 | e.classList.add(...buttonStyle({ size: "regular" }).split(" ")); 58 | } 59 | 60 | const grid32s = document.querySelectorAll(".grid-32"); 61 | for (const e of grid32s) { 62 | e.classList.add(...gridStyle({ gap: 32 }).split(" ")); 63 | } 64 | 65 | const grid8s = document.querySelectorAll(".grid-8"); 66 | for (const e of grid8s) { 67 | e.classList.add(...gridStyle({ gap: 8 }).split(" ")); 68 | } 69 | 70 | const typographyAlternatives = document.querySelectorAll( 71 | ".typography-alternative" 72 | ); 73 | for (const e of typographyAlternatives) { 74 | e.classList.add( 75 | ...typographyStyle({ size: "caption", type: "regular" }).split(" "), 76 | ...colorSprinkle({ color: "foregroundMuted" }).split(" ") 77 | ); 78 | } 79 | 80 | const buttonLinks = document.querySelectorAll(".button-link"); 81 | for (const e of buttonLinks) { 82 | e.classList.add(...buttonLinkStyle().split(" ")); 83 | } 84 | 85 | const errorMessages = document.querySelectorAll(".error-message"); 86 | for (const e of errorMessages) { 87 | e.classList.add(...messageStyle({ severity: "error" }).split(" ")); 88 | } 89 | -------------------------------------------------------------------------------- /backend/static/utils.d.ts: -------------------------------------------------------------------------------- 1 | export declare const pxToRem: (...px: number[]) => string; 2 | export declare const pxToEm: (...px: number[]) => string; 3 | //# sourceMappingURL=utils.d.ts.map -------------------------------------------------------------------------------- /backend/static/utils.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAW,MAAM,EAAE,WACE,CAAC;AAE1C,eAAO,MAAM,MAAM,UAAW,MAAM,EAAE,WACE,CAAC"} -------------------------------------------------------------------------------- /backend/static/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /backend/static/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/backend/static/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /backend/static/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/backend/static/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /backend/static/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/backend/static/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /backend/static/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ory/defcon-30-ctf/1199a6940fa614774de8f0084229708308f8fd34/backend/static/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /backend/ui/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Error 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |

An Error Occurred

22 |
{{ .Error }}
23 |
24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /backend/ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Election Counter 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

Welcome to Election Counter, {{ .Username }} ({{ .IdentityID }})

19 |

Current Result:

20 |
{{ .Results }}
21 | 22 |
23 |
24 |

Submit your result

25 | 26 |
27 | 28 |
29 |
30 | 34 | 38 | 42 | 46 | 47 |
48 |
49 |
50 | 51 |
52 |
53 |

54 | Grant permissions to other users. You can only grant the permissions 55 | you also have. 56 | BE CAREFUL WHO YOU GIVE THOSE PERMISSIONS. Only people you 57 | know and people who really need them. We will establish a process 58 | for this once the testing period is over. 59 |

60 | 61 |
62 | 63 |
64 |
65 | 71 | 75 | 79 | 83 | 84 |
85 |
86 |
87 |
88 | 89 |
90 |
91 |

92 | Got a flag? Submit it here to get Ory swag! 93 |

94 | 95 |
96 | 97 |
98 |
99 | 103 | 109 | 110 |
111 |
112 |
113 |
114 |
115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /backend/ui/leaderboard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CTF Leaderboard 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

CTF Leaderboard

19 | 20 |

Total: {{ .Total }}

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | {{ range .Submissions }} 30 | 31 | 32 | 33 | 34 | {{ end }} 35 |
User IDSubmission Time
{{ .User }}{{ .When }}
36 | 37 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /backend/ui/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Login to Election Counter 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |

Login to Election Counter

22 |
{{ .Messages }}
23 |
24 | 25 | 26 | 27 |
28 | 38 | {{ if .WebAuthNCallback }} 39 | 45 | {{ else }} 46 | 47 | {{ end }} 48 |
49 |
50 | 51 |

52 | Don't have an account yet? Please 53 | register 54 |

55 |
56 |
57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /backend/ui/register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Register to Election Counter 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |

Register to Election Counter

22 | 23 |
{{ .Messages }}
24 | 25 |
26 | 27 | 28 | 29 | 30 |
31 | 35 | 39 | 45 |
46 |
47 |
48 |

49 | Already have an account? Please 50 | login 51 |

52 |
53 |
54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /configs/identity.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "type": "object", 4 | "properties": { 5 | "traits": { 6 | "properties": { 7 | "email": { 8 | "type": "string", 9 | "format": "email", 10 | "title": "Email", 11 | "ory.sh/kratos": { 12 | "credentials": { 13 | "webauthn": { 14 | "identifier": true 15 | } 16 | } 17 | } 18 | }, 19 | "name": { 20 | "type": "string", 21 | "title": "Name" 22 | } 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /configs/keto.yml: -------------------------------------------------------------------------------- 1 | dsn: "" 2 | 3 | namespaces: 4 | - name: districts 5 | id: 0 6 | - name: flags 7 | id: 1 8 | -------------------------------------------------------------------------------- /configs/keto_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eux 3 | 4 | # migrate the database 5 | keto migrate up -y -c /home/ory/keto.yml 6 | # start the server 7 | keto serve -c /home/ory/keto.yml --sqa-opt-out & 8 | 9 | # TODO remove testdata before deployment 10 | keto status -b 11 | echo '{"namespace": "districts", "object": "Testing", "relation": "submit", "subject_id": "8de7540d-b5d2-4dc2-bac0-34e9048a4d63"}' | keto relation-tuple create - 12 | echo '{"namespace": "flags", "object": "new_flag", "relation": "create", "subject_id": "8de7540d-b5d2-4dc2-bac0-34e9048a4d63"}' | keto relation-tuple create - 13 | 14 | wait 15 | -------------------------------------------------------------------------------- /configs/kratos.yml: -------------------------------------------------------------------------------- 1 | version: v0.10.1 2 | 3 | dsn: "" 4 | 5 | serve: 6 | public: 7 | base_url: 'http://localhost:5050' 8 | 9 | selfservice: 10 | default_browser_return_url: '/' 11 | flows: 12 | error: 13 | ui_url: http://localhost:5050/error 14 | login: 15 | ui_url: http://localhost:5050/login 16 | registration: 17 | ui_url: http://localhost:5050/register 18 | after: 19 | webauthn: 20 | hooks: 21 | - hook: session 22 | methods: 23 | password: 24 | enabled: false 25 | webauthn: 26 | enabled: true 27 | config: 28 | passwordless: true 29 | rp: 30 | display_name: Ory DEF CON CTF 31 | id: localhost 32 | origin: http://localhost:5050 33 | 34 | courier: 35 | smtp: 36 | connection_uri: 'smtp://localhost:25' 37 | 38 | identity: 39 | default_schema_id: default 40 | schemas: 41 | - id: default 42 | url: file:///home/ory/identity.schema.json 43 | -------------------------------------------------------------------------------- /configs/oathkeeper.yml: -------------------------------------------------------------------------------- 1 | log: 2 | level: debug 3 | 4 | authenticators: 5 | noop: 6 | enabled: true 7 | cookie_session: 8 | enabled: true 9 | config: 10 | # TODO cluster-internal mTLS 11 | check_session_url: http://kratos:4433/sessions/whoami 12 | preserve_path: true 13 | subject_from: identity.id 14 | extra_from: identity.traits 15 | 16 | authorizers: 17 | allow: 18 | enabled: true 19 | 20 | mutators: 21 | noop: 22 | enabled: true 23 | header: 24 | enabled: true 25 | config: 26 | headers: 27 | X-User: "{{ print .Subject }}" 28 | X-Username: "{{ print .Extra.name }}" 29 | X-Useremail: "{{ print .Extra.email }}" 30 | 31 | errors: 32 | handlers: 33 | redirect: 34 | enabled: true 35 | config: 36 | to: /login 37 | 38 | serve: 39 | proxy: 40 | cors: 41 | enabled: true 42 | allowed_origins: 43 | - http://localhost:5050 44 | - https://defcon-ory-challenge.com 45 | allowed_methods: 46 | - GET 47 | - POST 48 | allowed_headers: 49 | - Cookie 50 | - Content-Type 51 | exposed_headers: 52 | - Content-Type 53 | - Link 54 | allow_credentials: true 55 | max_age: 3600 56 | 57 | access_rules: 58 | repositories: 59 | - file:///home/ory/configs/oathkeeper_rules.json 60 | matching_strategy: regexp 61 | -------------------------------------------------------------------------------- /configs/oathkeeper_rules.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "public-backend", 4 | "upstream": { 5 | "url": "http://backend:8000" 6 | }, 7 | "match": { 8 | "url": "<(http|https)>://<[a-zA-Z0-9-.:]+>/", 9 | "methods": [ 10 | "GET", 11 | "POST" 12 | ] 13 | }, 14 | "authenticators": [ 15 | { 16 | "handler": "noop" 17 | } 18 | ], 19 | "authorizer": { 20 | "handler": "allow" 21 | }, 22 | "mutators": [ 23 | { 24 | "handler": "noop" 25 | } 26 | ] 27 | }, 28 | { 29 | "id": "public-kratos", 30 | "upstream": { 31 | "url": "http://kratos:4433" 32 | }, 33 | "match": { 34 | "url": "<(http|https)>://<[a-zA-Z0-9-.:]+>/<(self-service/.*)|sessions/whoami|(.well-known/.*)>", 35 | "methods": [ 36 | "GET", 37 | "POST" 38 | ] 39 | }, 40 | "authenticators": [ 41 | { 42 | "handler": "noop" 43 | } 44 | ], 45 | "authorizer": { 46 | "handler": "allow" 47 | }, 48 | "mutators": [ 49 | { 50 | "handler": "noop" 51 | } 52 | ] 53 | }, 54 | { 55 | "id": "auth-only", 56 | "upstream": { 57 | "url": "http://backend:8000" 58 | }, 59 | "match": { 60 | "url": "<(http|https)>://<[a-zA-Z0-9-.:]+><|/|/results|/grant-access|/flag>", 61 | "methods": [ 62 | "GET", 63 | "POST" 64 | ] 65 | }, 66 | "authenticators": [ 67 | { 68 | "handler": "cookie_session" 69 | } 70 | ], 71 | "authorizer": { 72 | "handler": "allow" 73 | }, 74 | "mutators": [ 75 | { 76 | "handler": "header" 77 | } 78 | ], 79 | "errors": [ 80 | { 81 | "handler": "redirect" 82 | } 83 | ] 84 | } 85 | ] -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | 3 | services: 4 | keto: 5 | image: oryd/keto:v0.9.0-alpha.0 6 | entrypoint: sh -c 7 | command: '/home/ory/keto_entrypoint.sh' 8 | restart: on-failure 9 | links: 10 | - pg:pg 11 | environment: 12 | DSN: postgres://dbuser:secret@pg:5432/default?sslmode=disable 13 | volumes: 14 | - type: bind 15 | source: configs 16 | target: /home/ory 17 | 18 | kratos: 19 | image: oryd/kratos:v0.10.1 20 | entrypoint: sh -c 21 | command: '"kratos migrate sql up -y -e && kratos serve -c /home/ory/kratos.yml --sqa-opt-out"' 22 | restart: on-failure 23 | links: 24 | - pg:pg 25 | environment: 26 | DSN: postgres://dbuser:secret@pg:5432/default?sslmode=disable 27 | volumes: 28 | - type: bind 29 | source: configs 30 | target: /home/ory 31 | 32 | oathkeeper: 33 | image: oryd/oathkeeper:v0.39.0 34 | command: serve -c /home/ory/configs/oathkeeper.yml 35 | restart: on-failure 36 | links: 37 | - kratos:kratos 38 | - backend:backend 39 | ports: 40 | - "5050:4455" 41 | volumes: 42 | - type: bind 43 | source: configs 44 | target: /home/ory/configs 45 | 46 | pg: 47 | image: postgres:14 48 | expose: 49 | - "5432" 50 | environment: 51 | - POSTGRES_USER=dbuser 52 | - POSTGRES_PASSWORD=secret 53 | - POSTGRES_DB=default 54 | 55 | backend: 56 | build: ./backend 57 | restart: on-failure 58 | links: 59 | - pg:pg 60 | - keto:keto 61 | environment: 62 | DSN: pgx://postgres://dbuser:secret@pg:5432/default?sslmode=disable 63 | --------------------------------------------------------------------------------