glasp v0.5.3 Released: config init / Safer File Sync / Signature Verification on Install

glasp v0.5.3 Released: config init / Safer File Sync / Signature Verification on Install

glasp v0.5.3

glasp v0.5.3 is out.

github.com

This post covers the changes from v0.5.0 through v0.5.3, picking up where the v0.4.0 post left off.

What's new

Install with Homebrew (v0.5.0)

glasp can now be installed with Homebrew (macOS / Linux).

brew tap takihito/tap brew trust --formula takihito/tap/glasp brew install glasp 

takihito/tap is a non-official tap, so brew trust is required.

Logging moved to log/slog (v0.5.0)

Diagnostic logs now use Go's standard log/slog, and you can choose the log level and output format.

  • --log-level / GLASP_LOG_LEVEL: debug, info (default), warn, error
  • --log-format / GLASP_LOG_FORMAT: text (default), json
# Show OAuth flow progress and other details glasp login --log-level debug # Output logs as JSON (handy in CI) GLASP_LOG_FORMAT=json glasp push # Show errors only glasp pull --log-level error 

Command output, such as push results and login guidance, is not affected by the log level.

Support for clasp v2 .clasp.json (v0.5.0)

clasp v2 writes parentId in .clasp.json as an array ("parentId": ["..."]). Reading this format used to cause an error; that's now fixed. The clasp v3 string format still works as before.

config init can now create .clasp.json (v0.5.2)

glasp config init now creates .clasp.json in addition to .glasp/config.json. You can start a project with glasp alone, without clasp.

mkdir project-gas cd project-gas # Create .clasp.json (with the script ID and rootDir) glasp config init --script-id=SCRIPT_ID --rootDir=src glasp login glasp pull 

If .clasp.json already exists, it returns an error instead of overwriting it. The README Quick Start has also been rewritten around this flow (v0.5.3).

Safer file sync (v0.5.2)

I reworked how push / pull handle local files.

  • Path traversal protection: if rootDir in .clasp.json points outside the project (e.g. it contains ../), glasp returns an error.
  • Symlinks: symlinked files are now skipped by default. You can follow them with --allow-symlinks (GLASP_ALLOW_SYMLINKS), but links whose target is outside rootDir are rejected. Symlinked directories are never followed.
  • Showing skipped files: files skipped because of .claspignore, .d.ts, or symlinks are reported on push / convert in a single line, like Skipped 2 file(s): 1 ignored, 1 symlink. Per-file details are available with --log-level debug.
  • Atomic writes: pull and archive writes now go to a temp file first and are then renamed. If the process is interrupted, no corrupted files are left behind.
  • Auth file permission warning: if the token cache file has permissions looser than 0600, glasp prints a warning.
  • create --type webapp / api fix: fixed a bug where these could not be created without --parentId.

Release signature verification on install (v0.5.3)

Until now, the install script downloaded the binary and checksums.txt over the same path and compared them. That meant if someone replaced both in transit, the tampering would go unnoticed.

Releases are signed with cosign (keyless signing) on checksums.txt. Starting with v0.5.3, the installer verifies this signature at install time.

curl -fsSL https://takihito.github.io/glasp/install.sh | sh 

If cosign is installed, the signature is verified automatically. You can change the behavior with GLASP_VERIFY_SIGNATURE:

  • auto (default): if cosign is not found, print a warning and continue the installation.
  • required: if cosign is not found, fail with an error.
# Require signature verification curl -fsSL https://takihito.github.io/glasp/install.sh | GLASP_VERIFY_SIGNATURE=required sh 

The GitHub Action (takihito/glasp) always verifies the signature. If you use harden-runner in block mode, allow tuf-repo-cdn.sigstore.dev:443 and release-assets.githubusercontent.com:443.

Steps for verifying manually are in Verifying downloads.

Bugs and requests

Please send bug reports and feature requests via social media or GitHub Issues.

github.com