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

Undefined services causes exception #1757

Open
marcus-pousette opened this issue May 15, 2023 · 4 comments · Fixed by #1778 · May be fixed by #2133
Open

Undefined services causes exception #1757

marcus-pousette opened this issue May 15, 2023 · 4 comments · Fixed by #1778 · May be fixed by #2133
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@marcus-pousette
Copy link
Contributor

marcus-pousette commented May 15, 2023

  • Version:
    0.45.0

Severity:

Low

Description:

Creating a libp2p instance with services that are undefined creates a null pointer exception even if it is allowed by the types

createLibp2p({
...,
    services: {
         abc: undefined
    }
})

To mitigate this I think there needs to be a null check before this

const service: any = createService(this.components)

to check if createService is a function.

I ended up with this error because I am generating different configs based on conditions, and this leads me to assign "undefined" to services relay occasionally

@marcus-pousette marcus-pousette added the need/triage Needs initial labeling and prioritization label May 15, 2023
@achingbrain
Copy link
Member

Related: #1573

@maschad maschad added kind/bug A bug in existing code (including security flaws) and removed need/triage Needs initial labeling and prioritization labels Sep 12, 2023
@achingbrain achingbrain linked a pull request Oct 6, 2023 that will close this issue
@achingbrain achingbrain reopened this Oct 6, 2023
@achingbrain
Copy link
Member

achingbrain commented Oct 6, 2023

A runtime check seems reasonable but this really shouldn't be allowed by the types.

@dhuseby
Copy link
Contributor

dhuseby commented Apr 30, 2024

Will be closed by #2133 when that lands.

@SgtPooki
Copy link
Member

JS Colo 2024 discussion

still waiting on config validation PR..

no new updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
5 participants