Skip to content

ci(github): add ci workflows#40

Merged
adcondev merged 10 commits intomasterfrom
feat/login
Feb 19, 2026
Merged

ci(github): add ci workflows#40
adcondev merged 10 commits intomasterfrom
feat/login

Conversation

@adcondev
Copy link
Owner

This pull request introduces a comprehensive security model for the Scale Daemon's dashboard and WebSocket configuration, updates CI/CD workflows for improved dependency handling and build checks, and enhances developer experience with new templates and documentation. The most important changes are grouped below by theme:

Security Model & WebSocket Authorization:

  • Added a layered security model for dashboard and WebSocket configuration, including session-based dashboard access, per-message config token for WebSocket config changes, rate limiting, brute force protection, and audit logging. Detailed documentation is now present in README.md.
  • The WebSocket config schema (scale_websocket.schema.json) now requires an authToken for config changes and defines error responses for invalid tokens and rate limiting. [1] [2]
  • The dashboard HTML template (index.html) injects the WebSocket auth token as a meta tag for use by authenticated sessions.
  • The dashboard JavaScript (websocket.js) now includes the auth token in config messages and handles new error responses from the server, displaying user-friendly error messages. [1] [2]

Authentication UI:

  • Introduced a new login page (login.html) with error and lockout feedback, supporting the new authentication flow.

CI/CD Workflow Improvements:

  • CI workflows now check out the poster library as a local dependency, patch go.mod to use the local version, and handle cleaning and building accordingly. A new build job is added to produce and summarize Windows binaries. [1] [2] [3] [4]
  • The CI is optimized to ignore documentation changes and cancel in-progress runs for the same branch.
  • CodeQL static analysis is now configured via a new .github/codeql-config.yml file and referenced in the workflow. [1] [2] [3]

Developer Experience:

  • Added a new pull request template to standardize PR descriptions, testing, and checklists.
  • Improved the PR automation workflow to avoid commenting on PRs opened by the repository owner.

Miscellaneous:

  • Updated Go module dependencies, including bumping golang.org/x/sys and adding golang.org/x/crypto.
  • Minor schema and example updates in scale_websocket.schema.json and legacy HTML docs. [1] [2]

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
… descriptions

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
…rove configuration handling

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
…et auth token key

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
…checks, and improved triggers

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
@adcondev adcondev self-assigned this Feb 19, 2026
@adcondev adcondev added the enhancement New feature or request label Feb 19, 2026
…onventions

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
@github-actions
Copy link

github-actions bot commented Feb 19, 2026

⚡ Benchmark Results

⚠️ No benchmarks found in the current codebase.

To add benchmarks, create functions starting with Benchmark in *_test.go files.

Comment on lines +158 to +165
http.SetCookie(w, &http.Cookie{
Name: SessionCookieName,
Value: token,
Path: "/",
MaxAge: int(SessionDuration.Seconds()),
HttpOnly: true,
SameSite: http.SameSiteStrictMode,
})

Check warning

Code scanning / CodeQL

Cookie 'Secure' attribute is not set to true Medium

Cookie does not set Secure attribute to true.

Copilot Autofix

AI 6 days ago

To fix the problem in general, the session cookie must be created with the Secure field set to true, ensuring the browser only sends it over HTTPS. Any related cookie operations (such as clearing the cookie) should use the same security attributes to avoid inconsistent behavior.

The best fix here, without changing existing functionality, is:

  • In SetSessionCookie, add Secure: true, to the http.Cookie literal so the session cookie is HTTPS‑only.
  • In ClearSessionCookie, also add Secure: true, so the deletion cookie matches the original cookie’s attributes (name, path, Secure, SameSite, HttpOnly, etc.), ensuring browsers properly remove it.

No new imports or helper methods are needed. All changes are within internal/auth/auth.go, in the SetSessionCookie and ClearSessionCookie functions around lines 155–179.

Suggested changeset 1
internal/auth/auth.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/internal/auth/auth.go b/internal/auth/auth.go
--- a/internal/auth/auth.go
+++ b/internal/auth/auth.go
@@ -162,6 +162,7 @@
 		MaxAge:   int(SessionDuration.Seconds()),
 		HttpOnly: true,
 		SameSite: http.SameSiteStrictMode,
+		Secure:   true,
 	})
 	return token
 }
@@ -175,6 +176,7 @@
 		MaxAge:   -1,
 		HttpOnly: true,
 		SameSite: http.SameSiteStrictMode,
+		Secure:   true,
 	})
 }
 
EOF
@@ -162,6 +162,7 @@
MaxAge: int(SessionDuration.Seconds()),
HttpOnly: true,
SameSite: http.SameSiteStrictMode,
Secure: true,
})
return token
}
@@ -175,6 +176,7 @@
MaxAge: -1,
HttpOnly: true,
SameSite: http.SameSiteStrictMode,
Secure: true,
})
}

Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +171 to +178
http.SetCookie(w, &http.Cookie{
Name: SessionCookieName,
Value: "",
Path: "/",
MaxAge: -1,
HttpOnly: true,
SameSite: http.SameSiteStrictMode,
})

Check warning

Code scanning / CodeQL

Cookie 'Secure' attribute is not set to true Medium

Cookie does not set Secure attribute to true.

Copilot Autofix

AI 6 days ago

In general, the fix is to explicitly set the Secure attribute to true on all session cookies so they are only transmitted over HTTPS. This should be done both when creating the session cookie and when clearing it (the deletion cookie should match the original attributes, including Secure, so that it correctly overwrites the existing cookie in browsers).

Concretely, in internal/auth/auth.go:

  • In SetSessionCookie, update the http.Cookie literal passed to http.SetCookie to include Secure: true, alongside HttpOnly and SameSite.
  • In ClearSessionCookie, also update the http.Cookie literal to include Secure: true, so the clearing cookie has the same security attributes as the one that was set.

No new methods or imports are required; Secure is an existing field on http.Cookie from the standard library.

Suggested changeset 1
internal/auth/auth.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/internal/auth/auth.go b/internal/auth/auth.go
--- a/internal/auth/auth.go
+++ b/internal/auth/auth.go
@@ -161,6 +161,7 @@
 		Path:     "/",
 		MaxAge:   int(SessionDuration.Seconds()),
 		HttpOnly: true,
+		Secure:   true,
 		SameSite: http.SameSiteStrictMode,
 	})
 	return token
@@ -174,6 +175,7 @@
 		Path:     "/",
 		MaxAge:   -1,
 		HttpOnly: true,
+		Secure:   true,
 		SameSite: http.SameSiteStrictMode,
 	})
 }
EOF
@@ -161,6 +161,7 @@
Path: "/",
MaxAge: int(SessionDuration.Seconds()),
HttpOnly: true,
Secure: true,
SameSite: http.SameSiteStrictMode,
})
return token
@@ -174,6 +175,7 @@
Path: "/",
MaxAge: -1,
HttpOnly: true,
Secure: true,
SameSite: http.SameSiteStrictMode,
})
}
Copilot is powered by AI and may make mistakes. Always verify output.
@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 238 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/auth/auth.go 0.00% 105 Missing ⚠️
internal/server/server.go 0.00% 100 Missing ⚠️
internal/server/rate_limit.go 0.00% 17 Missing ⚠️
internal/server/broadcaster.go 0.00% 8 Missing ⚠️
internal/daemon/daemon.go 0.00% 5 Missing ⚠️
internal/config/config.go 0.00% 2 Missing ⚠️
internal/logging/logging.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…nter warnings for sensitive logging

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
@adcondev adcondev merged commit 4c15d8f into master Feb 19, 2026
10 checks passed
@adcondev adcondev deleted the feat/login branch February 19, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size/XL

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants