Git Product home page Git Product logo

Comments (3)

System25 avatar System25 commented on July 22, 2024

Hi Alfonso,
Control Center admin users are limited to lower case letters and numbers:
https://github.com/gecos-team/gecoscc-ui/blob/master/gecoscc/models.py

class LowerAlphaNumeric(object):
err_msg = _('Only lowercase letters or numbers')
regex = re.compile(r'^([a-z]|[0-9])*$')
def call(self, node, value):
if not self.regex.match(value):
node.raise_invalid(self.err_msg)

Chef usernames are sanitized by replacing the dots by underscores:
https://github.com/chef/chef-server-webui/blob/master/app/models/user.rb

def name=(n)
@name = n.gsub(/./, '_')
end

Also Chef saves the user via the REST API so the username must create a proper URI, so it must be limited to [ ALPHA / DIGIT / "-" / "_" / "~" ]

Maybe the sanitize function must force the username to match the following regular expression: [A-Za-z0-9-_~]

Do you think that "admin usernames " and "workstation usernames" must be sanitized by using this regular expression?

from gecoscc-ui.

alfem avatar alfem commented on July 22, 2024

Yes, it looks a pretty straight forward solution, although I think that regexp must be implemented in our Control Center before saving/retrieving admin useres to/from Chef.

from gecoscc-ui.

System25 avatar System25 commented on July 22, 2024

Testing with different usernames in the Chef Server administration area I noticed that the usernames must be in lower case and the "~" characters also is forbidden.
To the final regular expression to match is [a-z0-9-_]

from gecoscc-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.