@effectstream/grafana-loki 0.103.1 → 0.103.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/checksums.js +26 -0
- package/index.js +18 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -38,6 +38,26 @@ land in Loki, queryable from a local Grafana. Out of the box you get
|
|
|
38
38
|
component-tagged (`ComponentNames`) logs without writing any collector
|
|
39
39
|
config.
|
|
40
40
|
|
|
41
|
+
## Integrity
|
|
42
|
+
|
|
43
|
+
`bin-wrapper` has no checksum support and discards the archive after extracting,
|
|
44
|
+
so this package hashes the **extracted `loki`** and refuses to run anything
|
|
45
|
+
that is not one of the pinned v3.5.8 builds. Set `GRAFANA_LOKI_SKIP_CHECKSUM=1` to bypass when
|
|
46
|
+
deliberately running a local build.
|
|
47
|
+
|
|
48
|
+
Digests live in `checksums.js` and the check is `@effectstream/binary-checksum`,
|
|
49
|
+
shared with the other verified wrappers. Every entry is **upstream-verified**:
|
|
50
|
+
the archive each digest came from was matched against the checksum the vendor
|
|
51
|
+
publishes before the binary inside it was hashed, so the digest traces back to
|
|
52
|
+
something the vendor stands behind rather than to whatever a download happened to
|
|
53
|
+
return.
|
|
54
|
+
|
|
55
|
+
Regenerate after a version bump:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
bun scripts/generate-binary-checksums.ts grafana-loki
|
|
59
|
+
```
|
|
60
|
+
|
|
41
61
|
## Links
|
|
42
62
|
|
|
43
63
|
- Docs: https://effectstream.github.io/docs/packages/binaries/grafana-loki
|
package/checksums.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// GENERATED FILE. Do not edit by hand.
|
|
2
|
+
// Regenerate with: bun scripts/generate-binary-checksums.ts grafana-loki
|
|
3
|
+
//
|
|
4
|
+
// SHA-256 of the extracted binary in each pinned v3.5.8 asset.
|
|
5
|
+
//
|
|
6
|
+
// 'upstream-verified' means the archive this digest came from matched the
|
|
7
|
+
// checksum the vendor publishes, so the digest is traceable to the vendor.
|
|
8
|
+
// 'self-recorded' means no upstream manifest was available: the digest pins the
|
|
9
|
+
// artifact against later mutation but does not attest that it was ever good.
|
|
10
|
+
export const CHECKSUM_VERSION = '3.5.8';
|
|
11
|
+
|
|
12
|
+
export const CHECKSUMS = {
|
|
13
|
+
'linux-x64': 'a9c70d81ae983ca47defe8eff65bf833eee0932114fbfaa9556b1633ac0235f2',
|
|
14
|
+
'linux-arm64': 'e4021bcd7591412be792d89f4c462c0690296256d00a77e1cb81fb48456994cb',
|
|
15
|
+
'darwin-x64': 'dcf8904270401a53ee7e5e8a2f37a8e0a3f552aa465109e50431d20eaf839ca5',
|
|
16
|
+
'darwin-arm64': '1f589bdc06492fd74c970832f7aab54a22326eaf0b37b356512447166efe9425',
|
|
17
|
+
'win32-x64': 'ec530b5553b9da016ba8f0570d8b49b615fa75891dff4385194717f844ccfa32',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const CHECKSUM_PROVENANCE = {
|
|
21
|
+
'linux-x64': 'upstream-verified',
|
|
22
|
+
'linux-arm64': 'upstream-verified',
|
|
23
|
+
'darwin-x64': 'upstream-verified',
|
|
24
|
+
'darwin-arm64': 'upstream-verified',
|
|
25
|
+
'win32-x64': 'upstream-verified',
|
|
26
|
+
};
|
package/index.js
CHANGED
|
@@ -4,6 +4,8 @@ import BinWrapper from '@xhmikosr/bin-wrapper';
|
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
5
|
import process from 'node:process';
|
|
6
6
|
import fs from 'node:fs';
|
|
7
|
+
import { verifyBinaryChecksum } from '@effectstream/binary-checksum';
|
|
8
|
+
import { CHECKSUMS } from './checksums.js';
|
|
7
9
|
|
|
8
10
|
console.log(`Starting Grafana Loki on ${platform()} ${arch()}`);
|
|
9
11
|
|
|
@@ -58,6 +60,22 @@ const bin = new BinWrapper()
|
|
|
58
60
|
|
|
59
61
|
|
|
60
62
|
async function runBinary(args = []) {
|
|
63
|
+
// Download and verify BEFORE `bin.run`. `bin.run()` resolves the binary and
|
|
64
|
+
// then executes it (the `.version()` constraint above makes it exec
|
|
65
|
+
// `--version` to check), so calling it first would run an unverified binary
|
|
66
|
+
// and leave the integrity check with nothing left to protect.
|
|
67
|
+
if (!fs.existsSync(bin.path())) {
|
|
68
|
+
await bin.download();
|
|
69
|
+
}
|
|
70
|
+
const flavour = verifyBinaryChecksum({
|
|
71
|
+
binaryPath: bin.path(),
|
|
72
|
+
checksums: CHECKSUMS,
|
|
73
|
+
packageName: 'grafana-loki',
|
|
74
|
+
skipEnvVar: 'GRAFANA_LOKI_SKIP_CHECKSUM',
|
|
75
|
+
version,
|
|
76
|
+
});
|
|
77
|
+
console.log(`[grafana-loki] verified loki v${version} (${flavour})`);
|
|
78
|
+
|
|
61
79
|
// Check if the binary is installed working.
|
|
62
80
|
await bin.run(['--version']);
|
|
63
81
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effectstream/grafana-loki",
|
|
3
|
-
"version": "0.103.
|
|
3
|
+
"version": "0.103.2",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"description": "Grafana Loki binary wrapper for EffectStream",
|
|
6
7
|
"main": "index.js",
|
|
7
8
|
"bin": {
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
"start": "node index.js"
|
|
12
13
|
},
|
|
13
14
|
"dependencies": {
|
|
15
|
+
"@effectstream/binary-checksum": "0.103.2",
|
|
14
16
|
"@xhmikosr/bin-wrapper": "^13.2.0"
|
|
15
17
|
},
|
|
16
18
|
"homepage": "https://effectstream.github.io/docs/",
|