Skip to content

Commit bc0c857

Browse files
committed
buildkitd: handle device insecure entitlement
Signed-off-by: CrazyMax <[email protected]>
1 parent 0506df9 commit bc0c857

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

cmd/buildctl/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ var buildCommand = cli.Command{
8989
},
9090
cli.StringSliceFlag{
9191
Name: "allow",
92-
Usage: "Allow extra privileged entitlement, e.g. network.host, security.insecure",
92+
Usage: "Allow extra privileged entitlement, e.g. network.host, security.insecure, device",
9393
},
9494
cli.StringSliceFlag{
9595
Name: "ssh",

cmd/buildkitd/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type Config struct {
1212
// Root is the path to a directory where buildkit will store persistent data
1313
Root string `toml:"root"`
1414

15-
// Entitlements e.g. security.insecure, network.host
15+
// Entitlements e.g. security.insecure, network.host, device
1616
Entitlements []string `toml:"insecure-entitlements"`
1717

1818
// LogFormat is the format of the logs. It can be "json" or "text".

cmd/buildkitd/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func main() {
212212
},
213213
cli.StringSliceFlag{
214214
Name: "allow-insecure-entitlement",
215-
Usage: "allows insecure entitlements e.g. network.host, security.insecure",
215+
Usage: "allows insecure entitlements e.g. network.host, security.insecure, device",
216216
},
217217
cli.StringFlag{
218218
Name: "otel-socket-path",
@@ -378,6 +378,8 @@ func main() {
378378
cfg.Entitlements = append(cfg.Entitlements, e)
379379
case "network.host":
380380
cfg.Entitlements = append(cfg.Entitlements, e)
381+
case "device":
382+
cfg.Entitlements = append(cfg.Entitlements, e)
381383
default:
382384
return errors.Errorf("invalid entitlement : %s", e)
383385
}

docs/buildkitd.toml.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ trace = true
2020
# root is where all buildkit state is stored.
2121
root = "/var/lib/buildkit"
2222
# insecure-entitlements allows insecure entitlements, disabled by default.
23-
insecure-entitlements = [ "network.host", "security.insecure" ]
23+
insecure-entitlements = [ "network.host", "security.insecure", "device" ]
2424

2525
[log]
2626
# log formatter: json or text

docs/reference/buildctl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ OPTIONS:
7373
--export-cache value Export build cache, e.g. --export-cache type=registry,ref=example.com/foo/bar, or --export-cache type=local,dest=path/to/dir
7474
--import-cache value Import build cache, e.g. --import-cache type=registry,ref=example.com/foo/bar, or --import-cache type=local,src=path/to/dir
7575
--secret value Secret value exposed to the build. Format id=secretname,src=filepath
76-
--allow value Allow extra privileged entitlement, e.g. network.host, security.insecure
76+
--allow value Allow extra privileged entitlement, e.g. network.host, security.insecure, device
7777
--ssh value Allow forwarding SSH agent or a raw Unix socket to the builder. Format default|<id>[=<socket>[,raw=false]|<key>[,<key>]]
7878
--metadata-file value Output build metadata (e.g., image digest) to a file as JSON
7979
--source-policy-file value Read source policy file from a JSON file

0 commit comments

Comments
 (0)