Repository navigation
fix: everything a full code, security, accessibility and performance audit turned up #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fe92692
fix(desk): camera, focus and input bugs found in a full review
kanywst f433353
fix(readme): parse URLs for the allow-lists, and render boards access…
kanywst 26098f8
fix(layout): keep the unfiled pile clear of the others, and test the …
kanywst 35ac2aa
perf(images): send the mascot through the image pipeline
kanywst 893600e
fix(shots): fail only when every attempted shot fails, and use the in…
kanywst 26bf614
fix(a11y): name blank table headers for screen readers
kanywst 83b3bb6
fix(security): sandbox the live frame and tighten the CSP
kanywst 748ff0f
fix(sync): keep only https links from the APIs, and decode numeric en…
kanywst 4850c69
fix(shots): validate screenshots chunk by chunk, and keep untrusted j…
kanywst b8d3efb
ci: pin the actionlint image by digest
kanywst 750bb66
fix(readme): decode references in one pass and survive invalid ones
kanywst bf2a892
fix(sync): an unreadable board image no longer fails the games sync
kanywst 86689ad
fix(desk): close an open site by pressing the desk around it
kanywst 87c8806
fix(sync): fall back to the sizes the previous games.json knew
kanywst ee0014e
test(e2e): the HUD can't take focus while a site is open either
kanywst f7673e5
fix(desk): make the HUD inert while a site is open
kanywst a051ddb
fix(css): keep images in proportion when they shrink
kanywst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,19 @@ | ||
| name: Set up | ||
| description: pnpm, Node 24 and the locked dependencies, shared by every CI job. | ||
|
|
||
| inputs: | ||
| cache: | ||
| description: Use the shared pnpm store cache. Jobs that run untrusted code turn it off so they can't seed it. | ||
| default: "true" | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 | ||
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | ||
| with: | ||
| node-version: 24 | ||
| cache: pnpm | ||
| cache: ${{ inputs.cache == 'true' && 'pnpm' || '' }} | ||
| package-manager-cache: ${{ inputs.cache == 'true' }} | ||
| - run: pnpm install --frozen-lockfile | ||
| shell: bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| """Refuse anything but a well-formed PNG of sane size. | ||
|
|
||
| The shots workflow's propose job runs this over screenshots that came from a job which | ||
| ran third-party code, before they are committed and later decoded by the build. Only | ||
| the standard library, so the privileged job still installs nothing. | ||
| """ | ||
|
|
||
| import struct | ||
| import sys | ||
| import zlib | ||
|
|
||
| MAX_BYTES = 5 * 1024 * 1024 | ||
| MAX_SIDE = 4096 | ||
| SIGNATURE = b"\x89PNG\r\n\x1a\n" | ||
|
|
||
|
|
||
| def check(path: str) -> str | None: | ||
| data = open(path, "rb").read() | ||
| if len(data) > MAX_BYTES: | ||
| return f"larger than {MAX_BYTES} bytes" | ||
| if not data.startswith(SIGNATURE): | ||
| return "no PNG signature" | ||
| pos, chunks = len(SIGNATURE), [] | ||
| while pos < len(data): | ||
| if pos + 12 > len(data): | ||
| return "truncated chunk" | ||
| length, kind = struct.unpack(">I4s", data[pos : pos + 8]) | ||
| body = data[pos + 8 : pos + 8 + length] | ||
| if len(body) != length or pos + 12 + length > len(data): | ||
| return f"chunk {kind!r} runs past the end" | ||
| (crc,) = struct.unpack(">I", data[pos + 8 + length : pos + 12 + length]) | ||
| if zlib.crc32(kind + body) != crc: | ||
| return f"bad CRC in {kind!r}" | ||
| chunks.append((kind, body)) | ||
| pos += 12 + length | ||
| if kind == b"IEND": | ||
| break | ||
| if pos != len(data): | ||
| return "data after IEND" | ||
| if not chunks or chunks[0][0] != b"IHDR" or chunks[-1][0] != b"IEND": | ||
| return "IHDR must come first and IEND last" | ||
| width, height = struct.unpack(">II", chunks[0][1][:8]) | ||
| if not (0 < width <= MAX_SIDE and 0 < height <= MAX_SIDE): | ||
| return f"{width}x{height} is out of range" | ||
| return None | ||
|
|
||
|
|
||
| failed = False | ||
| for path in sys.argv[1:]: | ||
| problem = check(path) | ||
| if problem: | ||
| failed = True | ||
| print(f"::error file={path}::{problem}") | ||
| sys.exit(1 if failed else 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.