Code Monkey home page Code Monkey logo

Comments (5)

mholt avatar mholt commented on August 31, 2024

Which global map are you talking about, exactly?

from go-aws-auth.

justonia avatar justonia commented on August 31, 2024

awsauth.go: awsSignVersion has a mutex that protects it in the sign v3/v4 functions.

from go-aws-auth.

mholt avatar mholt commented on August 31, 2024

Ah, I see what you're talking about. The mutex doesn't protect that map, it protects the Keys variable. The Keys variable may be mutated on any call to any of the Sign functions. If your program has concurrent calls to Sign, there could be trouble.

Before locking this library into 1.0, I think we'll look for a better way to manage credentials.

from go-aws-auth.

justonia avatar justonia commented on August 31, 2024

Then I'm not sure that mutex is doing what you think. If I provide credentials that the chooseKeys function picks, holding that mutex does nothing to protect against the credentials being changed in some goroutine outside the context of your signing functions. If you are trying to protect against that specific case, you would need to stick a mutex on each credentials object and lock access there.

That said, as a user of the library I would be fine if the credentials struct was readonly once created and if I wanted new credentials (from say, an IAM or config file change) then it would be my responsibility to provide a new credentials struct instance and not modify an existing one that could be in-use -- or it would be my responsibility to mutex protect calls to any functions using them.

from go-aws-auth.

mdwhatcott avatar mdwhatcott commented on August 31, 2024

According to my reading of the code, the mutex was protecting a package-level (exported) Keys variable, which has since been removed. Let me know if I've unknowingly done something rash...

from go-aws-auth.

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.