Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: process.user.username is implementation-defined on Windows #760

Closed
wants to merge 1 commit into from

Conversation

wking
Copy link
Contributor

@wking wking commented Apr 7, 2017

On POSIX (currently Linux and Solaris), uid and gid are required. My preferred approach here is to make those optional and use platform defaults:

If unset, the runtime will not attempt to manipulate the user ID (e.g. not calling setuid(2) or similar).

But the maintainer consensus is that they want those to be explicitly required properties.

The Windows username, on the other hand, is optional, although the default behavior is unclear. I see no discussion in #565 to suggest whether this was intentionally approved or not. And in #618 (where I asked about the inconsistency), @crosbymichael said:

No, both should be made explicit unless there is something on windows that prohibits this.

So this commit is making that happen.

Pinging some Windows folks for review of the “unless there is something on windows that prohibits this” condition: @jhowardmsft, @RobDolinMS, @jstarks.

Note that there is also a JSON Schema PR for username in flight with #703, but that is orthogonal to this change (the JSON Schema cannot require username even if the field is REQUIRED on Windows, because it is not required, or even specified, on other OSes).

Fixes #618.

@lowenna
Copy link
Contributor

lowenna commented Apr 7, 2017

Does NOT LGTM. This absolutely IS an optional field on Windows.

@wking
Copy link
Contributor Author

wking commented Apr 7, 2017 via email

@lowenna
Copy link
Contributor

lowenna commented Apr 7, 2017

image

And with an explicitly added user
image

Feel free to clarify. But this PR does not LGTM. And no, it's not inherited at all.

@wking
Copy link
Contributor Author

wking commented Apr 7, 2017

And no, it's not inherited at all.

So which of the following would make more sense in the spec.

If unset, username defaults to ContainerAdministrator.

or

The default username is implementation-defined.

?

@lowenna
Copy link
Contributor

lowenna commented Apr 24, 2017

I would prefer The default username is implementation-defined.

On POSIX (currently Linux and Solaris), `uid` and `gid` are
required. My preferred approach here is to make those optional and use
platform defaults [1,2]:

    If unset, the runtime will not attempt to manipulate the user ID
    (e.g. not calling setuid(2) or similar).

But the maintainer consensus is that they want those to be
explicitly required properties [3,4,5].

The Windows `username`, on the other hand, was optional, although the
default behavior is unclear.  I see no discussion in f9e48e0
(Windows: User struct changes, 2016-09-14, opencontainers#565) or its pull-request
discussion to suggest whether this was intentionally approved or not.
When I asked whether the optional-ness was intentional, Michael said
[6]:

  No, both should be made explicit unless there is something on
  windows that prohibits this.

However, when I filed a pull request to make the property required,
John pushed back [7] and prefered implementation-defined default
behavior.  I'm still not clear if that satisfies Michael's "prohibits"
condition, but having optional user values is closer to my personal
preference than requiring the property, and John seems to be fairly
strongly against requiring the property, so this commit documents the
default value to make the OPTIONAL-ness useful.

I've also added the property to the JSON Schema for validation.  The
empty-string bit follows wording from 'annotations', and avoids
ambiguity with the non-pointer Go property.  I doubt empty-string
usernames would work, and having the restriction in the spec allows
for us to validate this in runtime-tools (vs. passing validation and
then failing to launch a container when the runtime chokes on the
empty string).

[1]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/DWdystx5X3A
[2]: opencontainers#417 (comment)
     Subject: Exposing platform defaults
     Date: Thu, 14 Jan 2016 15:36:26 -0800
     Message-ID: <20160114233625.GN6362@odin.tremily.us>
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-04-17.00.log.html#l-44
[4]: opencontainers#417 (comment)
[5]: opencontainers#417 (comment)
[6]: opencontainers#618 (comment)
[7]: opencontainers#760 (comment)
[8]: opencontainers#760 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking wking force-pushed the require-username branch from 4e3945f to a3ef036 Compare April 24, 2017 16:53
@wking wking changed the title config: Require process.user.username on Windows config: process.user.username is implementation-defined on Windows Apr 24, 2017
@wking
Copy link
Contributor Author

wking commented Apr 24, 2017 via email

@crosbymichael
Copy link
Member

Closing based on feedback from the windows team

@wking
Copy link
Contributor Author

wking commented May 9, 2017

Closing based on feedback from the windows team

What feedback from the Windows team? The current commit (a3ef036) has been endorsed by @jhowardmsft, who's the only Windows member involved in this PR. Without this PR, the property remains:

  • Undefined (as in nasal demons) when someone takes advantage of the OPTIONAL-ness and leaves the property unset. With this PR that use-case would be implementation-defined.
  • Unchecked in the JSON Schema. With this PR, we'd validate that the value was a string.

And as I said earlier, I'm fine dropping the new “but not the empty string” requirement if anyone has issues with it.

@wking
Copy link
Contributor Author

wking commented May 10, 2017

Since the pivot from REQUIRED to OPTIONAL, the JSON Schema change in this PR mostly matches that which just landed in #703. So the only remaining features of this PR (which I think we still want) are:

  • Making the default username implementation-defined (it is currently undefined).
  • Forbidding empty-string usernames (although I'm fine dropping this if Windows somehow supports empty-string usernames).

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.

3 participants