Skip to content

Annotations: fix ensureTags never deleting removed tag links - #131464

Merged
cbodonnell merged 1 commit into
grafana:mainfrom
UgaTheDev:fix/alerting-ensuretags-stale-delete
Sep 16, 2026
Merged

cbodonnell merged 1 commit into
grafana:mainfrom
UgaTheDev:fix/alerting-ensuretags-stale-delete

Conversation

@UgaTheDev

Copy link
Copy Markdown
Contributor

Ref #130459

Relationship to #130460

This is complementary to, not overlapping with, @waterWang's #130460.

Issue #130459 reports two distinct defects. #130460 correctly fixes the first
(the AddMany write-back that produced annotation_id = 0 rows) and I've
confirmed that fix independently in a review comment there. This PR fixes the
second — the issue's unresolved item 5, the unsatisfiable DELETE — which
#130460 does not touch.

The two changes are in different functions and share no lines, so they can land
in either order, independently.

The bug

In ensureTags:

sess.MustCols("annotation_id", "tag_id").In("tag_id", tagsDelete).
    Delete(annotationTag{AnnotationID: annotationID})

The bean's TagID is zero, and MustCols exists precisely to force zero-valued
columns into generated SQL — engine_cond.go:69 honours mustColumnMap when
building conditions. So tag_id landed in the WHERE clause twice:

DELETE FROM annotation_tag
WHERE tag_id IN ($1 … $n) AND annotation_id = $n+1 AND tag_id = $n+2  -- bound to 0

tag_id IN (...) AND tag_id = 0 is unsatisfiable, so the delete matched zero
rows. Tags removed from an annotation were never unlinked, and stale
annotation_tag rows accumulated for every annotation whose tags ever changed.
All three callers are affected — Add, update and AddMany.

This is the malformed statement the issue reports verbatim as item 5. The
~46,900-bind IN list there was amplified by the AddMany bug (annotation_id = 0
matched all 47k orphans, so tagsDelete was enormous), but the dead
AND tag_id = 0 predicate is present on every call regardless.

The fix

Drop tag_id from MustCols. annotation_id stays listed deliberately: without
it, a zero annotation ID would be omitted from the condition entirely and widen
the delete to every row matching tag_id IN (...).

Why the existing tests didn't catch this

Get builds ItemDTO.Tags from the denormalized annotation.tags column, so
Can update annotation and remove all tags and its siblings were green while the
join table was wrong. GetTags — which powers annotation tag filtering — joins
annotation_tag, and therefore returned tags the annotation no longer had. That
is the user-visible symptom.

Test

Extended Can update annotation with additional tags in TestIntegrationAnnotations
to query the join table directly, since the existing items[0].Tags assertion
reads the denormalized column and cannot see the stale row. The subtest replaces
newtag2 with newtag3, so newtag2's link must be gone.

Without the fix:

--- FAIL: TestIntegrationAnnotations/.../Can_update_annotation_with_additional_tags
    extra elements in list B:
    Messages: replaced tags must be deleted from annotation_tag, not just from annotation.tags

With the fix:

go test ./pkg/services/annotations/... -count=1
ok  pkg/services/annotations/accesscontrol            1.660s
ok  pkg/services/annotations/annotationsapi            4.457s
ok  pkg/services/annotations/annotationsimpl          11.375s
ok  pkg/services/annotations/annotationsimpl/loki      6.608s

Verified fail-before/pass-after on this branch alone, with the AddMany bug still
present — the two are independent.

go build, go vet and gofmt clean on ./pkg/services/annotations/....

Not included

Cleanup of already-accumulated stale rows. CleanOrphanedAnnotationTags already
exists and handles rows whose annotation is gone, though not stale links to
annotations that still exist. A data migration felt out of scope for a correctness
fix — happy to add one if maintainers want existing installations repaired on
upgrade.

@UgaTheDev
UgaTheDev requested a review from a team as a code owner August 25, 2026 12:15
@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Signed commits report

All 1 commit between main and fix/alerting-ensuretags-stale-delete have verified signatures. ✅

@cla-assistant

cla-assistant Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cla-assistant

cla-assistant Bot commented Aug 25, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


UgaTheDev seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the pr/external This PR is from external contributor label Aug 25, 2026
@UgaTheDev
UgaTheDev force-pushed the fix/alerting-ensuretags-stale-delete branch from fe33ab3 to 924bbfc Compare August 26, 2026 07:56
@UgaTheDev

Copy link
Copy Markdown
Contributor Author

@grafana/grafana-backend-services-squad (owners of pkg/services/annotations/) — could someone take a look? All checks and the CLA are green; the diff is a scoped fix in xorm_store.go plus its regression test. Happy to split or reshape if that makes review easier.

@cbodonnell cbodonnell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks @UgaTheDev for this! the code changes LGTM, i think we should just clean up the extra commenting that was added.

@cbodonnell

Copy link
Copy Markdown
Contributor

@UgaTheDev Can you also please rebase this PR? I think some of the CI failures are related to stale dependencies.

@UgaTheDev
UgaTheDev force-pushed the fix/alerting-ensuretags-stale-delete branch from 924bbfc to 5924596 Compare September 15, 2026 04:48
@UgaTheDev

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (9ba3ef9), no conflicts. Still a single commit, unchanged diff: pkg/services/annotations/annotationsimpl/xorm_store.go plus its regression test.

go test ./pkg/services/annotations/annotationsimpl/ -run TestIntegrationAnnotations is green locally against the rebased tree. That should clear the stale-dependency failures. Thanks @cbodonnell!

@cbodonnell

Copy link
Copy Markdown
Contributor

thanks @UgaTheDev. can we please remove the comments that were added as suggested in my earlier review?

MustCols listed tag_id alongside annotation_id, which forced the bean's
zero-valued TagID into the DELETE's WHERE clause as "AND tag_id = 0" on top
of the intended "tag_id IN (...)". That predicate can never be satisfied, so
the delete matched no rows: tags removed from an annotation were never
unlinked and stale annotation_tag rows accumulated for every annotation whose
tags changed, via Add, update and AddMany alike.

Only annotation_id is forced now, which still keeps a zero annotation ID from
being omitted from the condition and widening the delete to unrelated rows.

The stale rows were invisible to the existing tests because Get builds
ItemDTO.Tags from the denormalized annotation.tags column, while GetTags joins
annotation_tag and so returned tags the annotation no longer had.

Ref grafana#130459

Signed-off-by: UgaTheDev <[email protected]>
@UgaTheDev
UgaTheDev force-pushed the fix/alerting-ensuretags-stale-delete branch from 5924596 to c81e721 Compare September 15, 2026 19:06
@cbodonnell
cbodonnell enabled auto-merge (squash) September 15, 2026 21:13
@cbodonnell
cbodonnell merged commit afbdc71 into grafana:main Sep 16, 2026
159 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Your submission is now being built and packaged.

