Compare commits

..

1 Commits

Author SHA1 Message Date
Chris F Ravenscroft 5022137989 ci: add actions/stale workflow
Marks issues and pull requests stale after 60 days of inactivity and
closes them 14 days later. Any comment clears the stale label and
restarts the clock, so active discussions are never swept up.

Exempts pinned, security, blocked, help wanted and good first issue, and
anything assigned to a milestone. Runs oldest-first so the real backlog
is handled before recent items.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014L5EoqGWsuZWr8fCVM6izP
2026-09-13 16:18:12 -07:00
8 changed files with 25 additions and 79 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
- name: Install CLI Dependencies
run: sudo apt-get install -y ldap-utils oathtool libpam0g-dev
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@v4
- name: Fetch Go dependencies
working-directory: ./v2
run: go get -t -v ./...
+1 -1
View File
@@ -24,7 +24,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v7
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
+1 -1
View File
@@ -1,3 +1,3 @@
{
"v2": "2.5.5"
"v2": "2.5.4"
}
-7
View File
@@ -1,12 +1,5 @@
# Changelog
## [2.5.5](https://github.com/glauth/glauth/compare/GLAuth-v2.5.4...GLAuth-v2.5.5) (2026-09-27)
### Bug Fixes
* route library log output through the logger ([#491](https://github.com/glauth/glauth/issues/491)) ([156e917](https://github.com/glauth/glauth/commit/156e9176977810140fbf60c4fea30a3480abf828))
## [2.5.4](https://github.com/glauth/glauth/compare/GLAuth-v2.5.3...GLAuth-v2.5.4) (2026-09-13)
+1 -1
View File
@@ -2,4 +2,4 @@ package version
// Version is the tag of the latest release, it gets changed by the ci
// process when a release is happening
const Version = "v2.5.5" // x-release-please-version
const Version = "v2.5.4" // x-release-please-version
+12 -6
View File
@@ -44,11 +44,12 @@ func InitLogging(reqdebug bool, reqsyslog bool, reqstructlog bool) zerolog.Logge
var logr zerolog.Logger
if reqsyslog {
s, err := syslog.New(syslog.LOG_INFO, "glauth")
if err == nil {
logr = zerolog.New(zerolog.SyslogLevelWriter(s)).Level(level).With().Timestamp().Logger()
} else {
if err != nil {
fmt.Println("Unable to write to syslog: ignoring...")
reqsyslog = false
} else {
writers := zerolog.MultiLevelWriter(mainWriter, zerolog.SyslogLevelWriter(s))
logr = zerolog.New(writers).Level(level).With().Timestamp().Logger()
}
}
@@ -56,13 +57,14 @@ func InitLogging(reqdebug bool, reqsyslog bool, reqstructlog bool) zerolog.Logge
logr = zerolog.New(mainWriter).Level(level).With().Timestamp().Logger()
}
log.SetOutput(customWriter{logr: logr})
log.SetOutput(customWriter{logr: logr, structlog: reqstructlog})
return logr
}
type customWriter struct {
logr zerolog.Logger
logr zerolog.Logger
structlog bool
}
func (e customWriter) Write(p []byte) (int, error) {
@@ -74,6 +76,10 @@ func (e customWriter) Write(p []byte) (int, error) {
if msg == "" {
msg = strings.TrimSpace(string(p))
}
e.logr.Info().Msg(msg)
if e.structlog {
fmt.Fprintf(os.Stderr, "{\"level\":\"info\",\"time\":\"%s\",\"message\":\"%s\"}\n", time.Now().Format(time.RFC1123Z), strings.Replace(strings.TrimSpace(msg), `"`, `\"`, -1))
} else {
e.logr.Info().Msg(msg)
}
return len(p), nil
}
-59
View File
@@ -1,59 +0,0 @@
package logging
import (
"bytes"
"encoding/json"
"strings"
"testing"
"github.com/rs/zerolog"
)
// customWriter adapts log output from libraries that emit unstructured text.
// Everything it receives must go through the logger, so that it lands wherever
// the logger points - notably syslog only, when syslog is enabled.
func TestCustomWriterEmitsValidJSONThroughTheLogger(t *testing.T) {
for _, tc := range []struct {
name string
in string
want string
}{
{"plain", "something happened", "something happened"},
{"quotes", `bind for "cn=foo"`, `bind for "cn=foo"`},
{"backslashes", `path C:\Users\x`, `path C:\Users\x`},
{"control characters", "tab\there\nand a newline", "tab\there\nand a newline"},
{
"library timestamp prefix is stripped",
"2026/09/13 16:50:54 connection closed",
"connection closed",
},
} {
t.Run(tc.name, func(t *testing.T) {
var buf bytes.Buffer
w := customWriter{logr: zerolog.New(&buf).With().Timestamp().Logger()}
if _, err := w.Write([]byte(tc.in)); err != nil {
t.Fatalf("Write: %v", err)
}
// One record, one line: an unescaped newline would split this.
if got := strings.Count(strings.TrimRight(buf.String(), "\n"), "\n"); got != 0 {
t.Fatalf("expected a single log line, got %d extra newlines in %q", got, buf.String())
}
var record struct {
Level string `json:"level"`
Message string `json:"message"`
}
if err := json.Unmarshal(buf.Bytes(), &record); err != nil {
t.Fatalf("emitted invalid JSON (%v): %s", err, buf.String())
}
if record.Message != tc.want {
t.Errorf("message = %q, want %q", record.Message, tc.want)
}
if record.Level != "info" {
t.Errorf("level = %q, want %q", record.Level, "info")
}
})
}
}
+9 -3
View File
@@ -4,6 +4,7 @@
package logging
import (
"fmt"
"io"
"log"
"os"
@@ -41,13 +42,14 @@ func InitLogging(reqdebug bool, reqsyslog bool, reqstructlog bool) zerolog.Logge
logr := zerolog.New(mainWriter).Level(level).With().Timestamp().Logger()
log.SetOutput(customWriter{logr: logr})
log.SetOutput(customWriter{logr: logr, structlog: reqstructlog})
return logr
}
type customWriter struct {
logr zerolog.Logger
logr zerolog.Logger
structlog bool
}
func (e customWriter) Write(p []byte) (int, error) {
@@ -59,6 +61,10 @@ func (e customWriter) Write(p []byte) (int, error) {
if msg == "" {
msg = strings.TrimSpace(string(p))
}
e.logr.Info().Msg(msg)
if e.structlog {
fmt.Fprintf(os.Stderr, "{\"level\":\"info\",\"time\":\"%s\",\"message\":\"%s\"}\n", time.Now().Format(time.RFC1123Z), strings.Replace(strings.TrimSpace(msg), `"`, `\"`, -1))
} else {
e.logr.Info().Msg(msg)
}
return len(p), nil
}