Giter Club home page Giter Club logo

subdomain-blacklist's Introduction

Subdomain Blacklist

List of common words that your users shouldn't use when setting up accounts.

Build Status SensioLabsInsight HHVM Status

When your app or service allows users to access their accounts using subdomains, e.g. michaldudek.myapp.com, it is useful to block some words so they don't take away a subdomain you'd want to use in the future or worse, try to trick your other users into believing they represent you (e.g. legal.myapp.com or support.myapp.com).

Apart from the blacklist, the goal of this repository is to provide code in various languages that validates a username against the list.

Note that the goal of this library IS NOT to validate domain name. You still have to check whether or not the given username makes a valid subdomain.

Acknowledgement

The idea and the list was originally taken from Sandeep Shetty.

Spec

Implementation MUST have a method/function called validate which takes a single string argument.

The validate method/function MUST return a boolean value.

Before a string is validates it MUST be normalized. Normalization of the string MUST:

  • remove any suffixed digits,
  • change case to lowercase,
  • remove a single s character if the string ends with an s.

addToList

Implementation CAN contain addToList (or add_to_list if more appropriate for the language) method/function that will add other items to the blacklist.

addToList method/function MUST accept single string argument.

addToList method/function CAN accept an array of strings as a single argument.

Before a string item is added to the blacklist via addToList method/function the default blacklist MUST be loaded.

Before a string item is added to the blacklist it MUST be normalized with the rules above.

getList

Implementation CAN contain getList (or get_list if more appropriate for the language) method/function that will return the blacklist.

Using and Languages

For more information about how to use this list in your specific language, please refer to README.md file in the language's folder.

Currently supported:

  • php - more info - $ composer require michaldudek/subdomain-blacklist dev-master

Planned:

  • JavaScript (node.js)
  • JavaScript (browser)
  • Go
  • Ruby
  • Python

You are welcome to add support for other languages.

Contributing

At this moment pull requests with support for various languages are most welcome.

If you add a language support make sure to cover it with appropriate tests.

Also if you think some words should be added to the list either open an issue or do a PR.

If you are editing a code please make sure to adhere to common patterns and rules in that language.

See more in each languages specific README.md file in their appropriate directory.

subdomain-blacklist's People

Contributors

michaldudek avatar nickleus avatar

Watchers

 avatar

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.