Skip to content

chore:ci security updates - #2

Open
NivGreenstein wants to merge 4 commits into
masterfrom
chore/ci-security-updates
Open

chore:ci security updates#2
NivGreenstein wants to merge 4 commits into
masterfrom
chore/ci-security-updates

Conversation

@NivGreenstein

Copy link
Copy Markdown
Collaborator

No description provided.

NivGreenstein and others added 4 commits August 19, 2026 13:55
CONTRIBUTING.md § Conventions specifies `var ErrErrorName = errors.New(...)`,
and the repo extends the Err* prefix to error types: 82 Err*-prefixed types
elsewhere, and zero exported *Error-suffixed ones. tms inverted that for its
eight struct types while its own sentinel vars (ErrNoTransformBackend,
ErrTMSVersion1, ErrGridNotActivated) already followed it, so the package was
inconsistent with the repo and with itself. server/ogc, added in the same work,
follows the convention — this brings tms into line with both.

ErrVariableWidthUnsupported and ErrGridUnavailable also move out of registry.go
into errors.go, where every other package keeps its errors (cache/errors.go,
config/errors.go, provider/errors.go).

No behaviour changes: the renames are mechanical, every usage was already
confined to tms/, and no error string is touched. Kept as its own commit for
that reason — it touches many lines and none of them do anything.

Addresses S1 and S2 of review.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Six findings from the two-axis review, none of which changed a documented
behaviour except where the review asked for it.

P10 — cache.NewKey nil-dereferenced on a nil grid. Its own comment says a grid
is required and deliberately not defaulted, then called grid.ID() with no guard.
It now returns (Key, error) with cache.ErrNilGrid; all four call sites already
had an error path. Declined the alternative of making TileMatrixSet.ID()
nil-safe: an empty id reads as WebMercatorQuad in Key.String, so that would have
turned a panic into the exact silent misfiling the comment forbids — another
scheme's tiles under WebMercatorQuad's keys, visible only as a cache that never
hits.

P2 — /api answered 200 to any ?f=, alone on the surface. It now runs through
negotiate, so ?f=html and ?f=pbf are 400 like everywhere else, and openapi.json
declares the parameter it honours. The response keeps the OpenAPI media type
rather than the negotiated format's: "json" names the representation, and for
this resource that representation is an OpenAPI 3.0 definition, which OGC
requires carry the specific profile.

S3 — the "MatrixSize then bound x and y independently" shape existed in four
places, spelled two different ways (inclusive max in two, exclusive count in the
others). Per-axis validation is what makes the non-square grids safe, so four
copies was four chances to drift. Extracted as TileMatrixSet.ValidateTile, which
returns a structured ErrTileOutsideMatrix carrying the axis and the matrix, so
each caller still phrases the failure in its own vocabulary — X/Y natively,
tileCol/tileRow on the OGC routes — without repeating the arithmetic. Every
existing error string is preserved.

Two message changes fall out of it, neither covered by a test: a non-numeric
tileRow/tileCol no longer carries the "; tile matrix N has M rows" suffix, since
it is a parse failure rather than a range one, and when both row and column are
out of range the message now names tileCol where it named tileRow.

S4 — the per-request grid was smuggled through a mutated Map copy at two
independent sites. Both now call atlas.Map.InGrid, which names the intent in one
place. Stopped short of the review's suggestion that Encode take the grid as a
parameter: the pinned Map also feeds cache.NewKey inside SeedMapTile, so
removing the carrier means changing Map.Encode, Atlas.SeedMapTile and
Atlas.PurgeMapTile — three exported signatures, and a call worth making
deliberately rather than as a side effect of this.

S5 — the tileset link base was assembled in four places, three of them
identical. Extracted as tileSetPath.

ValidateTile's test is deliberately not in tilematrixset_test.go: that file is
the morecantile port's correctness oracle and every value in it is upstream's.

Verified in both CGO modes as CONTRIBUTING.md requires, with gofmt -s clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Update vulnerable dependencies and make the local CI workflow resilient to missing credentials and occupied ports. Replace brittle MVT byte-size checks with decoded tile assertions.
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 87144

Warning

No base build found for commit cd2f248 on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 47.647%

Details

  • Patch coverage: Could not be determined — this PR's diff is too large for GitHub to return (406 error at GitHub).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 20163
Covered Lines: 9607
Line Coverage: 47.65%
Coverage Strength: 205.92 hits per line

💛 - Coveralls

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.

2 participants