805 Commits
Author SHA1 Message Date
Julio López e8daf1138b refactor(server): remove tls.Config.VerifyPeerCertificate (#5637)
Remove `tls.Config.VerifyPeerCertificate`.
Instead rely on `VerifyConnection` to avoid double validation.

nit: leverage `EnsureType` in tests.

Ref:
- #5540
- #5610
- #5628
2026-09-10 15:47:06 -07:00
Julio López 848085632d refactor(general): propagate TLSConfigTrustingSingleCertificate error (#5628)
Improves failure mode by explicitly making returning an error when the
provided cert fingerprint is invalid.  The previously existing behavior
of creating a transport that fails all connection verification, is often
hard to troubleshoot.

Improve bad fingerprint test cases.
2026-09-07 20:19:23 -07:00
Julio López 82495e54b5 refactor(testing): use ContextForCleanup() in t.Cleanup() (#5627) 2026-09-06 22:48:33 -07:00
Julio López 16895e1ac6 refactor(server): avoid indenting JSON payload in responses (#5625) 2026-09-06 15:34:09 -07:00
Julio López fdf0159a17 refactor(general): cleanup various nits (#5618)
- use struct field initialization idiom
- clarify error message
- directly use s.rootctx in server request processing
- refactor: use require in e2e ACL test
- inline constant definition
- modernize with `strings.Cut`
- modernize with slices.Backward
- simplify timeFormat initialization
- refactor testing: check `Scanner.Err()` in testenv
- remove spurious parenthesis
- trueStr and falseStr consts
- use inheritPolicyString
- use const in cache info
- "bytes" const in ui task counters
- use common consts in gettool
2026-09-06 15:08:49 -07:00
ashmrtn 4ceee29c7d test(server): Add tests for TLS verification (#5610)
Add hash size check
Better error reporting by checking the hash size prior to attempting
validation.

Check bad fingerprint hash values

E2E client test for TLS checking
Use a server/client flow to check that TLS certs are checked if the
connection is resumed.
2026-09-03 13:01:16 -07:00
Julio López 9473eef9d1 build(deps-dev): upgrade golangci-lint to v2.11.4 (#5247)
Fixes for new linter warnings:
- fix: add //nolint annotations where it makes sense
- fix: remove no-longer necessary linter annotations
- fix linter: add or remove new lines
- fix linter: use Fprintf instead of WriteString
- fix: check for overflow in conversion to uint8 / byte
2026-09-03 12:12:20 -07:00
Julio López 7de9f36a73 refactor(server): validate cert on re-connection (#5540)
Will remove deprecated API
2026-09-02 22:56:31 -07:00
Julio López d9d21fe870 fix(repository): increment attempt to correctly log index write retries (#5575) 2026-08-24 17:09:24 -07:00
Julio López b0138a6e40 fix(server): limit allowed body size in server requests (#5561)
Rationale: avoid unbounded resource consumption.
2026-08-17 17:03:23 -07:00
Julio López 67934f1932 feat(server): make GetCapacity available over gRPC (#5315)
Make GetCapacity available over gRPC

Makes the `volume.GetCapacity()` available over gRPC as
`repository.GetCapacity()`

Tests included

---------

- Author: @andrason
2026-07-29 16:44:34 -07:00
Julio López 1a2eb5589b refactor(testing): mapStorage.limit uint64 (#5526) 2026-07-28 21:49:24 -07:00
coyaSONG d7ba213091 refactor(general): use structured logging for faults (#5504) 2026-07-24 21:55:56 -07:00
coyaSONG 40f45b06dc refactor(general): use structured logging in API client (#5506) 2026-07-22 11:21:33 -07:00
coyaSONG 0c1568729b refactor(general): use structured logging in diff (#5505) 2026-07-17 11:07:42 -07:00
coyaSONG 674a5abd6d refactor(general): use structured logging in list cache (#5501) 2026-07-15 23:19:50 -07:00
Julio López 7d70c3fea6 refactor(testing): use tb in subtest (#5489)
- followup to #5489
2026-07-10 22:26:59 -07:00
Julio Lópezandandrason 4a6e9c3396 refactor(repository): harden single-epoch compaction selection (#5488)
- add guards to `MaybeCompactSingleEpoch()`
- add logs and a comment to edge cases
- added new test cases in MaybeCompactSingleEpoch
Authored by @andrason





 Authored by @andrason

---------

Co-authored-by: andrason <andrason@users.noreply.github.com>
2026-07-10 21:34:26 -07:00
Julio López 116ec249c2 chore(general): remove unused deprecated field (#5476)
- remove unused field `encryptorInfo.deprecated`
- simplify implementations and function signatures
- deprecate `--deprecated` CLI flag
2026-07-06 21:59:15 -07:00
Julio López 62c72d1163 chore(general): address nits (#5475)
- fix and reword comments
- unexport `writeKopiaRepositoryBlobWithID`
- remove redundant function declaration in interface
- minor rewording to fix incomplete sentence in documentation
2026-07-06 20:45:24 -07:00
Julio López b048b22daf refactor(general): cleanup iomem hints (#5439)
- rename package to iomem
- update comments
- unexport `directoryWithOptions`
- check for `Close()` error on test cleanup
- reword flag description
- wrap errors to facilitate troubleshooting
- update logging message
2026-06-26 22:07:01 -07:00
Julio López d886957c7d feat(snapshots): reduce kernel page-cache pressure during snapshots (#5437)
Add fadvise hints to backup read path to reduce OS cache pollution

Issue FADV_SEQUENTIAL at open and FADV_DONTNEED at close for every file read during backup. This tells the kernel to read-ahead aggressively and then reclaim pages once the file is fully consumed, reducing cache pressure from large backups without adding measurable overhead.

Uses SyscallConn().Control() instead of os.File.Fd() to avoid switching file descriptors to blocking mode, which would remove them from Go's epoll poller and stall the upload pipeline.

Incremental FADV_DONTNEED during reads was tested and removed — it adds ~15% overhead on large-file workloads by fighting the kernel's own LRU. Restore write-path cache eviction was also tested and not included.

Authored-by: Rajat Gupta rajat.gupta@veeam.com
2026-06-26 19:29:13 -07:00
Julio López 2c1d84742b refactor(testing): minor cleanups in epoch manager tests (#5431)
- pass inner *testing.TB to helper
- nit: rename test helpers
- check for PutBlob error in test helper
2026-06-16 22:13:25 -07:00
Julio López 72ec08fd8e test(repository): Basic tests for getting epoch manager blob set (#5418)
Create helper functions that can seed state for epoch manager tests.

Test basic cases of getting the active set of blobs. This indirectly
tests the fallback logic that ensures all epochs are covered when
returning the active set.

Authored-by: @ashmrtn
2026-06-15 16:38:49 -07:00
Julio López 0c89334499 chore(lint): annotations for other platforms (#5413)
Fixes lint errors on non-Linux, non-Darwin platforms.

Authored-by: @ashmrtn
2026-06-09 23:05:20 -07:00
Julio López 7e36394b31 test(repo): run compaction in epoch manager tests (#5372)
Update tests to make the same calls made during full maintenance. This
makes the tests more similar to how they used to be before some calls,
like index compaction and write epoch advancement, were moved to the
maintenance code path.

Authored-by: ashmrtn <3891298+ashmrtn@users.noreply.github.com>
2026-05-13 23:21:48 -07:00
Julio López 0346afccee fix(repository): selection of next epoch to compact (#5373)
- additional test cases for epoch selection
- helper to derive oldest not compacted epoch
- fix selection of next epoch to compact
- cleanup: remove unused code and tests
- fixes #5371
2026-05-13 22:35:30 -07:00
c26c6a1b97 feat(cli): restrict insecure unauthenticated server to loopback binds (#5354)
* feat(cli): restrict insecure unauthenticated server to loopback binds

Reject starting the server with --insecure and --without-password when
--address would bind outside loopback (including empty host / all
interfaces). Validate the actual listener after Listen so systemd socket
activation cannot bypass the check.

Add hidden --allow-extremely-dangerous-unauthenticated-server-on-the-network
to opt into the previous behavior for isolated environments.

Extract validation into internal/insecureserverbind with table-driven tests.
Add end-to-end smoke tests for rejection and escape hatch.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Update internal/insecureserverbind/insecureserverbind.go

Co-authored-by: Julio López <1953782+julio-lopez@users.noreply.github.com>

* pr feedback

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Julio López <1953782+julio-lopez@users.noreply.github.com>
2026-05-04 19:51:20 -07:00
Julio López c8b8fe1c7f refactor(general): bigmapbench profiling (#5321)
- improve bigmapbench stats output
- refactor bigmapbench profiling and remove unneeded dependency
- nit: unexport const
2026-04-18 12:00:47 -07:00
Julio López d1e5c1d8a0 chore(general): clean nits (#5313)
- make benchmarking params uint
- prevent error in compression benchmarking
- lint on Windows and address linter warnings
- upgrade golang.org/x/exp
- upgrade github.com/cncf/xds/go
- upgrade github.com/dustinkirkland/golang-petname
- direct users to forum
- add warning about _recovery recipes_
2026-04-16 21:41:39 -07:00
Julio López 5bedcd5057 build(deps): upgrade to github.com/golang-jwt/jwt v5.3.1 (#5314)
- Changelog: https://github.com/golang-jwt/jwt/releases/tag/v5.3.1
- Remove dependency on github.com/golang-jwt/jwt/v4
2026-04-16 20:24:29 -07:00
Julio López 2a8ac65be4 refactor(general): make counters and size stats uint64 for consistency (#5262)
- make counters and size stats uint64 for consistency
- pass `deleteParallelism` as a parameter
2026-04-10 21:34:17 -07:00
Julio López 29d4118aac refactor(general): address potential conversion overflows (#5266)
Minor robustness improvements

- add safety check when converting file descriptor (`os.File.Fd()`) to `int`
- check that file descriptor returned by Open (on Linux) is non-negative before converting to `uintptr`. This addresses a linter warning for a most-likely-non-existent-edge-case of converting a negative file descriptor.
- check that parsed content IDs (hashes) do not exceed the maximum id hash length.
- add nolint annotation for safe conversion
2026-04-01 21:51:44 -07:00
Julio López 78407b1d5f refactor(general): string nits (#5265)
Minor improvements:

Refactor the construction of a test string with many control characters in `TestJSONWriter_StringEscapingPerformanceWithManyControlChars` by using a `strings.Builder`.
Rationale: address a future `modernize` linter warning. While this is also "more" efficient, it does not make any practical difference in this context.

Simplify the conversion of a short flag to a string in `emitFlags` by removing an unnecessary byte slice conversion (`tools/cli2md/cli2md.go`).
Rationale: simplify the expression for clarity and address a future linter warning.

- Ref: #5247
2026-04-01 20:50:10 -07:00
Julio López d1bc68ef61 refactor(general): cleanup nits (#5236)
Cleanup nits:
- get error handling policy upfront and improve readability in uploader
- update error message
- update field documentation and update flag description
- remove unused function
- const `isWindows` and remove redundant condition check
- add `getEnvVarBool` helper
- refactor common helper for mockfs.AddError* functions, and
  add mockfs.AddErrorEntry<Type> wrappers for clarity.
- removed list of skipped tests from gotestsum summary
2026-03-23 11:52:29 -07:00
Baixiaochun df247ecf92 fix(snapshots): ErrorEntry policy resolution to use child policy (#5234)
Fix ErrorEntry child policy resolution, includes tests.

- Fixes kopia/kopia#5232
2026-03-20 17:05:51 -07:00
Julio López 873a89a08d refactor(general): move SafeLongFilename to ospath (#5227)
- Move MaybePrefixLongFilenameOnWindows to ospath package and rename
  it to SafeLongFilename, along with corresponding test.
- Elide the function implementation at build time on non-Windows
  platforms.
- Update documentation and comments for clarity.
- Rename package-local helper function.
2026-03-17 17:43:08 -07:00
Julio López 418b4849d8 fix(providers): perform maximum of 2 attempt in PutBlobInPath (#5168)
Adjusts tests accordingly.

Also,
- fix error injection for MkdirAll in tests.
- make `TestFileStorageTouch` more robust.
- misc cleanups in FS storage tests
2026-02-19 20:14:49 -08:00
Julio López e456f78fa2 fix(providers): execute rclone with non-cancelling context (#5040)
- test rclone after canceling starting context
- execute rclone with non-cancelling context
- create initial SFTP connection with non-canceling context
- nit: use context.WithoutCancel instead of Background
- Fixes #5039
- Ref #4972
2025-11-25 23:05:28 -08:00
Julio López e1e1e0d807 fix(providers): allow S3 versioned tests cleanup to succeed (#5038)
- allow S3 versioned tests cleanup to succeed
- use ContextForCleanup
2025-11-24 22:32:51 -08:00
Nathan Baulch ea1bdb1541 chore(ci): enable noctx linter (#4972)
* pass context in webdav helpers
* fix typo in function name
2025-11-19 21:46:28 -08:00
Julio Lopez 3d4cd24117 refactor(general): make purpose a string parameter (#5015)
Make purpose parameter a string.

Refactor TestDeriveKeyFromMasterKey
- make variables local to the test and rename accordingly
- make the purpose a `const (untyped) string`
2025-11-19 19:40:59 -08:00
Julio Lopez 7b64425ab1 chore(ci): pass context in helpers for running docker (#5012)
- Ref: #4972
2025-11-18 22:44:40 -08:00
Julio Lopez 7586b21b1f chore(general): use contexts in tests (#5009)
Ref:
- Subset of the changes proposed by @NathanBaulch in #4972
2025-11-18 17:47:23 -08:00
Julio Lopez 3b2f44f3f1 refactor(general): leverage testing.T.Context in testlogging (#5008)
Ref:

- https://pkg.go.dev/testing@latest#T.Context
2025-11-18 10:42:39 -08:00
Julio Lopez 7db061ee71 build(deps): Go 1.25 (#4987)
Upgrade to Go 1.25
Leverage `WaitGroup.Go` in Go 1.25
2025-11-17 16:42:12 -08:00
Julio Lopez 1aaf433cdc build(deps): use stdlib context package (#5001) 2025-11-17 15:59:46 -08:00
Julio Lopez 70f8d678d0 fix(general): handle errors closing writable descriptors (#4998) 2025-11-16 23:07:51 -08:00
Julio Lopez 070c15b888 chore(general): avoid wrapping always-nil error (#4997) 2025-11-16 22:55:35 -08:00
Julio Lopez f1127b228e chore(general): check bounds for memory allocation (#4995) 2025-11-16 21:36:18 -08:00