cbodonnell added a commit that referenced this pull request Oct 1, 2026
…ag links (#133912)

Annotations: fix ensureTags never deleting removed tag links (#131464)

(cherry picked from commit afbdc71)

Co-authored-by: Kush Zingade <[email protected]>
cbodonnell added a commit that referenced this pull request Oct 1, 2026
…ag links (#133914)

Annotations: fix ensureTags never deleting removed tag links (#131464)

(cherry picked from commit afbdc71)

Co-authored-by: Kush Zingade <[email protected]>
cbodonnell added a commit that referenced this pull request Oct 1, 2026
…tag links (#133915)

Annotations: fix ensureTags never deleting removed tag links (#131464)

(cherry picked from commit afbdc71)

Co-authored-by: Kush Zingade <[email protected]>
cbodonnell added a commit that referenced this pull request Oct 1, 2026
…tag links (#133916)

Annotations: fix ensureTags never deleting removed tag links (#131464)

(cherry picked from commit afbdc71)

Co-authored-by: Kush Zingade <[email protected]>
matejkubinec added a commit to percona/grafana that referenced this pull request Nov 9, 2026
* [release-12.4.5] Snapshots: Fix error handling on duplicated keys (#127016)

Snapshots: Fix error handling on duplicated keys (#126086)

* return 409 when snapshot key already exist

* add tests

* Add unit tests

* fix linting

(cherry picked from commit a67a764fe55c8fa11ecce64510b1519e4edcd8de)

* Release: 12.4.5 (#127050)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>

* [release-12.4.5] Live/Plugins: Fix "namespace" to "scope" rename (#126421)

Live/Plugins: Fix "namespace" to "scope" rename (#119108)

(cherry picked from commit a7c9417dfe03b8b6c0b9f34d8669f80aebc4a2d2)

Co-authored-by: Ryan McKinley <[email protected]>

* [release-12.4.6] Docs: Update custom branding guidance for Cloud users (#127333)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Jacob Valdez <[email protected]>

* [release-12.4.6] Docs: Remove OSS product label from enterprise config docs (#127444)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Jacob Valdez <[email protected]>

* [release-12.4.6] CI: Backport upstream-run-id dispatch (#127405) (#127472)

Backports the release-build.yml change from #127405: the downstream dispatch to
release-build-enterprise.yml now passes upstream-run-id, gating the enterprise write-release-metadata
sentinel. Drops the bundled create-release-tag.yml change (absent on this branch).

* [release-12.4.6] Dependencies: Bump github.com/openfga/openfga to v1.18.0 (#127668)

* Dependencies: Bump github.com/openfga/openfga to v1.18.0

* Zanzana: Fix changes for new OpenFGA version

* [release-12.4.6] LibraryElements: Avoid redundant library element fetch in permission resolver (#127953)

LibraryElements: Avoid redundant library element fetch in permission resolver (#126797)


(cherry picked from commit 80b89fff781177f46055783d439746fefbff50d3)

Signed-off-by: Maicon Costa <[email protected]>

* [release-12.4.6] Alerting: Add protected fields authorization check to provisioning API (#127940)

Alerting: Add protected fields authorization check to provisioning API (#120513)

(cherry picked from commit 329327952e9bc785fddfbd3b1f1e70d64aa42778)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Yuri Tseretyan <[email protected]>

* [release-12.4.6] Go: Update version to 1.26.5 (#128017)

Go: Update version to 1.26.5

* [release-12.4.6] Jaeger: Handle gzip, deflate, and brotli compressed API responses (#128062)

Jaeger: Handle gzip, deflate, and brotli compressed API responses (#120370)

* Jaeger: Handle gzip, deflate, and brotli compressed API responses

* Jaeger: Refactor error handling and logging in API response methods

(cherry picked from commit a0c53761480ee7231f540e08118e929dc4f5b02e)

Co-authored-by: Zoltán Bedi <[email protected]>

* [release-12.4.6] K8s APIs: Handle org-1 authorization properly (#128175)

K8s APIs: Handle org-1 authorization properly (#128091)

* k8s APIs: Handle org-1 authorization properly

* move anonymous block past ns parsing

(cherry picked from commit 1576c1b82c74a3cedcf4e421e50d5571da7c069a)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: mohammad-hamid <[email protected]>

* [release-12.4.6] Alerting: Return 403 instead of 500 on contact point provenance mismatch (#127814)

Alerting: Return 403 instead of 500 on contact point provenance mismatch (#127699)

(cherry picked from commit 33048dab81ba1b8963c056ff2a2353f662e77bfd)

* [release-12.4.6] Azure Monitor Pagination: Log groups/Subscriptions (#128339)

* Azure Monitor: Follow ARM nextLink pagination for subscriptions and workspaces

Variable queries (and the config editor) only returned the first ARM page of
subscriptions, so tenants with more than ~50 subscriptions were truncated. Follow
the `nextLink` cursor across pages via a shared fetchAllArmPages helper, applied to
subscriptions and the Log Analytics workspaces list.

Backport of the frontend pagination fix to release-12.1.x (adapted for the
class-based ConfigEditor and non-type imports on this branch).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Azure Monitor: avoid page-cap warning when ARM page fetch fails

Clear the pagination path on an empty fetchPage result so we only log
the no-result warning, not the misleading MAX_ARM_PAGES truncation one.

Co-authored-by: Cursor <[email protected]>

* remove console logs

Signed-off-by: Cody Confer <[email protected]>

* toast notifications

Signed-off-by: Cody Confer <[email protected]>
(cherry picked from commit fac9f3b5c947bfc29ce80c3b3bd3451e6050ef17)

* cursor bug fix

Signed-off-by: Cody Confer <[email protected]>

---------

Signed-off-by: Cody Confer <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: Cursor <[email protected]>

* [release-12.4.6] Docs: Fix broken links (#128629)

* [release-12.4.6] Chore(deps): Upgrade websocket-driver to >= 0.7.5 (#128668)

Chore: Upgrade websocket-driver to fix CVE

Semver-compatible upgrade of websocket-driver to >= 0.7.5.

Co-authored-by: Claude claude-fable-5 <[email protected]>

* [release-12.4.6] alerting: fix ORM table mapping bug causing SELECT alert_rule columns FROM user on PostgreSQL (#128753)

alerting: fix ORM table mapping bug causing SELECT alert_rule columns FROM user on PostgreSQL (#124935)

* alerting: fix wrong Omit column name and explicit table binding in UpdateAlertRules
* alerting: add regression test for guid preservation and table binding under shared transaction

Co-authored-by: Dhananjay Aggarwal <[email protected]>

* [release-12.4.6] bump scenes (#128697)

* bump scenes

* change version

* bump version

* Release: 12.4.6 (#128862)

* Release: 12.4.6

* patch(security): fix loki based alerting access control on datasource proxy endpoint

GL-Vuln: VUL-2026-0084

* patch(security): RBAC: fix sql permission queries to properly filter permissions cross-org

GL-Vuln: VUL-2026-0094

---------

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: multimo <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* [release-12.4.7] Dependencies: Bump google.golang.org/grpc to v1.82.1 (#128980)

Dependencies: Bump google.golang.org/grpc to v1.82.1

* [release-12.4.7] CI: Skip running tests on push to mirrors / forks (#129171)

* [release-12.4.7] DashboardDS: Fix Mixed panels with a time override stuck in permanent loading (#129289)

DashboardDS: Fix Mixed panels with a time override stuck in permanent loading (#125954)

DashboardDS: Fix Mixed panels with time override stuck loading

A Mixed datasource panel with multiple `-- Dashboard --` (Other Panels)
subqueries stays in permanent loading when the source panel — or the chain
panel itself — carries a `PanelTimeRange` override (`timeFrom`/`timeShift`),
even though the data arrives.

The Mixed-DS stale-Done filter added in #124665 compared the upstream's
terminal emission range against the chain panel's request range
(`options.range`). With a time override those ranges legitimately differ, so
the fresh `Done` never matched, was dropped, and `emitFirstLoadedDataIfMixedDS`'s
`first(Done || Error)` never completed — the panel spun forever.

Compare against the source panel's own current range
(`sceneGraph.getTimeRange(sourceDataProvider)`) instead. That still discards
the genuinely stale value replayed by the upstream ReplaySubject after a
time-range change (its range differs from the source's current range), while
keeping the fresh terminal emission, which always matches the source's own
range regardless of any override on the chain or source.

Adds a regression test for the Mixed + PanelTimeRange override case and
extends the test helper to model a source range that differs from the chain.


(cherry picked from commit 2d08cc7a8940d023470f843301f09eaa7da59ed8)

Co-authored-by: Oscar Kilhed <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>

* [release-12.4.7] CI: sync release-comms.yml + backport #129513 (#129657)

* CI: sync release-comms.yml from main

* CI: Checkout fallback in release-build (#129513)

* CI: Checkout fallback in release-build

* Instead of attempting to check out the branch, attempt to dispatch and repeat if fail

(cherry picked from commit d66f67fed517904fbddf1160f8cb5d5fba8c71b0)

* [release-12.4.7] auth: chore(deps): bump saml lib #129549 (#129849)

* [release-12.4.7] Library Elements: Speed up folder-tree resolution for GET /api/library-elements on large instances (#129443)

* Library Elements: Speed up folder-tree resolution for GET /api/library-elements on large instances (#127762)

* Authz: List folders via search for the access-control folder tree (flag-gated)

buildFolderTree lists every folder via the apiserver as full objects,
byte-capped at ~2MB/page, so large instances pay many sequential paged
round-trips per rebuild.

Behind the authz.listFoldersViaSearch feature flag (default off, in-proc),
APIFolderStore now lists folders via the unified-storage search index —
lightweight UID+parent refs that aren't value-byte-capped, collapsing the
paged object-list round-trips. The search runs under a service identity
(all folders, no per-item authz recursion).

The resource client is supplied lazily via resource.EventualClient (filled in
apiserver.ProvideService) to break the authz<->resource-client wiring cycle.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* LibraryElements: Build folder tree via search index (flag-gated)

The library-elements folder tree (shared by getAllLibraryElements and
LibraryPanelUIDScopeResolver) was built from folder.GetFolders, which
returns full folder objects via a byte-capped unified-storage List,
requiring many paged object-list round-trips when an instance has a
large number of folders.

Behind libraryElements.folderTreeViaSearch, build it from
folder.SearchFolders (lightweight index hits, single round-trip)
instead, avoiding the paged object-list round-trips on
GET /api/library-elements for non-admins.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Signed-off-by: Maicon Costa <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
(cherry picked from commit d46296b509f953b6537eaaf2002011cce42c5e82)
Signed-off-by: Maicon Costa <[email protected]>

* Authz: Stamp service identity on folder-search request

The legacy resource-client interceptor (used when appPlatformGrpcClientAuth
is default-disabled) requires an identity.Requester in the context. The
in-process authz channel strips other client context values and installs
only authlib AuthInfo, so without stamping a service identity every search
fails and ListFolders falls back to the slow object-list path — enabling
authz.listFoldersViaSearch would then provide no speedup.

Signed-off-by: Maicon Costa <[email protected]>
Co-Authored-By: Claude Opus 4.7 <[email protected]>

* Feature toggles: rename to camelCase for release-12.4.7

The dot-notation flag names (authz.listFoldersViaSearch,
libraryElements.folderTreeViaSearch) are a newer convention introduced on
main after release-12.4.7 was cut. This branch still enforces camelCase
via TestFeatureToggleFiles/check_registry_constraints.

Rename to authzListFoldersViaSearch / libraryElementsFolderTreeViaSearch
and regenerate. No functional change — the Go constants
FlagAuthzListFoldersViaSearch / FlagLibraryElementsFolderTreeViaSearch
were already camelCase and their usages don't need updating.

Signed-off-by: Maicon Costa <[email protected]>
Co-Authored-By: Claude Opus 4.7 <[email protected]>

* Lint: preallocate parents slice in folder-tree cache test

Signed-off-by: Maicon Costa <[email protected]>
Co-Authored-By: Claude Opus 4.7 <[email protected]>

* Authz: Gate folder search on appPlatformGrpcClientAuth for split unified storage

In-proc deployments use NewLocalResourceClient, which mints tokens via
authnlib and passes service identity end-to-end — no config change needed
beyond authzListFoldersViaSearch.

Split unified-storage deployments (storage_type = "unified-grpc") only
work when appPlatformGrpcClientAuth is also enabled. Otherwise
NewResourceClient picks the legacy client whose interceptor serializes
only identity fields, so the service permissions never reach the search
server and RBAC's validateSubject rejects the reconstructed access-policy
identity. In that configuration every search would fall back to the slow
object-list path anyway.

Signed-off-by: Maicon Costa <[email protected]>
Co-Authored-By: Claude Opus 4.7 <[email protected]>

---------

Signed-off-by: Maicon Costa <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>

* [release-12.4.7] Dashboards: Get annotations and dashboard endpoint performance improvements (#129780)

Dashboards: Get annotations and dashboard endpoint performance improvements (#119378)

* Avoid reallocation of large array on getCachedUserPermissions



* perf: add setting for MYSQL FORCE INDEX IDX_dashboard_title



* permissions: optimize ExpandActionSetsWithFilter allocation



* wip



* Revert "wip"

This reverts commit 1f5479fce4b33e354d1bd7187ff59da9a0014a90.

* perf(accesscontrol): avoid xorm reflection in GetUserPermissions for large result sets

The DB query for user permissions was fast (~2ms) but the total time reached
40ms with ~12k rows because xorm's Find() uses reflection to map each row
into a struct.

- Run the permission query via engine.DB().QueryContext() and scan rows
  directly with rows.Scan(&action, &scope) into []Permission.
- Add getUserPermissionsRaw() so this read-only path no longer uses
  WithDbSession + Find().
- Pre-allocate the result slice (cap 4096) to limit reallocations.
- Keep build_query and query spans for profiling.

Query span time should now align with actual DB time instead of adding tens
of ms from reflection over 10k+ rows.



* migrations: add (role_id, scope) index on permission table

Add index to speed up GetUserPermissions-style queries that join permission
with role and filter/select by role_id and scope.



* Revert "migrations: add (role_id, scope) index on permission table"

This reverts commit dfdf35db5ce00d4e0d6968fba91fc5373767b502.

* Revert "perf(accesscontrol): avoid xorm reflection in GetUserPermissions for large result sets"

This reverts commit 91c2038916bf7cf1a7f9dbb860ff79cc1f07bfc9.

* perf(accesscontrol): avoid xorm reflection in GetUserPermissions for large result sets

Run the permission query via engine.DB().QueryContext() and scan rows
directly into []Permission to avoid xorm Find() reflection over 10k+ rows.

- Add getUserPermissionsRaw() and replacePlaceholdersForPostgres() so
  the raw query path works with SQLite, MySQL and Postgres (convert ?
  to $1, $2 for Postgres).
- Pre-allocate result slice (cap 4096); keep build_query/query spans.

Made-with: Cursor

* run make gofmt



* Reapply "migrations: add (role_id, scope) index on permission table"

This reverts commit 006e7e5643a0c3a81daaedb7269c9a111493fece.

* fix(accesscontrol): check rows.Close() return value for errcheck

Made-with: Cursor

* accesscontrol: use sqlx Rebind for GetUserPermissions instead of replacePlaceholdersForPostgres

Use GetSqlxSession().Query() which rebinds ? to driver-specific placeholders
(e.g. $1,$2 for Postgres), removing the need for replacePlaceholdersForPostgres
and the migrator/xorm imports in the accesscontrol database package.

Made-with: Cursor

* Pre-allocate permission array with 512 bytes length



* accesscontrol: use sqlx Query for GetTeamsPermissions instead of Find

Run the teams-permissions query via GetSqlxSession().Query() and scan rows
directly into the result map, avoiding xorm Find() reflection. Remove the
teamPermission struct and Permission() helper.

Made-with: Cursor

* accesscontrol: initialize teamPermissions map for GetTeamsPermissions



* accesscontrol: run permission queries on DB session retry path

Add xorm.Session.QueryRows as a thin wrapper around queryRows so callers
can stream raw SQL results on the same connection/transaction as the
session.

Use WithDbSession + QueryRows for GetUserPermissions and GetTeamsPermissions
instead of GetSqlxSession().Query, restoring sqlite lock retries and
transaction-bound sessions from context.

Made-with: Cursor

---------



(cherry picked from commit 1da06fc1a997d89aebc04cfa6134fd91fce2e9fd)

Signed-off-by: Maicon Costa <[email protected]>
Co-authored-by: Gabriel MABILLE <[email protected]>

* Release: 12.4.7 (#130052)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>

* [release-12.4.8] BarChart: Fix tooltip with circular dataframe field value (#130198)

* BarChart: Fix tooltip with circular dataframe field value (#130092)

* fix(VizTooltip): nested frame fields

(cherry picked from commit 64e18b7c978644cf98e447addb29add51c37386d)

* chore: use getContentItems instead of getFieldDisplayItems

* Snapshots: Patch 12.4.x with deletekey fix (#130314)

* Release: 12.4.8 (#130320)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>

* [release-12.4.9] fix(users): handle error when user login is updated to an already used one (#130392)

fix(users): handle error when user login is updated to an already used one (#130389)

(cherry picked from commit 645ab59a7094594163686cdea9c71af04217de95)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: xavi <[email protected]>

* [release-12.4.9] Azure Monitor: stop TraceExemplar attaching portal links to every field (#130415)

(cherry picked from commit 0e268d50bf14d48e3327602e440feb6049d5c777)

* [release-12.4.9] Dashboard Import: Labels in v2 schema (#130428)

* Dashboard Schema V2: Support labels for DataQueryKind, AdHoc and GroupBy

Backport of #119179 — add optional labels on v2beta1 DataQueryKind,
AdhocVariableKind, and GroupByVariableKind (required for #117212).

Co-authored-by: Cursor <[email protected]>

* Dashboard Import: Labels in v2 schema  (#117212)

* when importing v1 dashboard, use POST

* fix es-lint

* cleanup

* Isolate legacy import api usage

* Update translations

* Improve type detection

* Refactor types and utils to avoid duplication and isolate them in legacy when needed

* Use types from manage-dashboard since it is used from other files out of import

* Avoid regressions

* Fix linting and tests

* Improve types

* Consilidate api utils checkers

* Split ImportOverview in two versions

* simplify utils

* Fix tests

* Rename to ExportFormat

* linter

* refactor tests

* add gap

* add gap on ImportForm

* Update public/app/core/utils/isRecord.ts

Co-authored-by: Dominik Prokop <[email protected]>

* clean up

* fix layout

* fix mock

* update kind when exporting to be DashboardWithAccessInfo

* remove type assertions; don't process built in annotations

* update E2Es to use correct dashboard kind

* update export test

* another e2e

* fix v2 dash for e2e

* wip

* support labels for adhoc and groupby; rely on labels during import

* eslint prune

* switch from label to labels

* fix tests

* gofmt

* add exporter test

* generate api client

* introduce namespaced label

* fix tests

* e2e

* update manifest

* fix labels

* don't persist export labels during import

* initialzie with datasource when adding a query variable through side pane or dashboard controls

* remove duplicated block

* missing imports, lint

* support $ds export too

* use has

* fix ds

* remove schema changes

* more schema removal

* lint prune

---------

Co-authored-by: Ivan Ortega <[email protected]>
Co-authored-by: Dominik Prokop <[email protected]>
(cherry picked from commit e79bd24d5012e90a032729bb7d9385811b95f73a)

* fix: strip ExportLabel from Adhoc/GroupBy on import

Match QueryVariable/annotation/panel behavior so grafana.app/export-label
is not persisted after datasource remapping.

Co-authored-by: Cursor <[email protected]>

* generate apis

* fix: always strip grafana.app/export-label on v2 import

Export labels are ephemeral for import pickers; drop them even when
no datasource remap applies so they are not persisted after import.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Ivan Ortega <[email protected]>
Co-authored-by: Dominik Prokop <[email protected]>

* [release-12.4.9] Dashboards: Fix importing V1 dashboards with multiple same-type datasources (#130474)

Dashboards: Fix importing V1 dashboards with multiple same-type datasources (#130382)

(cherry picked from commit 895a1f44e56c759a9ae08abfa799686d67282f42)

* [release-12.4.9] Azure Monitor: fix migration for dimension filters (#130521)

Azure Monitor: fix migration for dimension filters (#128786)

* AzureMonitor: fix migration for dimension filters

* AzureMonitor: Drop filters with no dimension

(cherry picked from commit 9b0503462b776c30fc4ab053c1e6ab78448a13dd)

Co-authored-by: Olivier Lemasle <[email protected]>

* [release-12.4.9] Go: Update version to 1.26.6 (#130779)

* Go: Update version to 1.26.6 (#130724)

(cherry picked from commit e416adfacf7bfad7730cea950db7015caecd3af6)

* Go: Bump remaining release-branch-only modules to 1.26.6

The cherry-pick of #130724 only covered modules that still exist on main.
These six modules exist only on release-12.4.9 and were left at go 1.26.5,
so bump them to match the rest of the workspace. pkg/promlib is
intentionally left on its older directive, as in the 1.26.5 bump.

Co-authored-by: Andres Torres <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>

* Release: 12.4.9 (#130918)

* Release: 12.4.9

* chore(security): apply security patches for 12.4.9


Applies 1 security patch(es) from release-12.4.9:

- VUL-2026-0149.patch

GL-CVE: CVE-2026-17183

* Update CHANGELOG.md

---------

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Kevin Minehart Tenorio <[email protected]>

* [release-12.4.10] deps(actions): bump grafana/shared-workflows/actions/create-github-app-token from 0.2.2 to 0.3.1 (#130990)

* [release-12.4.10] deps(go): bump github.com/moby/go-archive from 0.2.0 to 0.3.3 (#131027)

deps(go): bump github.com/moby/go-archive from 0.2.0 to 0.3.3

* [release-12.4.10] MSSQL: Don't send twice to the result channel when `processResponse` fails (#131094)

Fix: Don't send twice to the result channel when `processResponse` fails

* [release-12.4.10] Chore: limit `release-npm` concurrency (#131245)

Chore: limit `release-npm` concurrency (#131147)

limit release-npm concurrency to prevent releases interfering with each other

(cherry picked from commit 7a57dfb795242345a684d7454af2273726c7c388)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <[email protected]>

* [release-12.4.10] Dependencies: Update go.etcd.io/etcd/client/pkg/v3 to v3.6.14 (#131286)

Dependencies: Update go.etcd.io/etcd/client/pkg/v3 to v3.6.14

* [release-12.4.10] Dependencies: Update go.mongodb.org/mongo-driver to v1.17.7 (#131561)

Dependencies: Update go.mongodb.org/mongo-driver to v1.17.7

* [release-12.4.10] Dependencies: Update github.com/getkin/kin-openapi to v0.147.0 (#131589)

Dependencies: Update github.com/getkin/kin-openapi to v0.147.0

* [release-12.4.10] Dashboard: Smart fill-to-limit pagination and merge-sort for mixed v1/v2 history (#131806)

Dashboard: Smart fill-to-limit pagination and merge-sort for mixed v1/v2 history (#120729)

* Dashboard: Fix version history pagination and v1/v2 merging in listDashboardHistory

Add auto-pagination to K8sDashboardAPI.listDashboardHistory and
K8sDashboardV2API.listDashboardHistory so they follow all
metadata.continue tokens instead of returning only the first page.

Fix Bug 2A in UnifiedDashboardAPI where pure v2 dashboards showed
empty history because 0 === 0 trivially passed the "all v1 items
valid" check. Apply the same fix to listDeletedDashboards.

Fixes #120212



* Remove spec document from PR

The spec is a planning artifact and should not be committed to the repo.



* Dashboard: Smart fill-to-limit pagination and merge-sort for mixed v1/v2 history

Replace the drain-all-pages approach with a fill-to-limit strategy that
stops fetching as soon as `limit` items are collected. For mixed v1/v2
dashboards, use a composite continue token to track both pagination
streams independently, and merge-sort valid items by generation desc.

- v1/v2 clients: fill-to-limit loop requesting `limit - items.length`
  per page instead of draining all pages unconditionally
- UnifiedDashboardAPI: three fast paths (pure v1, pure v2, mixed merge)
  with composite base64 continue token encoding both k8s tokens
- listDeletedDashboards: same composite-token and sort logic
- Tests: composite token encode/decode, generation ordering, exhausted
  streams, pure v2 fast path

Fixes #120212

* fix: decode composite continue token in listDeletedDashboards and improve test coverage

- Make sortByGenerationDesc generic to preserve type info and non-mutating
- Decode composite continue tokens on input in listDeletedDashboards
  (previously only encoded on output, breaking pagination on subsequent pages)
- Remove meaningless generation sort for deleted dashboards (different
  dashboards don't share a generation sequence)
- Fix tests that weren't exercising claimed code paths (v2 client was
  never called due to early returns on all-valid v1 responses)
- Add composite continue token assertion for mixed deleted dashboards response

* fix: wrap all return paths in composite continue tokens to prevent duplicate pages

Early returns (pure-v1 and pure-v2 paths) were returning raw k8s continue
tokens. On the next "load more" call, decodeCompositeToken misinterpreted
the raw v2 token as a v1 token (fallback path), causing v2 to restart from
the beginning and producing duplicate items in the version history UI.

All return paths now encode continue tokens via encodeCompositeToken:
- v1 early return: preserves the incoming v2 cursor position
- v2 early return: advances both v1 and v2 cursors
- merged path: unchanged (already encoded)

---------


(cherry picked from commit 8de0937e729eea41fb1b4dd432c6b31525e2a58e)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Ivan Ortega Alba <[email protected]>

* [release-12.4.10] Dashboards: Fix version dates and user display names in the legacy version history page (#131808)

Dashboards: Fix version dates and user display names in legacy version history

The legacy (non-Scenes) version history page reads the k8s dashboard
history resource raw, which produces two wrong columns:

- Date showed the same value on every row, because
  `metadata.creationTimestamp` on a history resource is the dashboard's
  creation time rather than the version's. It now prefers the
  `grafana.app/updatedTimestamp` annotation and only falls back to
  `creationTimestamp`.
- Updated by showed the raw identity key (for example `user:u000003420`).
  The keys are now resolved to display names through the IAM display
  mapping endpoint, with `grafana.app/createdBy` as a fallback for the
  initial version and the raw key kept for users that no longer exist.

This mirrors the fix already present in the Scenes component
VersionsEditView.

* [release-12.4.10] Dashboards: Fix adhoc and groupby variable datasource on UI import (#131821)

Dashboards: Fix adhoc and groupby variable datasource on UI import

Manual backport of #131817. The 12.4 line has a different implementation of the
same branch, so the automated cherry-pick does not apply.

* [release-12.4.10] Dependencies: Update github.com/prometheus/prometheus to v0.313.0 (#131788)

Dependencies: Update github.com/prometheus/prometheus to v0.313.0

* Release: 12.4.10 (#131902)

* Release: 12.4.10

* chore(security): apply security patches for 12.4.10


Applies 2 security patch(es) from release-12.4.10:

- VUL-2026-0108.patch
- VUL-2026-0160.patch

GL-CVE: CVE-2026-14199
GL-CVE: CVE-2026-19475

---------

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>

* [release-12.4.11] Dependencies: Update golang.org/x/crypto to v0.56.0 (#131996)

Dependencies: Update golang.org/x/crypto to v0.56.0

* [release-12.4.11] CI: hooks SBOM generation into release workflow as workflow call (#132008)

CI: hooks SBOM generation into release workflow as workflow call (#130231)

* hooks into grafana release workflow as workflow call

(cherry picked from commit 3241361292b38d5cf596b530c698ca58acecc10a)

* [release-12.4.11] Dependencies: Update google.golang.org/grpc to v1.83.1 (#132015)

Dependencies: Update google.golang.org/grpc to v1.83.1

* [release-12.4.11] CI: Tag release branches after patches have been merged and the changelog has been updated instead of before. (#132057)

CI: Tag release branches after patches have been merged and the changelog has been updated instead of before. (#132040)

* Allow create release tag to be called via workflow_call

* use release-branch instead of tag to resolve changelog diff

* Skip bump-version if package.json already equals the requested version

* write branch name of release PR to an artifact

* create release tag in the release-comms workflow

* embed grafana-commit (post-patch-commit) in the binary instead of public-commit

* support branch name targewts in changelog script

* fix reported issues

(cherry picked from commit 6d5e6a360e709b0c1f51b479d68c82c316a942e9)

* [release-12.4.11] Geomap: Allow CARTO CDN in default CSP connect-src (#132093) (#132192)

Geomap: Allow CARTO CDN in default CSP connect-src (#132093)

* Geomap: Allow CARTO CDN in default CSP connect-src

* Remove extra line

(cherry picked from commit 4afddc318c3566483d26ef23463518619bb3c643)

Co-authored-by: Drew Slobodnjak <[email protected]>

* [release-12.4.11] Geomap: Switch carto to vector source (#131916) (#132196)

* Geomap: Allow CARTO CDN in default CSP connect-src (#132093)

* Geomap: Allow CARTO CDN in default CSP connect-src

* Remove extra line

(cherry picked from commit 4afddc318c3566483d26ef23463518619bb3c643)

* Geomap: Switch carto to vector source (#131916)

* Geomap: Switch carto to vector source

* Fix e2e tests

(cherry picked from commit a7e0f0391d31a6dc6c7e935656f6b304efb7f31f)

---------

Co-authored-by: Drew Slobodnjak <[email protected]>

* Alerting: align alert labels to the Tag column size (#132074) (#132505)

* fix: consider Tag column max size

* feat: adjust to the current Tag value

* feat: use json.marshal instead

(cherry picked from commit 2912c18f13178edd7de9c8dd6add8382134aab11)

* [release-12.4.11] CI: Add '#vendor' branch as a source in mirrors (#132513)

CI: Add '#vendor' branch as a source in mirrors (#132375)

* CI: Add '#vendor' branch as sources

* exclude LICENSE from frontend-lint

* update policy.yml

(cherry picked from commit 396740a3189885b247398397f588b66eab13281f)

* Release: 12.4.11 (#132637)

* Release: 12.4.11

* chore(security): apply security patches for 12.4.11


Applies 4 security patch(es) from release-12.4.11:

- VUL-2026-0097.patch
- VUL-2026-0102.patch
- VUL-2026-0169.patch
- VUL-2026-0171.patch

GL-CVE: CVE-2026-12704
GL-CVE: CVE-2026-15815
GL-CVE: CVE-2026-76154
GL-CVE: CVE-2026-79656

---------

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>

* [release-12.4.12] Dependencies: Update github.com/apache/thrift to v0.24.0 (#132679)

Dependencies: Update github.com/apache/thrift to v0.24.0

* [release-12.4.12] Sqlite: Fix pragma parsing (#132915)

Sqlite: Fix pragma parsing

* [release-12.4.12] Docker: Update Alpine to 3.24.2 (#133215)

Docker: Update Alpine to 3.24.2

* [release-12.4.12] Dependencies: Update go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc to v0.21.0 (#133272)

Dependencies: Update go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc to v0.21.0

* [release-12.4.12] Dependencies: Update github.com/openfga/openfga to v1.18.3 (#133329)

Dependencies: Update github.com/openfga/openfga to v1.18.3

* [release-12.4.12] Server: Render error pages without frontend assets (#133473)

Server: Render error pages without frontend assets (#132173)

* Server: Render error pages without frontend assets

* Server: Correct error icon viewBox

* Server: Remove unused error page styles

(cherry picked from commit ad0c86f604d62a90d68a3abc18282eb27857bdba)

Co-authored-by: Josh Hunt <[email protected]>

* [release-12.4.12] Security: Allow blob: image previews with default CSP (#133458)

Security: Allow blob: image previews with default CSP (#133447)

(cherry picked from commit b8e6357f384f7dec93fb34bf9c509f4ef9586779)

* [release-12.4.12] Packaging: place backend plugin unix sockets in /run/grafana to survive systemd-tmpfiles age cleanup (#133559)

Packaging: place backend plugin unix sockets in /run/grafana to survive systemd-tmpfiles age cleanup (#131593)

Packaging: Set PLUGIN_UNIX_SOCKET_DIR=/run/grafana in systemd units

Fixes #131592

(cherry picked from commit ee76d9cd4a028753f3368b149d4939a47ea495e0)

Co-authored-by: Christos Diamantis <[email protected]>

* [release-12.4.12] Dashboards: Fix breadcrumb dashboard link dropping root_url subpath in panel edit (#127750) (#133498)

* [release-12.4.12] Unified Storage: Return 403 instead of 500 on namespace mismatch (#133595)

[release-12.4.12] fix: proper error message on namespace missmatch (#132540)

(cherry picked from commit eaa3b91685ccae8feea4af6c06dd977b8405d728)

* [release-12.4.12] Tests: Disable two flaky int tests (#133684)

Tests: Disable two flaky int tests

* Release: 12.4.12 (#133770)

* Release: 12.4.12

* chore(security): apply security patches for 12.4.12


Applies 4 security patch(es) from release-12.4.12:

- VUL-2026-0110.patch
- VUL-2026-0111.patch
- VUL-2026-0172.patch
- VUL-2026-0173.patch

GL-CVE: CVE-2026-13719
GL-CVE: CVE-2026-13720
GL-CVE: CVE-2026-81841
GL-CVE: CVE-2026-81842

* PublicDashboards: Fix test reference code from blanket import

---------

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Matheus Macabu <[email protected]>

* [release-12.4.13] Fix E2E: mock Prometheus label requests with either HTTP method (#133786)

Fix E2E: mock Prometheus label requests with either HTTP method (#133424)

fix(e2e): mock Prometheus label requests with either HTTP method

(cherry picked from commit 2cdc027a4e6826cedab39915431e871585f6175e)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Paul Marbach <[email protected]>

* [release-12.4.13] Dashboard: Preserve default grid rows when filtering and resizing panels (#133898)

Dashboard: Preserve default grid rows when filtering and resizing panels (#133851)

* Dashboard: Preserve classic rows when filtering and resizing panels

* Dashboard: Name panel search layout after default grid

* Dashboard: Delegate search row rendering through context callback

* Dashboard: Fix panel search dependency cycle and unused exports

(cherry picked from commit 7a006bca33ea1592c2a92208c53c6d08c9376c7c)

* [release-12.4.13] Annotations: fix ensureTags never deleting removed tag links (#133916)

Annotations: fix ensureTags never deleting removed tag links (#131464)

(cherry picked from commit afbdc71e12d5a269bc5b5bde85ab19432d6af582)

Co-authored-by: Kush Zingade <[email protected]>

* [release-12.4.13] Annotations: fix tags not linked to batch-inserted annotations (#133920)

Annotations: fix tags not linked to batch-inserted annotations (#133893)

(cherry picked from commit e9243f551a01afb71594a3fe266d5289f4a7f26a)

* [release-12.4.13] Docs: Fix broken links (#134144)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Isabel Matwawana <[email protected]>

* [release-12.4.13] Dashboard: Fall back when collection deletion is unsupported (#128259) (#134229)

Dashboard: Fall back when collection deletion is unsupported (#128259)

(cherry picked from commit bad9d9ef199886626b95b515685ce15d6dd6c05b)
(cherry picked from commit 0b8dae4979d5cc28b7b47ead4901b96c11ede61e)

Co-authored-by: John Kim <[email protected]>

* [release-12.4.13] IAM: Fix: Permissions cache (#134343)

IAM: Fix: Permissions cache (#132395)

* IAM: Fix: get permissions cache issue

* chore: add tests

(cherry picked from commit 88e85ad1743e60b9aacd7ae3d9c00c56823db3ea)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Yudintsev George (Egor) <[email protected]>

* [release-12.4.13] Alerting: Strip sensitive headers from oauth2 cross-host redirects (#134424)

* make update-workspace

* update grafana/alerting to b4dbe97caa73

* [release-12.4.13] Deps: Update otel packages to v1.46.0 (#134285)

Deps: Update otel packages to v1.46.0

* [release-12.4.13] LibraryElements: Return 404 when trying to delete non-existing element (#134506)

LibraryElements: Return 404 when trying to delete non-existing element (#134488)

(cherry picked from commit 7cb72f816c40fa102c19902b5ca85bedc1ee1d41)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Matheus Macabu <[email protected]>

* [release-12.4.13] Dashboards API: Return 404 for missing dashboard versions (#134546)

Dashboards API: Return 404 for missing dashboard versions (#134539)

API: Return 404 for missing dashboard versions

GetDashboardVersion returned 500 when the requested version did not exist, and GetDashboardVersions returned 404 for every error. Both handlers now return 404 only for ErrDashboardNotFound and 500 for other errors.


(cherry picked from commit 7b702d7969564cb677ae3e3f393dedd6f867264e)

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Florie Cai <[email protected]>

* [release-12.4.13] Dependencies: Update golang.org/x/net to v0.60.0 (#134615)

Dependencies: Update golang.org/x/net to v0.60.0

* [release-12.4.13] Go: Update to 1.26.9 (#134624)

Go: Update to 1.26.9

* [release-12.4.13] CloudWatch: return per-query error for unknown log query subtype instead of panicking (#134120)

CloudWatch: return per-query error for unknown log query subtype instead of panicking (#131397)

CloudWatch: return a query error for unknown log action subtypes

executeLogAction returned (nil, nil) when logsQuery.Subtype matched no
case, and executeLogActions passed that nil frame straight into
groupResponseFrame, whose hasTimeField dereferenced it and crashed the
whole Grafana process (#125740). Any dashboard auto-refreshing such a
query restarted the crash loop.

Reject unknown subtypes with a per-query error via a default case, and
defensively convert a nil frame from any handler into a per-query error
instead of a panic.


(cherry picked from commit 07c2c351ae1ceb74405d7085e6b136e81882cb3d)

Co-authored-by: Pranshul Soni <[email protected]>

* Release: 12.4.13 (#134802)

* Release: 12.4.13

* chore(security): apply security patches for 12.4.13


Applies 3 security patch(es) from release-12.4.13:

- VUL-2026-0033.patch
- VUL-2026-0143.patch
- VUL-2026-0236.patch

GL-CVE: CVE-2026-15577
GL-CVE: CVE-2026-33374
GL-CVE: CVE-2026-93294

* chore(security): apply security patches for 12.4.13

Applies 3 security patch(es) from release-12.4.13:

- VUL-2026-0033.patch
- VUL-2026-0143.patch
- VUL-2026-0236.patch

GL-CVE: CVE-2026-15577
GL-CVE: CVE-2026-33374
GL-CVE: CVE-2026-93294

---------

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>

* [release-12.4.14] Azure Monitor: Fix panic when a metrics query has no azureMonitor object (#134963)

Azure Monitor: Fix panic when a metrics query has no azureMonitor object (#134718)

buildQuery read queryJSONModel.AzureMonitor, a pointer, without a nil
check. A query with queryType "Azure Monitor" and no azureMonitor object,
which the API and provisioning accept, panicked with a nil pointer
dereference: alert rules failed on every evaluation with "alert rule
panic", and /api/ds/query returned HTTP 500.

Return a downstream error that names the missing object instead.

Fixes #134717

(cherry picked from commit a0a49dd9d0b1d2657096f0f5f0de55055ae43b94)

Co-authored-by: wuweng <[email protected]>

* [release-12.4.14] Update timezones.tsx for Coyhaique etc (#135023)

Update timezones.tsx for Coyhaique etc (#134996)

Update timezones.tsx to include the names America/Coyhaique
(introduced in TZDB 2025b): and Asia/Kolkata (introduced in tzdata
2008b), while removing obsolete names like Europe/Zaporozhye
that are not distinct zones and that complicate the user
interface and in some cases use spellings that some users
may find offensive.  Problem reported by Khikmet Kerimov in:
https://lists.iana.org/hyperkitty/list/[email protected]/thread/KVRGELLLV6UYQX6PPJRLBXA56WJLS6SC/

(cherry picked from commit ea956977ad2927e424f538b48aaed98c9e404234)

Co-authored-by: Paul Eggert <[email protected]>

* [release-12.4.14] Chore(deps): Upgrade handlebars to >= 4.7.10 (#135085)

* bump scenes to 7.4.1 (#134893)

* bump scenes to 7.4.1

* Dashboards: Bump Scenes to 7.4.1 on release-12.4.14 (#134918)

* Bump Scenes to 7.4.1 and update dashboard variable compatibility

* Chore: Align translation key ordering with CI extraction

---------

Co-authored-by: Piotr Jamróz <[email protected]>

* fix i18n (#135152)

* [release-12.4.14] Update check frontend test coverage check (#135153)

* [release-12.4.14] Resolve transitive lodash ~4.17.21 to ^4.18.1 (#135139)

* [release-12.4.14] Chore(deps): Upgrade svgo to >= 3.3.5 (#135287)

* [release-12.4.14] Chore(deps): Upgrade joi to >= 17.13.8 (#135306)

* [release-12.4.14] Dashboards: Reserve space for body height to prevent variable overflow (#135310)

Dashboards: Reserve space for body height to prevent variable overflow (#134743)

(cherry picked from commit 386a7cc7bc9bb6607f314d324015f4412650d483)

* [release-12.4.14] Dependencies: Update github.com/getkin/kin-openapi to v0.151.0 (#135354)

Dependencies: Update github.com/getkin/kin-openapi to v0.151.0

* [release-12.4.14] Go: Update to 1.26.10 (#135403)

* Go: Update to 1.26.10

* CI: Update setup-go action to use shared one

* CI: Run actions/setup-go after enterprise clone

* OpenAPI: Fix schema drift

* [release-12.4.14] Auth: Include authenticatedBy in the ID token cache key (#135614)

Auth: Include authenticatedBy in the ID token cache key (#135395)

The ID token cache key is built from the identity, org role and groups,
but the signed token also carries authenticatedBy. Two authentications
of the same user that differ only in their auth module, such as a
render for a scheduled report and the user's own browser session,
shared one cache entry, so for up to ten minutes each got the other's
token. Data sources that check authenticatedBy (for example Azure
current-user authentication, which rejects "render") then failed for
the user.

Add authenticatedBy to the key so each auth module caches its own token.

(cherry picked from commit 3025c5a4a0a850e4b7279445d5df3e9a83e7e5dc)

Co-authored-by: wuweng <[email protected]>

* [release-12.4.14] Chore(deps): Upgrade qs to >= 6.16.0 (#135360)

* [release-12.4.14] Chore(deps): Upgrade hono to >= 4.12.12 (#135362)

* [release-12.4.14] Chore(deps): Upgrade brace-expansion to >= 5.0.8 (#135363)

* [release-12.4.14] Chore(deps): Upgrade socket.io-parser to >= 4.2.7 (#135364)

* [release-12.4.14] Chore(deps): Upgrade picomatch to >= 4.0.4 (#135365)

* [release-12.4.14] Chore(deps): Upgrade fast-uri to >= 3.1.5 (#135366)

* [release-12.4.14] Chore(deps): Upgrade tar to >= 7.5.21 (#135361)

* [release-12.4.14] Chore(deps): Upgrade @protobufjs/utf8 to >= 1.1.1 (#135367)

* [release-12.4.14] Chore(deps): Upgrade glob to >= 10.5.0 (#135359)

* [release-12.4.14] Chore(deps): Upgrade undici to >= 7.29.1 (#135357)

* [release-12.4.14] Chore(deps): Upgrade engine.io to >= 6.6.10 (#135340)

* [release-12.4.14] Chore(deps): Upgrade @hono/node-server to >= 1.19.15 (#135352)

* [release-12.4.14] Chore(deps): Upgrade postcss to >= 8.5.12 (#135358)

Upgrade postcss to >= 8.5.12

Bump the exact postcss pin and the semver-compatible ranges on the 12.4 release branch.

* [release-12.4.14] Chore(deps): Upgrade mailparser to >= 3.9.3 (#135369)

* Dependencies: Bump Yarn dependencies in release-12.4.14 (#135666)

* Deduplicate Yarn dependencies before security updates

* Update Yarn dependencies to resolve security advisories

* Deduplicate Yarn dependencies after security updates

* Remove obsolete Nodemailer resolution

* [release-12.4.14] Secrets: Honor locking_attempt_timeout_sec in secret DB migrations (#135838)

Secrets: Honor locking_attempt_timeout_sec in secret DB migrations (#135551)

The secrets-manager migrator hard-coded a lock timeout of 0, so instances
starting concurrently against one MySQL database failed with "failed to
obtain lock" even when [database] locking_attempt_timeout_sec was set
(all migrator scopes share the same GET_LOCK key on MySQL).

Read migration_locking and locking_attempt_timeout_sec from the
[database] config section at the call site, mirroring the resource-store
migrator in pkg/storage/unified/sql/db/migrations/migrator.go.

Partial fix for #135481 (Path 1; the basic role seeder path is out of scope).


(cherry picked from commit adf759d9c8fc3c672e6882878fd425b72abee28e)

Signed-off-by: wqyuan <[email protected]>
Co-authored-by: Qingyuan Wang <[email protected]>

* [release-12.4.14] Docker: Update Alpine to 3.24.3 (#135981)

Docker: Update Alpine to 3.24.3

* [release-12.4.14] Dependencies: Update github.com/andybalholm/brotli to v1.2.7 (#135975)

Dependencies: Update github.com/andybalholm/brotli to v1.2.7

* [release-12.4.14] Docs: Document service_accounts.token_expiration_day_limit (#135672) (#136033)

Docs: Document service_accounts.token_expiration_day_limit (#135672)

(cherry picked from commit e13b851480d5821b001c8355c8228a7f70fbc758)

Co-authored-by: Lazizbek Ergashev <[email protected]>

* Release: 12.4.14 (#136109)

* Release: 12.4.14

* chore(security): apply security patches for 12.4.14


Applies 3 security patch(es) from release-12.4.14:

- VUL-2026-0194.patch
- VUL-2026-0195.patch
- VUL-2026-0244.patch

GL-CVE: CVE-2026-100105
GL-CVE: CVE-2026-88858
GL-CVE: CVE-2026-88967

* Alerting: Update receiver tests for CanCreate enforcement

LINE v1 is deprecated and can no longer be created, so the CRUD test uses a creatable integration and asserts the rejection separately.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Kevin Minehart <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>

* PMM-15766 Drop form-data resolution

The 4.0.4 pin was added for CVE-2025-7783 but now forces form-data
below upstream's 4.0.6, which fixes CVE-2026-12143. All consumers
accept 4.0.6, so let yarn resolve it like upstream does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Signed-off-by: Maicon Costa <[email protected]>
Signed-off-by: Cody Confer <[email protected]>
Signed-off-by: wqyuan <[email protected]>
Co-authored-by: Alexa Vargas <[email protected]>
Co-authored-by: grafana-pr-automation[bot] <140550294+grafana-pr-automation[bot]@users.noreply.github.com>
Co-authored-by: grafana-writer[bot] <292009011+grafana-writer[bot]@users.noreply.github.com>
Co-authored-by: Ben Sully <[email protected]>
Co-authored-by: Ryan McKinley <[email protected]>
Co-authored-by: Jacob Valdez <[email protected]>
Co-authored-by: Kevin Minehart Tenorio <[email protected]>
Co-authored-by: Matheus Macabu <[email protected]>
Co-authored-by: maicon <[email protected]>
Co-authored-by: Yuri Tseretyan <[email protected]>
Co-authored-by: Taewoo K. <[email protected]>
Co-authored-by: Zoltán Bedi <[email protected]>
Co-authored-by: mohammad-hamid <[email protected]>
Co-authored-by: William Wernert <[email protected]>
Co-authored-by: Cody Confer <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Isabel Matwawana <[email protected]>
Co-authored-by: Jack Westbrook <[email protected]>
Co-authored-by: Dhananjay Aggarwal <[email protected]>
Co-authored-by: Sergej-Vlasov <[email protected]>
Co-authored-by: multimo <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ida Štambuk <[email protected]>
Co-authored-by: Oscar Kilhed <[email protected]>
Co-authored-by: xavi <[email protected]>
Co-authored-by: Gabriel MABILLE <[email protected]>
Co-authored-by: Galen Kistler <[email protected]>
Co-authored-by: Collin Fingar <[email protected]>
Co-authored-by: Isabella Siu <[email protected]>
Co-authored-by: Haris Rozajac <[email protected]>
Co-authored-by: Ivan Ortega <[email protected]>
Co-authored-by: Dominik Prokop <[email protected]>
Co-authored-by: Bogdan Matei <[email protected]>
Co-authored-by: Adam Yeats <[email protected]>
Co-authored-by: Olivier Lemasle <[email protected]>
Co-authored-by: Andres Torres <[email protected]>
Co-authored-by: Matt Cowley <[email protected]>
Co-authored-by: Ryan Morris <[email protected]>
Co-authored-by: Ashley Harrison <[email protected]>
Co-authored-by: Sam Ezebunandu <[email protected]>
Co-authored-by: Paul Marbach <[email protected]>
Co-authored-by: Drew Slobodnjak <[email protected]>
Co-authored-by: Konstantin <[email protected]>
Co-authored-by: Josh Hunt <[email protected]>
Co-authored-by: Christos Diamantis <[email protected]>
Co-authored-by: Yunwen Zheng <[email protected]>
Co-authored-by: Peter Štibraný <[email protected]>
Co-authored-by: Matheus Macabu <[email protected]>
Co-authored-by: Craig O'Donnell <[email protected]>
Co-authored-by: Kush Zingade <[email protected]>
Co-authored-by: John Kim <[email protected]>
Co-authored-by: Yudintsev George (Egor) <[email protected]>
Co-authored-by: Matthew Jacobson <[email protected]>
Co-authored-by: Florie Cai <[email protected]>
Co-authored-by: Pranshul Soni <[email protected]>
Co-authored-by: wuweng <[email protected]>
Co-authored-by: Paul Eggert <[email protected]>
Co-authored-by: Laura Fernández <[email protected]>
Co-authored-by: Piotr Jamróz <[email protected]>
Co-authored-by: colin-stuart <[email protected]>
Co-authored-by: Qingyuan Wang <[email protected]>
Co-authored-by: Lazizbek Ergashev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/backend backport v13.2.x Mark PR for automatic backport to v13.2.x pr/external This PR is from external contributor type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants