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

Silent Failure on Incorrect Certificate and Delayed put #1338

Open
gustavcorpas opened this issue Oct 19, 2023 · 1 comment
Open

Silent Failure on Incorrect Certificate and Delayed put #1338

gustavcorpas opened this issue Oct 19, 2023 · 1 comment

Comments

@gustavcorpas
Copy link

Description

I've encountered an issue where subsequent calls to put break if a wrong certificate is passed in. The issue is observed when there's a delay between calls, causing both node.put and user.put to silently fail.

Steps to Reproduce

  1. Setup an authenticated user with gun.user().
  2. Generate a new key pair with SEA.pair().
  3. Get a node from the pub-key of the pair.
  4. Pass in a wrong certificate to node.put.
  5. Wait for one second.
  6. Call user.put.

Expected result

  • Passing in a wrong certificate should yield an error in the ack for node.put.
  • Calling user.put should put data on the graph.

Actual result

  • Passing in a wrong certificate silently fails for node.put.
  • Calling user.put silently fails.

Noteworthy

Example code:

           (async () => {

                // ... user is an authenticated gun.user().

                const pair1 = await SEA.pair();
                const node = gun.get(`~${pair1.pub}`);
                
                node.get("public").map().once(res => console.log(res));
                user.get("public").map().once(res => console.log(res));

                const options = { opt: { cert: "this-is-not-a-valid-certificate" }};

                node.get("public").get("item").put("node says hello", (ack) => {
                    console.log(ack);
                }, options);

                console.log(options); // this is mutated btw.

                await delay(); // wait for one second.

                user.get("public").get("item").put("user says hello", (ack) => {
                    console.log(ack)
                });   

            })();
@amark
Copy link
Owner

amark commented Nov 8, 2023

Thanks for finding this and making an excellent issue + code to add to tests. IDK my timing to get to it, but if you want to help I can do a video call to get you started on debugging (DM me).

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

No branches or pull requests

2 participants