You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
5.8 KiB

Git LFS support v2 (#122) * Import github.com/git-lfs/lfs-test-server as lfs module base Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198 Removed: Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go .dockerignore .gitignore README.md * Remove config, add JWT support from github.com/mgit-at/lfs-test-server Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83 * Add LFS settings * Add LFS meta object model * Add LFS routes and initialization * Import github.com/dgrijalva/jwt-go into vendor/ * Adapt LFS module: handlers, routing, meta store * Move LFS routes to /user/repo/info/lfs/* * Add request header checks to LFS BatchHandler / PostHandler * Implement LFS basic authentication * Rework JWT secret generation / load * Implement LFS SSH token authentication with JWT Specification: https://github.com/github/git-lfs/tree/master/docs/api * Integrate LFS settings into install process * Remove LFS objects when repository is deleted Only removes objects from content store when deleted repo is the only referencing repository * Make LFS module stateless Fixes bug where LFS would not work after installation without restarting Gitea * Change 500 'Internal Server Error' to 400 'Bad Request' * Change sql query to xorm call * Remove unneeded type from LFS module * Change internal imports to code.gitea.io/gitea/ * Add Gitea authors copyright * Change basic auth realm to "gitea-lfs" * Add unique indexes to LFS model * Use xorm count function in LFS check on repository delete * Return io.ReadCloser from content store and close after usage * Add LFS info to runWeb() * Export LFS content store base path * LFS file download from UI * Work around git-lfs client issue with unauthenticated requests Returning a dummy Authorization header for unauthenticated requests lets git-lfs client skip asking for auth credentials See: https://github.com/github/git-lfs/issues/1088 * Fix unauthenticated UI downloads from public repositories * Authentication check order, Finish LFS file view logic * Ignore LFS hooks if installed for current OS user Fixes Gitea UI actions for repositories tracking LFS files. Checks for minimum needed git version by parsing the semantic version string. * Hide LFS metafile diff from commit view, marking as binary * Show LFS notice if file in commit view is tracked * Add notbefore/nbf JWT claim * Correct lint suggestions - comments for structs and functions - Add comments to LFS model - Function comment for GetRandomBytesAsBase64 - LFS server function comments and lint variable suggestion * Move secret generation code out of conditional Ensures no LFS code may run with an empty secret * Do not hand out JWT tokens if LFS server support is disabled
8 years ago
  1. ## `jwt-go` Version History
  2. #### 3.0.0
  3. * **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code
  4. * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods.
  5. * `ParseFromRequest` has been moved to `request` subpackage and usage has changed
  6. * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims.
  7. * Other Additions and Changes
  8. * Added `Claims` interface type to allow users to decode the claims into a custom type
  9. * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into.
  10. * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage
  11. * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims`
  12. * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`.
  13. * Added several new, more specific, validation errors to error type bitmask
  14. * Moved examples from README to executable example files
  15. * Signing method registry is now thread safe
  16. * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser)
  17. #### 2.7.0
  18. This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes.
  19. * Added new option `-show` to the `jwt` command that will just output the decoded token without verifying
  20. * Error text for expired tokens includes how long it's been expired
  21. * Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM`
  22. * Documentation updates
  23. #### 2.6.0
  24. * Exposed inner error within ValidationError
  25. * Fixed validation errors when using UseJSONNumber flag
  26. * Added several unit tests
  27. #### 2.5.0
  28. * Added support for signing method none. You shouldn't use this. The API tries to make this clear.
  29. * Updated/fixed some documentation
  30. * Added more helpful error message when trying to parse tokens that begin with `BEARER `
  31. #### 2.4.0
  32. * Added new type, Parser, to allow for configuration of various parsing parameters
  33. * You can now specify a list of valid signing methods. Anything outside this set will be rejected.
  34. * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON
  35. * Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go)
  36. * Fixed some bugs with ECDSA parsing
  37. #### 2.3.0
  38. * Added support for ECDSA signing methods
  39. * Added support for RSA PSS signing methods (requires go v1.4)
  40. #### 2.2.0
  41. * Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic.
  42. #### 2.1.0
  43. Backwards compatible API change that was missed in 2.0.0.
  44. * The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte`
  45. #### 2.0.0
  46. There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change.
  47. The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`.
  48. It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`.
  49. * **Compatibility Breaking Changes**
  50. * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct`
  51. * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct`
  52. * `KeyFunc` now returns `interface{}` instead of `[]byte`
  53. * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key
  54. * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key
  55. * Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type.
  56. * Added public package global `SigningMethodHS256`
  57. * Added public package global `SigningMethodHS384`
  58. * Added public package global `SigningMethodHS512`
  59. * Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type.
  60. * Added public package global `SigningMethodRS256`
  61. * Added public package global `SigningMethodRS384`
  62. * Added public package global `SigningMethodRS512`
  63. * Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged.
  64. * Refactored the RSA implementation to be easier to read
  65. * Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM`
  66. #### 1.0.2
  67. * Fixed bug in parsing public keys from certificates
  68. * Added more tests around the parsing of keys for RS256
  69. * Code refactoring in RS256 implementation. No functional changes
  70. #### 1.0.1
  71. * Fixed panic if RS256 signing method was passed an invalid key
  72. #### 1.0.0
  73. * First versioned release
  74. * API stabilized
  75. * Supports creating, signing, parsing, and validating JWT tokens
  76. * Supports RS256 and HS256 signing methods