Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: golang/glog
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0
Choose a base ref
...
head repository: golang/glog
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.2.4
Choose a head ref
  • 16 commits
  • 19 files changed
  • 4 contributors

Commits on Mar 3, 2023

  1. glog: update glog to the latest internal version (#59)

    This change upstreams a number of changes since the last package update.
    
    In particular this adds:
    
    - New exported APIs (see godoc for further details):
      - glog.VDepth
      - glog.InfoDepthf
      - glog.WarningDepthf
      - glog.ErrorDepthf
      - glog.FatalDepthf
      - glog.ExitDepthf
      - glog.Names
      - glog.NewStandardLogger
      - glog.Verbose.InfoDepth
      - glog.Verbose.InfoDepthf
      - glog.ErrNoLog
    
    - The -log_backtrace_at flag accepts now a comma-separated list of file:line locations.
    
    - The -vmodule flag accepts a new syntax to match the full path to a module instead of just the module name. See the updated package documentation.
    
    - A new internal/logsink package to support other outputs than files. Note: This package is internal, because we cannot guarantee at this point that the API remains stable.
    
    More details at go/log-vs-glog (google-internal).
    chressie authored Mar 3, 2023
    Configuration menu
    Copy the full SHA
    115d1f9 View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2023

  1. glog: use strings.TrimSuffix

    This was raised in #53.
    
    cl/514318873 (google-internal)
    chressie authored and stapelberg committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    2cef961 View commit details
    Browse the repository at this point in the history
  2. glog: make zero value of vModuleFlag usable

    The flag package ensures that the zero value of a flag.Value is usable. This commit fixes this.
    
    This was raised in https://groups.google.com/g/golang-nuts/c/Atlr8uAjn6U/m/iId17Td5BQAJ.
    
    cl/517349579 (google-internal)
    chressie authored and stapelberg committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    9c9801e View commit details
    Browse the repository at this point in the history
  3. glog: don't use SIGABRT on platforms that don't support signals

    cl/517387773 (google-internal)
    chressie authored and stapelberg committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    c0f9e3d View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2023

  1. Configuration menu
    Copy the full SHA
    6ce8ac9 View commit details
    Browse the repository at this point in the history
  2. glog: use os.Stderr directly for writing to stderr (#62)

    This was raised in https://groups.google.com/g/golang-nuts/c/o85vycfiGVY/m/MblpnfF6BQAJ.
    
    Before the 1.1.0 release it was possible to set os.Stderr to a different *os.File (like an os.Pipe) to capture output that is written to stderr. Restore that behavior.
    chressie authored Mar 22, 2023
    Configuration menu
    Copy the full SHA
    03ad3c2 View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2023

  1. Configuration menu
    Copy the full SHA
    6b9d7f7 View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2023

  1. Configuration menu
    Copy the full SHA
    bcf3184 View commit details
    Browse the repository at this point in the history
  2. glog: add context variants to most log functions

    We export this new API to make the internal and external versions
    identical.
    
    The context is currently plumbed through to the internal/logsink
    package, but effectively discarded there.
    
    cl/560684897 (google-internal)
    cl/579771826 (google-internal)
    chressie authored and stapelberg committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    b256bbe View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2024

  1. glog: don't hold mutex when sync'ing (#68)

    Some environments are slow when syncing and holding the lock might cause contention.
    
    cl/621846576 (google-internal)
    chressie authored Apr 4, 2024
    Configuration menu
    Copy the full SHA
    861d094 View commit details
    Browse the repository at this point in the history

Commits on Jul 9, 2024

  1. glog: avoid calling user.Current() on windows (#69)

    Use the current process token to look up the user's name on Windows.
    
    This is more reliable than using the USER or USERNAME environment variables, which are not always set, or might be overridden by the user accidentally or
    maliciously.
    
    It follows the implementation of the user.Current() implementation in the
    standard library.
    
    cl/650142356 (google-internal)
    bentekkie authored Jul 9, 2024
    Configuration menu
    Copy the full SHA
    9730314 View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2024

  1. glog: check that stderr is valid before using it by default (#72)

    Windows Services are [spawned without `stdout` and `stderr`](https://learn.microsoft.com/en-us/windows/console/getstdhandle#return-value:~:text=If%20an%20application%20does%20not%20have%20associated%20standard%20handles%2C%20such%20as%20a%20service%20running%20on%20an%20interactive%20desktop%2C%20and%20has%20not%20redirected%20them%2C%20the%20return%20value%20is%20NULL.), so any attempt to use them equates to referencing an invalid file `Handle`. `stderrSink` returns the error, which makes `logsink` trigger the termination of the process. The result is that any call to `log.Error` (or `log.Fatal`) from a Windows Service will always crash the program.
    
    This approach checks that `os.Stderr`'s embedded file descriptor (`Handle`, for Windows) is non-NULL once during `init` to determine its validity and if it fails, then never registers `stderrSink` as a logsink.
    
    Disabling based upon whether `os.Stderr` is NULL was chosen because it's precise, doesn't actually influence the result of any output and doesn't require any syscalls, but still detects the case in which `stderr` is unavailable on Windows.
    
    A rejected approach here would've been to swallow the errors from `stderrSink.Emit`, thus sparing us program termination at the hands of `logsink`. I rejected this approach because it felt like it could result in some subtle behavioral changes. For example, invoking `log.Error` after `os.Stderr.Close()` would no longer exit the program and that felt like a non-trivial change (although I can think of no reason why one would desire this behavior).
    
    cl/680817112 (google-internal)
    chressie authored Nov 4, 2024
    Configuration menu
    Copy the full SHA
    459cf3b View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2024

  1. glog: fix typo (#73)

    cl/648345242 (google-internal)
    chressie authored Nov 5, 2024
    Configuration menu
    Copy the full SHA
    04dbec0 View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2025

  1. glog: Don't try to create/rotate a given syncBuffer twice in the same…

    … second
    
    If you do, then you truncate the existing file. So logging too much too quickly would lose log data.
    
    cl/709080575 (google-internal)
    chressie authored and stapelberg committed Jan 13, 2025
    Configuration menu
    Copy the full SHA
    dd58629 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7139da2 View commit details
    Browse the repository at this point in the history
  3. glog: have createInDir fail if the file already exists

    This prevents an attack like the one described
    [here](https://owasp.org/www-community/vulnerabilities/Insecure_Temporary_File#:~:text=On%20Unix%20based,with%20elevated%20permissions.).
    An unprivileged attacker could use symlinks to trick a privileged
    logging process to follow a symlink from the log dir and write logs over
    an arbitrary file.
    
    The components of the log names are program, host, username, tag, date,
    time and PID. These are all predictable. It's not at all unusual for the
    logdir to be writable by unprivileged users, and one of the fallback
    directories (/tmp) traditionally has broad write privs with the sticky
    bit set on Unix systems.
    
    As a concrete example, let's say I've got a glog-enabled binary running
    as a root cronjob. I can gauge when that cron job will run and then use
    a bash script to spray the log dir with glog-looking symlinks to
    `/etc/shadow` with predicted times and PIDs. When the cronjob runs, the
    `os.Create` call will follow the symlink, truncate `/etc/shadow` and
    then fill it with logs.
    
    This change defeats that by setting `O_EXCL`, which will cause the open
    call to fail if the file already exists.
    
    Fixes CVE-2024-45339
    
    cl/712795111 (google-internal)
    chressie authored and stapelberg committed Jan 13, 2025
    Configuration menu
    Copy the full SHA
    a0e3c40 View commit details
    Browse the repository at this point in the history
Loading