Giter VIP home page Giter VIP logo

hackage-security's Issues

Use hackage-security library to extract `.cabal` files from the index

  • Use library to extract .cabal files (and verify signatures once we introduce author signing; until that time this is just an optimization).
  • Avoid creation of the cabal-specific tar index in favour of the index created by hackage-security (though note that the latter does not contain any information about preferred-versions). This should speed up cabal update.
  • Once cabal-install only access the index through the security library, rename 00-index.tar and co to 01-index.tar (unless we can about older cabal's access?)

Allow for finer control over which mirror is selected

Currently we hardcode the order in which we try the mirrors as: the mirrors from the cabal config file in order, and then the mirrors from the TUF mirrors list, in order.

Should use a service like http://freegeoip.net/json/ ; the client asks about their own ip address to get a broad region, and then orders mirrors in that region above others.

Policies and protocols for dealing with private keys

This should document things such as

  • Bootstrapping
  • Key thresholds
  • How many keys we have of each type
  • Key validity (expiry time)
  • Implications for key compromise
  • Who holds keys, and how should they store them.

Be smarter about dealing with out-of-order cache updates

If a cache happens to have, say, an older snapshot than it has a timestamp, a client downloading from this cache will see a security validation error. This is not a problem per se because we will anyway just try again (and on the retry we will provide Cache-Control: max-age=0); however, we can be a little bit smarter here and catch this error before the security checks see it, possibly by taking advantage of Last-Modified.

Implement mirroring tool

Since the local repo may actually live on a SSH mounted file system:

  • Make sure to deal with I/O errors correctly (existing code should already deal with this correctly, and try again n minutes later) -- Left the existing logic in place.
  • Make sure to use atomic file operations
  • Think about what the repo looks like when one file is changed but updating the next file fails.
  • For the RepoLocal case, do NOT read the index directly from the local repo (because that would be too slow -- because reading on every poll). Instead keep it in a cache (like we do for remote repos).
  • Still need to write the index to the repo though (but only on changes).
  • Once we are using hackage-security to download stuff from source repo, downloads should be small so can set polling frequency quite high (say, every 5 minutes). -- The polling frequency is not hardcoded into the mirror client, but the max polling frequency is, and was set to 30min. Reduced to 5min.
  • Make sure mirroring tool can deal with index containing TUF metadata (currently it tries to mirror each package twice)

Write repo spec

This should document:

  • Repository layout -- See RepoLayout and co
  • Order in which files are to be changed and updated
  • Which proxy hints should be provided (esp for 'dumb' file mirrors)
  • Specification of the index tarball (for instance, see commercialhaskell/all-cabal-files#8).

Put in file size estimates

We need to estimate the size of the timestamp and the size of the root information (in case we need to download it after a validation error).

Cache hints for the TUF files

We should add (the equivalent of?) Cache-Control: no-transform, but should also provide additional caching hints. Currently we don't provide any.

Deploy live secure mirror of the Hackage server

  • Avoid storing copies of all packages in the mirror-cache (this would require a lot of disk space)
  • No need to create the index/ directory with all .cabal files
  • When mirroring from a particular server, we probably don't want to look at other mirrors (in particular, ourselves!).

Decide on SHA package

  • Decide on SHA package -- Done, using cryptohash
  • Update hackage-security to use new package
  • In hackage-security we avoid loading files into memory -- separate ticket #134
  • Update hackage-server to use the new package -- separate ticket #135
  • In hackage-server we make sure these SHAs are fully evaluated -- separate ticket #136

Make `cabal-secure-beta` tarball available

  • which will have the right keys hardcoded in for testing purposes. If the binary is called cabal-secure-beta rather than cabal people can easily switch back and forth.
  • test with central server once security stuff is live.
  • Test it builds against packages releasd on Hackage
  • Mention cabal install in blogpost
  • Test with old-style Hackage URI

Two static snapshots for alpha testing

Having two means we can test mirroring.
Might even want to introduce some intentional errors.

The blog post describes what error we want to introduce; once these repos are set up, fix the blog post to point to the right locations (and remove the TODOs).

Make sure that all error messages that we report are sensible and readable

For instance, but not limited to, in-code TODOs

  • formatRecoverableException ("Can we do better than show for custom exceptions?" -- Yes, we can, but only for base 4.8 and up. See #82).
  • unexpectedUncompressedTar in checkForUpdates -- This case is eliminated a the type level instead. Yay! :)
  • describeFile for Targets -- describeFile is gone as part of dd2bbca
  • wrapCustomEx in hackage-security-HTTP -- We now wrap all exceptions in SomeRemoteError, and then deal with them generically.
  • wrapCustomEx in hackage-security-http-client (and the TODO in get) -- As above, opened separate ticket (#85) for the TODO in get.

Also,

  • If we only display the final verification exception (the one that is thrown up), it is important that this isn't just "verification loop".

Add cmd line arg option to pick repo layout

And then support both the current Hackage layout as well as the ideal Hackage layout. Test with the current hackage layout (we've so far been testing with the ideal layout instead).

Migration: Use heuristic for when migration is necessary

Currently we search the entire index for packages that we need to migrate, but we can take advantage of the fact that @dcoutts also introduced a separate change into to schema, which we can detect using single call. If we do all migrations at the same time, we don't need to do any searching.

Use subdirectory of local cache as temp directory.

Currently we use the system temp directory everywhere, which may not be what the user wants and moreover might cause trouble wherever we call renameFile. This affects the core library and hackage-security-local, as well as potentially any of the hackage-security-* HTTP libraries.

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.