Giter VIP home page Giter VIP logo

Comments (5)

jasonkuhrt avatar jasonkuhrt commented on May 27, 2024

Can you share the exact error that you encountered?

A good place to start looking into would be:

async function publish(manType: PackageManagerType, input: { version: string; tag: string }): Promise<void> {

from dripip.

jasonkuhrt avatar jasonkuhrt commented on May 27, 2024

To help work on this I've enabled npm 2fa for publishing on my account. Here is the error I now get:

$ dripip preview
    Error: The following command failed to complete successfully:

            yarn publish --tag next --no-git-tag-version --new-version 0.10.1-next.1

        It ended with this exit code:

            1

        This underlying error occured (null = none occured):

            null

        It received signal (null = no signal received):

            null

        It output on stderr (null = not spawned in pipe mode):

            error Couldn't publish package: "Can't answer a question unless a user TTY"


        It output on stdout (null = not spawned in pipe mode):

Not sure yet but guessing some possible solutions:

  1. Forward tty to spawn and let user deal with it directly
  2. Present own prompt and forward passed value
  3. In addition to above: Accept new flag where user can pass 2fa info
  4. In addition to above: Accept new config where 2fa info will be read from (but I don't think this is how 2fa works, its based on transient codes sent to secondary devices... so this doesn't seem like a viable option for anything?)

-- edit

Re 3: I think a flag is weird for OTP, it has to be an interactive thing, flag gives little value over prompt

Re 4: Yep doesn't make sense, too transient.

from dripip.

jasonkuhrt avatar jasonkuhrt commented on May 27, 2024

With 2fa enabled here is the login flow:

❯ npm login                  
Username: dripip-2fa
Password: 
Email: (this IS public) [email protected]
Enter one-time password from your authenticator app: 437488
Logged in as dripip-2fa on https://registry.npmjs.org/.

from dripip.

jasonkuhrt avatar jasonkuhrt commented on May 27, 2024

Some official info here https://docs.npmjs.com/about-two-factor-authentication

from dripip.

jasonkuhrt avatar jasonkuhrt commented on May 27, 2024

With 2fa enabled here is the publish flow:

❯ npm publish
npm notice 
npm notice 📦  [email protected]
npm notice === Tarball Contents === 
npm notice 0    index.js    
npm notice 255B package.json
npm notice === Tarball Details === 
npm notice name:          dripip-system-tests                     
npm notice version:       0.0.0-test.2fa.2                        
npm notice package size:  300 B                                   
npm notice unpacked size: 255 B                                   
npm notice shasum:        450fcb9886ffba6c2d33d756c438ee946bd400a9
npm notice integrity:     sha512-JuIEwOxVr3CBl[...]Ynz4oHpiq7fPA==
npm notice total files:   2                                       
npm notice 
This operation requires a one-time password.
Enter OTP: 352695
+ [email protected]

My conclusion is that when 2fa is enabled we should forward the tty to the user.

I don't think this 2fa flow is designed for CI workflows. There is no tty in CI.

Since the OTP is ephemeral, this isn't something that could really ever be stored as an environment variable.

Therefore bringing 2fa support to dripip is about support its manual use by users, rather than unblocking any issues in CI.

I think when we resolve this issue we need to qualify what we mean when we say we support 2fa.

I also think this feature isn't a top priority since CI publishing is a best practice and what dripip is designed for first.

Still manual publishing is an important escape hatch. And I think it feels uncomfortable to use a tool that won't let you go manual if ever you need to.

from dripip.

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.