integrity

package
v0.0.0-...-646b7d3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package integrity constitutes the 'Validation and Integrity library'. It is called by the allDB package.

This package's responsibility is to run code which verifies that every change to the database will result in a valid state. A state is valid if it can be rolled back to the previous state or moved forward into a new state AND Polyapp's code is capable of transporting and operating on it safely. The 'state' of a database object is its current contents. The ability to move between states can only take the form of read, create, update, delete, and deprecate operations. Polyapp's code is capable of transporting and operating on the objects safely if the object will not break any of the underlying databases and will not break any of the languages used in the layers below this one. An example of 'breaking the database' would be SQL injection or rejected set operations.

This package is very important because you may successfully write code which sets a document in the Firestore database but that same code would not work in the IDB database or in Elasticsearch or in the file system. If the database is saved to conditionally you might not realize your mistake until the code has already been deployed.

This package is also very important for security.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackPopulate

func BackPopulate(data *common.Data) error

BackPopulate pulls the Schema of this Data and if there are any blank fields in Data it populates them with zero values. This is very useful to ensure the Data in the database is fully populated, which is required by some functions like TaskGoalEvaluate.

func Convert

func Convert(data *common.Data) error

Convert from common.Data in the format of "SchemaID" to the format of the schema's master Schema.

func ValidFirestoreFieldName

func ValidFirestoreFieldName(key string) string

ValidFirestoreFieldName returns "" if a key will be valid; a string which can be shown to the user otherwise

func ValidateAllDBs

func ValidateAllDBs(queryable common.Queryable) error

ValidateAllDBs validates many objects will not break the underlying databases this data will be stored in to.

func ValidateElasticsearch

func ValidateElasticsearch(simplified map[string]interface{}) error

ValidateElasticsearch ensures the information being stored in Elasticsearch will not break the storage medium.

Source: https://www.elastic.co/guide/en/elasticsearch/reference/current/general-recommendations.html Documents must not be > 100MB or 25_000_000 unicode characters, however they should be much smaller than that usually.

elasticsearch limit is 512 bytes for document IDs https://discuss.elastic.co/t/maximum-length-of-a-specified-document-id/4262/3 4 bytes per string character; 512 / 4 = 128. We will reserve len("polyapp")*4 = 28 bytes in every key. Therefore our maximum ID size is ~99. But right now IDs are randomly generated so that should not be a problem.

func ValidateElasticsearchKey

func ValidateElasticsearchKey(k string) error

ValidateElasticsearchKey returns an error if the key provided is invalid or unsafe.

func ValidateFile

func ValidateFile(simplified map[string]interface{}) error

ValidateFile ensures the information being stored in files will not break the storage medium.

func ValidateFirestore

func ValidateFirestore(simplified map[string]interface{}) error

ValidateFirestore ensures the information being stored in Firestore will not break the database.

func ValidateIndexedDB

func ValidateIndexedDB(simplified map[string]interface{}) error

ValidateIndexedDBData ensures simplified data will not break the IndexedDB database.

func ValidateLanguages

func ValidateLanguages(queryable common.Queryable) error

ValidateLanguages ensures the change to the schema will not break any of the underlying languages where a 'language' is Go or SQL.

func ValidatePolyapp

func ValidatePolyapp(m map[string]interface{}) error

ValidatePolyapp ensures Polyapp's storage format is not being compromised by the data being stored.

func ValidatePolyappKey

func ValidatePolyappKey(k string) error

ValidatePolyappKey ensures a key k with a prefix "_ind_dom_sch_key" or "ind_dom_sch_key" or without a prefix like "key" does not contain restricted characters which would break Polyapp's client-side or server-side code.

This should be 2 different functions - one which is for prefixed keys and one which is not. But it isn't.

func ValidatePostgres

func ValidatePostgres(simplified map[string]interface{}) error

ValidatePostgres ensures that field names can be encoded as column names by our code and that those column names will be valid.

func ValidateSerialization

func ValidateSerialization(simplified map[string]interface{}) error

ValidateSerialization ensures all of the serialization schemes Polyapp uses can tolerate the input data structure That means JSON and Google's Protobuf. More information: https://owasp.org/www-project-top-ten/OWASP_Top_Ten_2017/Top_10-2017_A8-Insecure_Deserialization This function is substantially similar to the ValidateFile function.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL