Skip to content

docs(readme): redact signed query strings inside the logger example - #32

Merged
giovanniandreuzza merged 2 commits into
mainfrom
chore/readme-redacting-example
Oct 1, 2026
Merged

giovanniandreuzza merged 2 commits into
mainfrom
chore/readme-redacting-example

Conversation

@giovanniandreuzza

@giovanniandreuzza giovanniandreuzza commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Closes #31

Summary

The "Watch what your logger forwards" example called a member NimbusLogEvent does not have, so it did not compile when copied. It now redacts inside the logger, which is what llms.txt already tells callers to do. The library API is unchanged. This fixes main only; the v2.5.0 and v2.5.1 tags are left as they are.

 ```kotlin
-NimbusLogger { event -> Timber.tag("Nimbus").d("%s", event.redactingQueryStrings()) }
+// A URL's query, up to the next space: a signature may contain "," and ")"
+val urlQuery = Regex("""(://[^?\s]*)\?\S+""")
+NimbusLogger { event ->
+    Timber.tag("Nimbus").d("%s", event.toString().replace(urlQuery, "$1?redacted"))
+}
 ```
  • The whole event text is redacted, not only fileUrl. A URL quoted inside a NimbusError or Unexpected throwable message is caught too.
  • The match runs to the next space. A signed query can contain , and ): an Azure SAS has spr=https,http before sig=. A pattern that stopped at , would leak the signature.
  • The match is anchored on ://. A ? in plain text is left alone. An unanchored first draft rewrote StoreReset(reason=unreadable store?) into …store?redacted, and the check below caught it.
  • "%s" is kept. A percent-encoded URL is then never read as a format string.

Evidence

The repo has nothing that tests README or llms.txt snippets: no docs test, no snippet-compiling task, no README-to-llms.txt comparison. The snippets also depend on Android types such as Timber and Context. A committed snippet test would therefore need a new harness, so this change was checked by hand instead. Nothing was left in the tree.

  1. RED. A scratch test at nimbus/src/jvmTest/kotlin/scratch/ReadmeLoggerSnippetScratchTest.kt held the old README line verbatim, with a stand-in object Timber so it compiles on the JVM.
    ./gradlew :nimbus:jvmTest --tests 'scratch.*' failed at :nimbus:compileTestKotlinJvm with:
    Unresolved reference 'redactingQueryStrings'.
  2. GREEN. The scratch file was replaced with the new README lines, pasted verbatim. The only change was val logger = in front of NimbusLogger. It ran five cases, and ./gradlew :nimbus:jvmTest --tests 'scratch.*' passed with BUILD SUCCESSFUL and 5 of 5 tests, 0 failures:
    • S3 presigned: X-Amz-Signature is removed, and the output is DownloadFinished(fileUrl=https://bucket.s3.amazonaws.com/a.bin?redacted.
    • Azure SAS with spr=https,http before sig=: the signature is removed, and filePath and expectedSizeBytes survive.
    • Unexpected with the signed URL inside the throwable message: the signature is removed, and the rest of the message survives.
    • StoreReset("unreadable store?"): forwarded unchanged.
    • A %20 in the URL: forwarded unchanged.
  3. diff confirmed that the README block and the compiled block differ only by val logger =. The scratch directory was then deleted.
  4. bash .github/scripts/check-conventions.sh passed locally for the branch name, the title and the commit subject.

The full ./gradlew build was not run locally, because this change touches only README.md. CI runs it on this PR.

Merge Danger

Door: Two-way. This is one fenced code block in README.md, and a revert restores it exactly. No code, API, version or tag changes.

Blast Radius: Readers of the README on main. Nothing is compiled or published from it. The v2.5.0 and v2.5.1 tags keep the old example.

🤖 Generated with Claude Code

BEGIN_COMMIT_OVERRIDE
docs(readme): redact signed query strings inside the logger example (#32)
END_COMMIT_OVERRIDE

The "Watch what your logger forwards" example called
event.redactingQueryStrings(), which NimbusLogEvent does not have, so
the snippet did not compile when copied (#31).

The example now redacts in the logger itself, as llms.txt already
tells callers to: it takes the event's text and replaces every URL's
query with "?redacted" before handing it to Timber. Redacting the
whole text rather than fileUrl alone also covers a URL quoted inside an
error or throwable message. The match runs to the next space because a
signed query can hold "," and ")" (an Azure SAS "spr=https,http" comes
before "sig="), and it is anchored on "://" so a "?" in plain text is
left alone.

No library API is added.

Closes #31

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@giovanniandreuzza giovanniandreuzza self-assigned this Oct 1, 2026
giovanniandreuzza added a commit that referenced this pull request Oct 1, 2026
## Summary

`android-actions/setup-android@v3` installs `tools platform-tools` by
default. Google stopped serving the obsolete `tools` package around
2026-09-15
([setup-android#537](android-actions/setup-android#537)),
so `sdkmanager tools` exits 1 and fails the job. Both workflows now pass
the packages explicitly, dropping only the one that no longer exists:

```diff
 - uses: android-actions/setup-android@v3
+  with:
+    packages: platform-tools
```

Applied to `ci.yml` (job `build`) and `release.yml` (job `publish`).
Upstream made the same change to the default in v4.0.2
([setup-android#538](android-actions/setup-android#538)).
Moving to v4 is left out on purpose: v4.0.4 also changes the Node
runtime and downloads cmdline-tools 22.0 instead of using the runner's
preinstalled 16.0. That would add two more variables to a one-variable
fix.

Root cause is the SDK repository, not the runner. Run
[34745748831](https://github.com/giovanniandreuzza/Nimbus/actions/runs/34745748831)
passed on 2026-09-13 and run
[36868952768](https://github.com/giovanniandreuzza/Nimbus/actions/runs/36868952768)
failed on 2026-10-01. Both used image `macos-26-arm64` 20260907.0351.1,
preinstalled cmdline-tools 16.0 and action v3 with the same inputs.

## Evidence

- **Before:** CI
[36868952768](https://github.com/giovanniandreuzza/Nimbus/actions/runs/36868952768)
(PR #32, README-only) and Release
[36211377237](https://github.com/giovanniandreuzza/Nimbus/actions/runs/36211377237)
(`publish` for v2.5.1) both stop at setup-android:
  ```
  [command]…/cmdline-tools/latest/bin/sdkmanager tools
  Warning: Failed to find package 'tools'
  Error: The process '…/sdkmanager' failed with exit code 1
  ```
**After:** CI on this branch: _pending, updated below once the run
finishes._
- `actionlint` is clean on both workflows. The branch name and commit
subject pass `.github/scripts/check-conventions.sh`.
- **Not exercised:** the `publish` job in `release.yml` only runs when
release-please creates a release, and running it publishes. Its
setup-android step is now identical to the one CI runs on the same
`macos-latest` runner, but the publish job itself has not been run.

## v2.5.1 is not on Maven Central

`repo1.maven.org` returns 404 for `nimbus-2.5.1.pom` and
`nimbus-ktor-2.5.1.pom`, and `maven-metadata.xml` lists 2.5.0 as the
latest version. The tag and the GitHub release `v2.5.1` exist. 2.5.1 has
the same library code as 2.5.0; it only added docs. Even so, the README
on `main` points consumers to `2.5.1`, and that version does not
resolve. Re-running the failed job will not help, because a re-run uses
the workflow from `d9cfd02`, which still has the broken step. Publishing
is left for the owner to decide and is not part of this PR.

## Merge Danger

**Door:** two-way. This changes only workflow configuration; reverting
the commit restores the previous behaviour.
**Blast Radius:** CI and the publish job. The `ci:` type is hidden in
release-please and does not cut a release, so merging this publishes
nothing. Gradle never used `tools`, so the build sees the same SDK it
saw before the break.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
@giovanniandreuzza
giovanniandreuzza marked this pull request as ready for review October 1, 2026 14:15
Copilot AI balanced review requested due to automatic review settings October 1, 2026 14:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The documentation-only change compiles as described and safely addresses the credential exposure warning without altering the API.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes the README logger example so copied code compiles and redacts signed URL query strings before forwarding events.

Changes:

  • Replaces the nonexistent redactingQueryStrings() call with explicit regex redaction.
  • Redacts URLs anywhere in the event’s rendered text.
File Description
README.md Corrects and strengthens the secure logging example.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@giovanniandreuzza
giovanniandreuzza merged commit 5e729c4 into main Oct 1, 2026
2 checks passed
@giovanniandreuzza
giovanniandreuzza deleted the chore/readme-redacting-example branch October 1, 2026 14:59
giovanniandreuzza added a commit that referenced this pull request Oct 1, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.5.2](v2.5.1...v2.5.2)
(2026-10-01)


### Documentation

* **readme:** redact signed query strings inside the logger example
([#32](#32))
([5e729c4](5e729c4))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

README: NimbusLogEvent.redactingQueryStrings() does not exist

2 participants