MCPcopy Create free account
hub / github.com/bytebase/bytebase / checkMongoDBRequestBlocked

Function checkMongoDBRequestBlocked

backend/api/v1/document_masking.go:789–804  ·  view source on GitHub ↗
(analysis *parserbase.MongoDBAnalysis)

Source from the content-addressed store, hash-verified

787}
788
789func checkMongoDBRequestBlocked(analysis *parserbase.MongoDBAnalysis) error {
790 if analysis == nil {
791 return nil
792 }
793 if analysis.API == parserbase.MongoDBMaskableAPIUnsupportedRead {
794 operation := analysis.Operation
795 if operation == "" {
796 operation = "unknown"
797 }
798 if analysis.UnsupportedStage != "" {
799 return errors.Errorf("MongoDB aggregate() with stage %q on collection %q is not supported for dynamic masking. Supported operations are find(), findOne(), and aggregate() with shape-preserving stages only", analysis.UnsupportedStage, analysis.Collection)
800 }
801 return errors.Errorf("MongoDB operation %q on collection %q is not supported for dynamic masking in this release. Supported operations are find() and findOne()", operation+"()", analysis.Collection)
802 }
803 return nil
804}
805
806// injectJoinedSchemas adds array-of-objects schemas for each $lookup/$graphLookup join
807// into the source objectSchema so masking covers the joined field.

Callers 2

Calls 1

ErrorfMethod · 0.80

Tested by 1