Skip to content

Commit 580483a

Browse files
ci: update actions, add back audit
Signed-off-by: Henry <mail@henrygressmann.de>
1 parent ae0ed96 commit 580483a

13 files changed

Lines changed: 80 additions & 59 deletions

File tree

‎.github/SECURITY.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
If you think you've found a security vulnerability in our project, please report it to us immediately.
2+
3+
For anything that can be used to attack public instances of Liwan (or if you deem it to be a critical security issue), please email us at security@liwan.dev

‎.github/workflows/audit.yaml‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Audit dependencies
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/audit.yaml"
7+
- "Cargo.toml"
8+
- "Cargo.lock"
9+
- "web/package.json"
10+
- "web/bun.lock"
11+
push:
12+
branches: [main]
13+
paths:
14+
- ".github/workflows/audit.yaml"
15+
- "Cargo.toml"
16+
- "Cargo.lock"
17+
- "web/package.json"
18+
- "web/bun.lock"
19+
schedule:
20+
# Every Monday at 12:30 UTC
21+
- cron: "30 12 * * 1"
22+
workflow_dispatch:
23+
24+
permissions:
25+
contents: read
26+
27+
jobs:
28+
scan-pr:
29+
if: github.event_name == 'pull_request'
30+
permissions:
31+
actions: read
32+
contents: read
33+
security-events: write
34+
uses: google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@6e4298ebc4db23e847df9b2e2de2939d6f066c67 # v2.5.1
35+
with:
36+
runs-on: ubuntu-24.04
37+
upload-sarif: false
38+
scan-args: |-
39+
--lockfile=./Cargo.lock
40+
--lockfile=./web/bun.lock
41+
42+
scan:
43+
if: github.event_name != 'pull_request'
44+
permissions:
45+
actions: read
46+
contents: read
47+
security-events: write
48+
uses: google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@6e4298ebc4db23e847df9b2e2de2939d6f066c67 # v2.5.1
49+
with:
50+
runs-on: ubuntu-24.04
51+
fail-on-vuln: false
52+
scan-args: |-
53+
--lockfile=./Cargo.lock
54+
--lockfile=./web/bun.lock

‎.github/workflows/audit.yaml.disable‎

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎.github/workflows/container.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ jobs:
5656
mkdir -p dist/amd64 dist/arm64 dist/data
5757
5858
# sanitize tag: only keep alphanum, dot, underscore, dash
59-
SAFE_TAG=$(echo "$INPUT_TAG" | sed 's/[^A-Za-z0-9._-]/_/g')
59+
SAFE_TAG="${INPUT_TAG//[^A-Za-z0-9._-]/_}"
6060
61-
curl -fsSL https://github.com/explodingcamera/liwan/releases/download/$SAFE_TAG/liwan-x86_64-unknown-linux-musl.tar.gz \
61+
curl -fsSL "https://github.com/explodingcamera/liwan/releases/download/$SAFE_TAG/liwan-x86_64-unknown-linux-musl.tar.gz" \
6262
| tar -xz -C dist/amd64 &
6363
64-
curl -fsSL https://github.com/explodingcamera/liwan/releases/download/$SAFE_TAG/liwan-aarch64-unknown-linux-musl.tar.gz \
64+
curl -fsSL "https://github.com/explodingcamera/liwan/releases/download/$SAFE_TAG/liwan-aarch64-unknown-linux-musl.tar.gz" \
6565
| tar -xz -C dist/arm64 &
6666
6767
wait

‎.github/workflows/release.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
with:
7272
name: web-dist
7373
path: ./web/dist
74-
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
74+
- uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
7575
with:
7676
cache: false
7777
- uses: taiki-e/upload-rust-binary-action@f0d45ae91ee7b8ee928de7a9d04d893a08bcbec6 # v1.30.2
@@ -86,6 +86,6 @@ jobs:
8686
packages: write
8787
contents: read
8888
needs: [create-release, upload-assets]
89-
uses: explodingcamera/liwan/.github/workflows/container.yaml@main
89+
uses: $/.github/workflows/container.yaml
9090
with:
9191
tag: ${{ github.ref_name }}

‎.github/workflows/test.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2727
with:
2828
persist-credentials: false
29-
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
29+
- uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
3030
with:
3131
components: clippy, rustfmt
3232
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2

‎Cargo.lock‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ tokio-util = { version = "0.7", features = ["io"] }
2929
# encoding
3030
hex = { version = "0.4" }
3131
md-5 = { version = "0.11.0" }
32-
password-hash = { version = "0.6.1", features = [
33-
"getrandom",
34-
"rand_core",
35-
] } # required for getrandom feature
3632
serde = { version = "1.0", features = ["derive"] }
3733
serde_json = { version = "1.0" }
3834
tokio-tar = { package = "astral-tokio-tar", version = "0.7" }

‎audit.toml‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎src/utils/hash.rs‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,21 @@ pub fn session_token() -> String {
7272
Alphanumeric.sample_string(&mut rand::rng(), 32)
7373
}
7474

75+
/// Compare onboarding tokens without short-circuiting on their contents.
76+
pub(crate) fn onboarding_token_matches(expected: &str, candidate: &str) -> bool {
77+
if expected.len() != candidate.len() {
78+
return false;
79+
}
80+
81+
let mut difference = 0u8;
82+
for (expected, candidate) in expected.bytes().zip(candidate.bytes()) {
83+
difference = std::hint::black_box(difference | (expected ^ candidate));
84+
}
85+
std::hint::black_box(difference) == 0
86+
}
87+
7588
pub fn onboarding_token() -> String {
76-
Alphanumeric.sample_string(&mut rand::rng(), 8)
89+
Alphanumeric.sample_string(&mut rand::rng(), 16)
7790
}
7891

7992
pub fn db_name() -> String {

0 commit comments

Comments
 (0)