@@ -83,6 +83,8 @@ type link struct {
83
83
ExpiresAt time.Time `json:"expires_at,omitempty"`
84
84
}
85
85
86
+ var oidRegExp = regexp .MustCompile (`^[A-Fa-f0-9]+$` )
87
+
86
88
// ObjectOidHandler is the main request routing entry point into LFS server functions
87
89
func ObjectOidHandler (ctx * context.Context ) {
88
90
@@ -217,6 +219,12 @@ func PostHandler(ctx *context.Context) {
217
219
218
220
if ! authenticate (ctx , repository , rv .Authorization , true ) {
219
221
requireAuth (ctx )
222
+ return
223
+ }
224
+
225
+ if ! oidRegExp .MatchString (rv .Oid ) {
226
+ writeStatus (ctx , 404 )
227
+ return
220
228
}
221
229
222
230
meta , err := models .NewLFSMetaObject (& models.LFSMetaObject {Oid : rv .Oid , Size : rv .Size , RepositoryID : repository .ID })
@@ -284,10 +292,12 @@ func BatchHandler(ctx *context.Context) {
284
292
continue
285
293
}
286
294
287
- // Object is not found
288
- meta , err = models .NewLFSMetaObject (& models.LFSMetaObject {Oid : object .Oid , Size : object .Size , RepositoryID : repository .ID })
289
- if err == nil {
290
- responseObjects = append (responseObjects , Represent (object , meta , meta .Existing , ! contentStore .Exists (meta )))
295
+ if oidRegExp .MatchString (object .Oid ) {
296
+ // Object is not found
297
+ meta , err = models .NewLFSMetaObject (& models.LFSMetaObject {Oid : object .Oid , Size : object .Size , RepositoryID : repository .ID })
298
+ if err == nil {
299
+ responseObjects = append (responseObjects , Represent (object , meta , meta .Existing , ! contentStore .Exists (meta )))
300
+ }
291
301
}
292
302
}
293
303
0 commit comments