Giter Club home page Giter Club logo

Comments (5)

deanishe avatar deanishe commented on July 28, 2024

Thanks for reporting the problem. Unfortunately, it's not a simple one to fix.

I just replaced -w by the -g option in workflow.py
This makes the error disappear.
However, the workflow isn't still working (although it works the first time, it crashes later on), as other authentication errors show up. It is close to work though.

It makes that error disappear, but it causes the other authentication errors. I'm afraid it's not actually close to working :(

Replacing -w with -g doesn't work because they do different things. -w, where available, outputs only the password, whereas -g outputs the entire entry for the Keychain item in some odd format:

$ security add-generic-password -s net.deanishe.alfred-pinboard -a pinboard_api_key3 -w 'This is a test'

$ security find-generic-password -s net.deanishe.alfred-pinboard -a pinboard_api_key3 -w
This is a test

$ security find-generic-password -s net.deanishe.alfred-pinboard -a pinboard_api_key3 -g
keychain: "/Volumes/Users/daj/Library/Keychains/login.keychain"
class: "genp"
attributes:
    0x00000007 <blob>="net.deanishe.alfred-pinboard"
    0x00000008 <blob>=<NULL>
    "acct"<blob>="pinboard_api_key3"
    "cdat"<timedate>=0x32303134303832343130353033345A00  "20140824105034Z\000"
    "crtr"<uint32>=<NULL>
    "cusi"<sint32>=<NULL>
    "desc"<blob>=<NULL>
    "gena"<blob>=<NULL>
    "icmt"<blob>=<NULL>
    "invi"<sint32>=<NULL>
    "mdat"<timedate>=0x32303134303832343130353033345A00  "20140824105034Z\000"
    "nega"<sint32>=<NULL>
    "prot"<blob>=<NULL>
    "scrp"<sint32>=<NULL>
    "svce"<blob>="net.deanishe.alfred-pinboard"
    "type"<uint32>=<NULL>
password: "This is a test"

So the output from -g requires parsing. Things also get a lot more complicated if there is a backslash or non-ASCII character in your password:

$ security add-generic-password -s net.deanishe.alfred-pinboard -a pinboard_api_key2 -w 'This " is a \test"'

$ security find-generic-password -s net.deanishe.alfred-pinboard -a pinboard_api_key2 -w
This " is a \test"

$ security find-generic-password -s net.deanishe.alfred-pinboard -a pinboard_api_key2 -g
keychain: "/Volumes/Users/daj/Library/Keychains/login.keychain"
class: "genp"
…
…
password: 0x5468697320222069732061205C7465737422  "This " is a \134test""

$ security add-generic-password -s net.deanishe.alfred-pinboard -a pinboard_api_key2 -w 'This is a tüst'
keychain: "/Volumes/Users/daj/Library/Keychains/login.keychain"
class: "genp"
…
…
password: 0x5468697320697320612074C3BC7374  "This is a t\303\274st"

Notice that using -g in this case returns a different format with \xxx escapes in the output.

So it would be a lot more complicated to use the -g option instead of -w. There is another way to access Keychain using the Python–Objective-C bridge, but that doesn't help with the second problem:

I don't have a Lion machine to test it on: there might be other problems, too.

I'd be happy to accept a pull request implementing the change, but it's not one I can realistically do myself because I don't have anything older than Mavericks to test it on, and I don't want to spend hours re-implementing a feature for it to turn out to be still broken, just in a different way.

from alfred-workflow.

lendenmc avatar lendenmc commented on July 28, 2024

Thanks a lot for the detailed and clear explanations. Now I understands precisely why it didn't work and it seems daunting :). If I get the time, I will try to solve the problem on my local fork.

from alfred-workflow.

deanishe avatar deanishe commented on July 28, 2024

I'm closing this issue for now, but please feel free to reopen it if you come up with an idea of how to fix the problem: it's something I would like to work.

from alfred-workflow.

deanishe avatar deanishe commented on July 28, 2024

Should work in 0551765

from alfred-workflow.

lendenmc avatar lendenmc commented on July 28, 2024

Awesome job @deanishe, thanks a lot. It fixed the whole issue. I was able to test it on Lion with the above-mentioned alfred-workflow and now it makes it at least compatible with 10.7 and, I guess, 10.6 as well. Will likely make many others workflows work on 10.6 and above. Sweet !

from alfred-workflow.

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.