Skip to content

Commit eb77382

Browse files
committed
Add no-new-privileges to SecurityOptions returned by /info
Signed-off-by: Albin Kerouanton <[email protected]>
1 parent 3d0bdfa commit eb77382

5 files changed

Lines changed: 16 additions & 1 deletion

File tree

api/swagger.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5243,7 +5243,8 @@ definitions:
52435243
SecurityOptions:
52445244
description: |
52455245
List of security features that are enabled on the daemon, such as
5246-
apparmor, seccomp, SELinux, user-namespaces (userns), and rootless.
5246+
apparmor, seccomp, SELinux, user-namespaces (userns), rootless and
5247+
no-new-privileges.
52475248
52485249
Additional configuration options for each security feature may
52495250
be present, and are included as a comma-separated list of key/value

daemon/info.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ func (daemon *Daemon) fillSecurityOptions(v *types.Info, sysInfo *sysinfo.SysInf
170170
if daemon.cgroupNamespacesEnabled(sysInfo) {
171171
securityOptions = append(securityOptions, "name=cgroupns")
172172
}
173+
if daemon.noNewPrivileges() {
174+
securityOptions = append(securityOptions, "name=no-new-privileges")
175+
}
173176

174177
v.SecurityOptions = securityOptions
175178
}

daemon/info_unix.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,7 @@ func (daemon *Daemon) cgroupNamespacesEnabled(sysInfo *sysinfo.SysInfo) bool {
366366
func (daemon *Daemon) Rootless() bool {
367367
return daemon.configStore.Rootless
368368
}
369+
370+
func (daemon *Daemon) noNewPrivileges() bool {
371+
return daemon.configStore.NoNewPrivileges
372+
}

daemon/info_windows.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ func (daemon *Daemon) cgroupNamespacesEnabled(sysInfo *sysinfo.SysInfo) bool {
2222
func (daemon *Daemon) Rootless() bool {
2323
return false
2424
}
25+
26+
func (daemon *Daemon) noNewPrivileges() bool {
27+
return false
28+
}

docs/api/version-history.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ keywords: "API, Docker, rcli, REST, documentation"
2323
* `GET /images/json` no longer includes hardcoded `<none>:<none>` and
2424
`<none>@<none>` in `RepoTags` and`RepoDigests` for untagged images.
2525
In such cases, empty arrays will be produced instead.
26+
* `GET /info` now includes `no-new-privileges` in the `SecurityOptions` string
27+
list when this option is enabled globally. This change is not versioned, and
28+
affects all API versions if the daemon has this patch.
2629

2730
## v1.42 API changes
2831

0 commit comments

Comments
 (0)