Skip to content

[App] Certain app names cause issues #69

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

Closed
jsayol opened this issue Jun 19, 2017 · 2 comments
Closed

[App] Certain app names cause issues #69

jsayol opened this issue Jun 19, 2017 · 2 comments

Comments

@jsayol
Copy link
Contributor

jsayol commented Jun 19, 2017

[REQUIRED] Describe your environment

  • Operating System version: Linux
  • Firebase SDK version: 4.1.2
  • Firebase Product: app

[REQUIRED] Describe the problem

Using the name of any Object.prototype member as an app name causes issues when trying to initialize or retrieve an app.

Steps to reproduce:

// Here we get an error saying there already is a "valueOf" app
try {
  firebase.initializeApp(options, 'valueOf');
} catch (err) {
  console.error(err.code + ' - ' + err.message);
}

// This simply returns the Object.prototype.toString method
const app = firebase.app('toString');
console.log(app);

Relevant Code:

JSBin reproducing these issues: http://jsbin.com/cohijesema/edit?js,console

@google-oss-bot
Copy link
Contributor

Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight.

@jsayol
Copy link
Contributor Author

jsayol commented Jun 19, 2017

I see 2 possible approaches to address this:

  1. Allow any app name, like it's supposed to work now, and modify any relevant code to support this.
  2. Disallow using the name of any Object.prototype member as an app name by introducing any relevant checks. firebase.initializeApp() would throw an app/bad-app-name error and firebase.app() would throw an app/no-app error.

Personally, I strongly prefer the first option. There's no reason why toString shouldn't be an allowed app name.

Thoughts?

@jsayol jsayol closed this as completed Jun 20, 2017
@firebase firebase locked and limited conversation to collaborators Oct 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants