The Zuri Core is an open-source API that serves as the backend and backbone of Zuri Chat

ZC_CORE Go Reference

Zuri Chat Core Api

See the docs for everything: Zuri Chat Documentation

GitHub repo size

Description

The Zuri Chat Core (ZC_Core) is an open source API that serves as the backend and backbone of Zuri Chat - an open source slack clone developed during the HNG8 internship program

Zuri Chat implements a plug-in system that allows for much more functionality because different plugins can be developed by different creators. These plugins can then rest on the Zuri Chat Core backbone (ZC_Core) which is written in Golang

Language

ZC_Core was written in Go because it is a fast, compiled language and it is easily scaled. Concurrency in Go is also ideal for implementing a plugin structure. This makes it easy to build on the project and allows for future expansion.

API Documentation

A list of the endpoints and the functions they implement can be found here detailing information about the all API resources.

Getting Started

This is an example of how you can setup your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

  1. Go 1.16 or lastest version already installed on your local machine.
  2. MongoDB

Installation

  1. Run an instance of MongoDB
$ mongod
  1. Create and populate a .env file with its keys corresponding values as listed in example.env
  2. Run zc_core from project root directory
$ cd /path/to/zc_core
$ go run main.go

Testing

  1. Lint checks are done with golangci-lint - an aggregator of linters
$ cd /path/to/zc_core
$ golangci-lint run --timeout 2m
  1. Automated unit and integration tests done with golang's builtin testing package.
$ go test -v ./...  -cover

Features

  • Blog: Content management package for the CRUD of blog posts and associated services
  • Contact: Service to process all user-related inquiries, complaints, and service-related suggestions
  • Data: Data management for plugins
  • Docs: OpenAPI specification for all resources
  • External: Desktop application download, email subscriptions, etc...
  • Marketplace: Plugins marketplace
  • Messaging: Realtime messaging service with SocketIO
  • Organizations: Organization management system
  • Plugin: Plugin management system
  • Realtime Communication (RTC): Connection authentication, subcription and pulishing service with centrifugo proxy server
  • Report: Report generation and viewing service
  • Services: Mail and file upload service package
  • Users: User management system
  • Utils: Utility package of shared helper functions and data types

Contributing

Pull requests are welcome from the zc_core_main team. Please review the issues created before making a pull request or create an issue if the issue you solve is not already listed.

  1. Fork/Clone the Project
  2. Create your Feature Branch (git checkout -b [branch name])
  3. Lint your Changes (golangci-lint run --timeout 2m)
  4. Commit your Changes (git commit -m "Added some amazing features")
  5. Push to the Branch (git push origin [branch name])
  6. Open a Pull Request
Owner
Zuri Chat
An open source, very flexible group communication tool
Zuri Chat
Comments
  • [SECURITY] Registration confirmation code exposed on response

    [SECURITY] Registration confirmation code exposed on response

    A request to create a user on the /users endpoint returns a verification code on the response.
    This makes email verification pretty useless at the moment as I can register with any email account and get verified easily.

    https://github.com/zurichat/zc_core/blob/6d57d932a43d253c6bd46f308a1f669d416e3de5/user/user.go#L97-L99

  • Feat- implelented Agora token generator for Agora engine authentication

    Feat- implelented Agora token generator for Agora engine authentication

    -Created an end point to generate Agora RTC token base on users

    • Channelname *role *tokenType *uid
    • Fixed token expiration of 2 hours
    • Endpoint = {{url}}/rtc/{channelName}/{role}/{tokentype}/{uid}/
    • role = "publisher" or "subscriber" string
    • tokentype = "userAccount" or "uid" string
    • uid= integer
    • channelName = string
  • Auth: As a user, I should be able to register

    Auth: As a user, I should be able to register

    PR - https://github.com/zurichat/zc_core/pull/188

    Slack - HOD

    Link - https://api.zuri.chat/users/6133d00e0366b6816a0b75c1

    The link shows the details of a user created successfully

    Another test link which I worked on is a form that accepts details and implements the create user logic is https://api.zuri.chat/usersform from PR - https://github.com/zurichat/zc_core/pull/238 but not currently live. It has been merged but my team (Newton) is currently experiencing problems with auto deployment probably due to the dev branch we introduced again.

  • Blog features

    Blog features

    Updated the blog workflow backend @DavidHODs @Aminujb @UfiairENE

    • Modified the models.go folder to add new models for likes and comments. Separated likes and comments into different collections to minimize data sent to the client
    • Modified the create blog function to allow creation of like and comments documents whilst creating a new blog
    • Implemented the like function. User can like and unlike using the same endpoint. If user hasn't liked, we like, store the userId in the blog document in the bloglikes collection and increment the like count by 1. Else, the userId is removed from the document and the like count is decremented
    • Implemented the comment function. User can comment. We store the comment in the blog document in the blogcomments collection and increment the comment count by 1
    • Created a function to estimate reading time in minutes of a blog post
    • Added a Generic update method in utils/db.go to allow generic updates like array increment, object field setting etc.

    Some of the changes are increases in whitespace caused by code editor formatting Haven't used authentication of routes yet, need to know admin role and authentication of admin

  • Auth check for valid token #234

    Auth check for valid token #234

    Endpoints that require authentication should not allow a user to access them without a valid token that was provided by the login endpoint. the middleware checks the token against the secret key and signing algorithm. issue #234 /v1/welcome is protected so you need an authorization token to access it.

  • created user registration handler

    created user registration handler

    I created a handler for the auth/register endpoint. It creates a MongoDB doc for "Users". Let me know if there are any corrections or additions to be made. Issue #114

  • Auth: As a User, i should be able to login with magic link

    Auth: As a User, i should be able to login with magic link

    I should be able to login without a password, only email address

    Payload:

    • organisation id
    • email address

    Flow:

    • Check if user email exists
    • Generate a auto_login token with user information e.g email, organisation id, user id
    • Send magic link to user email address

    Endpoint: api.zuri.chat/auth/:organisation_id/login

  • Fix/multiple file upload wrong response issue

    Fix/multiple file upload wrong response issue

    Issue description

    The multiple file upload endpoint returns all previously uploaded files as a part of the response for the current upload.

    Fix

    The issue was a package level variable that was been used every time a user uploads a file, on subsequent uploads, the same variable contains the state of the previous uploads, the fix is to make the variable local. I also fixed the successful empty upload bug, an invalid filter query (checking for a field that does not exist in the user struct), make server name configurable and some minor refactoring of the err variable.

  • CVE-2021-43565 (High) detected in golang.org/x/crypto-v0.0.0-20210921155107-089bfa567519 - autoclosed

    CVE-2021-43565 (High) detected in golang.org/x/crypto-v0.0.0-20210921155107-089bfa567519 - autoclosed

    CVE-2021-43565 - High Severity Vulnerability

    Vulnerable Library - golang.org/x/crypto-v0.0.0-20210921155107-089bfa567519

    [mirror] Go supplementary cryptography libraries

    Library home page: https://proxy.golang.org/golang.org/x/crypto/@v/v0.0.0-20210921155107-089bfa567519.zip

    Dependency Hierarchy:

    • :x: golang.org/x/crypto-v0.0.0-20210921155107-089bfa567519 (Vulnerable Library)

    Found in HEAD commit: 296953fdf7b1766daf9ff2839a0e0a7b0d3f371e

    Found in base branch: dev

    Vulnerability Details

    The x/crypto/ssh package before 0.0.0-20211202192323-5770296d904e of golang.org/x/crypto allows an attacker to panic an SSH server.

    Publish Date: 2022-09-06

    URL: CVE-2021-43565

    CVSS 3 Score Details (7.5)

    Base Score Metrics:

    • Exploitability Metrics:
      • Attack Vector: Network
      • Attack Complexity: Low
      • Privileges Required: None
      • User Interaction: None
      • Scope: Unchanged
    • Impact Metrics:
      • Confidentiality Impact: None
      • Integrity Impact: None
      • Availability Impact: High

    For more information on CVSS3 Scores, click here.

    Suggested Fix

    Type: Upgrade version

    Origin: https://nvd.nist.gov/vuln/detail/CVE-2021-43565

    Release Date: 2021-11-10

    Fix Resolution: golang-golang-x-crypto-dev - 1:0.0~git20211202.5770296-1;golang-go.crypto-dev - 1:0.0~git20211202.5770296-1


    Step up your Open Source Security Game with Mend here

  • CVE-2022-27191 (High) detected in golang.org/x/crypto-v0.0.0-20210921155107-089bfa567519 - autoclosed

    CVE-2022-27191 (High) detected in golang.org/x/crypto-v0.0.0-20210921155107-089bfa567519 - autoclosed

    CVE-2022-27191 - High Severity Vulnerability

    Vulnerable Library - golang.org/x/crypto-v0.0.0-20210921155107-089bfa567519

    [mirror] Go supplementary cryptography libraries

    Library home page: https://proxy.golang.org/golang.org/x/crypto/@v/v0.0.0-20210921155107-089bfa567519.zip

    Dependency Hierarchy:

    • :x: golang.org/x/crypto-v0.0.0-20210921155107-089bfa567519 (Vulnerable Library)

    Found in HEAD commit: 296953fdf7b1766daf9ff2839a0e0a7b0d3f371e

    Found in base branch: dev

    Vulnerability Details

    The golang.org/x/crypto/ssh package before 0.0.0-20220314234659-1baeb1ce4c0b for Go allows an attacker to crash a server in certain circumstances involving AddHostKey.

    Publish Date: 2022-03-18

    URL: CVE-2022-27191

    CVSS 3 Score Details (7.5)

    Base Score Metrics:

    • Exploitability Metrics:
      • Attack Vector: Network
      • Attack Complexity: Low
      • Privileges Required: None
      • User Interaction: None
      • Scope: Unchanged
    • Impact Metrics:
      • Confidentiality Impact: None
      • Integrity Impact: None
      • Availability Impact: High

    For more information on CVSS3 Scores, click here.

    Suggested Fix

    Type: Upgrade version

    Origin: https://nvd.nist.gov/vuln/detail/CVE-2022-27191

    Release Date: 2022-03-18

    Fix Resolution: golang-golang-x-crypto-dev - 1:0.0~git20220315.3147a52-1;golang-go.crypto-dev - 1:0.0~git20220315.3147a52-1


    Step up your Open Source Security Game with Mend here

  • CVE-2022-32149 (High) detected in golang.org/x/text-v0.3.7 - autoclosed

    CVE-2022-32149 (High) detected in golang.org/x/text-v0.3.7 - autoclosed

    CVE-2022-32149 - High Severity Vulnerability

    Vulnerable Library - golang.org/x/text-v0.3.7

    Library home page: https://proxy.golang.org/golang.org/x/text/@v/v0.3.7.zip

    Dependency Hierarchy:

    • github.com/spf13/VIPER-v1.9.0 (Root Library)
      • github.com/spf13/aferO-v1.6.0
        • :x: golang.org/x/text-v0.3.7 (Vulnerable Library)

    Found in HEAD commit: 296953fdf7b1766daf9ff2839a0e0a7b0d3f371e

    Found in base branch: dev

    Vulnerability Details

    An attacker may cause a denial of service by crafting an Accept-Language header which ParseAcceptLanguage will take significant time to parse.

    Publish Date: 2022-10-14

    URL: CVE-2022-32149

    CVSS 3 Score Details (7.5)

    Base Score Metrics:

    • Exploitability Metrics:
      • Attack Vector: Network
      • Attack Complexity: Low
      • Privileges Required: None
      • User Interaction: None
      • Scope: Unchanged
    • Impact Metrics:
      • Confidentiality Impact: None
      • Integrity Impact: None
      • Availability Impact: High

    For more information on CVSS3 Scores, click here.

    Suggested Fix

    Type: Upgrade version

    Origin: https://www.cve.org/CVERecord?id=CVE-2022-32149

    Release Date: 2022-10-14

    Fix Resolution: v0.3.8


    Step up your Open Source Security Game with Mend here

  • ZURI TASK: SHORTEN URLS

    ZURI TASK: SHORTEN URLS

    • Zuri Task
    • Shorten the Url to slugs instead
    • Organisations slugs have '-org'
    • User's Id have -users there

    Now you can find by Users. The system checks if the Id contains -org or a - then handles the request based on the output.

    Still in Testing, can’t test because we don’t have access to the full system or the DB.

  • CVE-2022-37315 (High) detected in github.com/graphql-go/graphql-v0.8.0

    CVE-2022-37315 (High) detected in github.com/graphql-go/graphql-v0.8.0

    CVE-2022-37315 - High Severity Vulnerability

    Vulnerable Library - github.com/graphql-go/graphql-v0.8.0

    An implementation of GraphQL for Go / Golang

    Library home page: https://proxy.golang.org/github.com/graphql-go/graphql/@v/v0.8.0.zip

    Dependency Hierarchy:

    • :x: github.com/graphql-go/graphql-v0.8.0 (Vulnerable Library)

    Found in HEAD commit: 296953fdf7b1766daf9ff2839a0e0a7b0d3f371e

    Found in base branch: dev

    Vulnerability Details

    graphql-go (aka GraphQL for Go) through 0.8.0 has infinite recursion in the type definition parser.

    Publish Date: 2022-08-01

    URL: CVE-2022-37315

    CVSS 3 Score Details (7.5)

    Base Score Metrics:

    • Exploitability Metrics:
      • Attack Vector: Network
      • Attack Complexity: Low
      • Privileges Required: None
      • User Interaction: None
      • Scope: Unchanged
    • Impact Metrics:
      • Confidentiality Impact: None
      • Integrity Impact: None
      • Availability Impact: High

    For more information on CVSS3 Scores, click here.


    Step up your Open Source Security Game with Mend here

  • Re-activate account after deactivated on re-create.

    Re-activate account after deactivated on re-create.

    Hi, I noticed that if u delete an account on zuri.chat, it's not actually deleted.

    You can't signup again using that account because it already exists and when you try to login, u get a not verified error.

    So when the account is trying to recreate it should reactivate it and not have verification problem or even reverify it

Flagr is an open source Go service that delivers the right experience to the right entity and monitors the impact.
Flagr is an open source Go service that delivers the right experience to the right entity and monitors the impact.

Flagr is an open source Go service that delivers the right experience to the right entity and monitors the impact. It provides feature flags, experimentation (A/B testing), and dynamic configuration. It has clear swagger REST APIs for flags management and flag evaluation.

Dec 25, 2022
RoadRunner: an open-source high-performance PHP application server, load balancer, and process manager
RoadRunner: an open-source high-performance PHP application server, load balancer, and process manager

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a serv

Jan 13, 2022
⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

Oct 27, 2022
An open-source, on-prem feature flag solution
An open-source, on-prem feature flag solution

An open-source, on-prem feature flag solution Documentation | Features | Values | Examples | Enterprise Flipt is an open source, on-prem feature flag

Dec 24, 2022
CasaOS - A simple, easy-to-use, elegant open-source home server system.
CasaOS - A simple, easy-to-use, elegant open-source home server system.

CasaOS - A simple, easy-to-use, elegant open-source home server system. CasaOS is an open-source home server system based on the Docker ecosystem and

Jan 8, 2023
Go package for the BeagleBone open source hardware

go-beaglebone Go package for the BeagleBone open source hardware Also check out https://github.com/SpaceLeap/go-embedded This package builds on top of

Jul 6, 2019
A feature flag solution, with only a YAML file in the backend (S3, GitHub, HTTP, local file ...), no server to install, just add a file in a central system and refer to it. 🎛️
A feature flag solution, with only a YAML file in the backend (S3, GitHub, HTTP, local file ...), no server to install, just add a file in a central system and refer to it. 🎛️

??️ go-feature-flag A feature flag solution, with YAML file in the backend (S3, GitHub, HTTP, local file ...). No server to install, just add a file i

Dec 29, 2022
Formrecevr is a simple and lightweight from receiver backend primarily designed for (but not limited to) static websites.

Formrecevr Formrecevr (pronunced "Form receiver") is a simple and lightweight from receiver backend primarily designed for (but not limited to) static

Apr 17, 2022
Web server for running Brainfuck on the backend

Brainfuck Web Server Web server for running Brainfuck on the backend Run go run . <brainfuck file> The server will start on port 8080 by default. You

Oct 25, 2021
Backend for Workery application server implemented in Golang

workery-server Backend for Workery application server implemented in Golang. This is a rewrite of the workery-django project. Development Goals: Rewri

Dec 14, 2022
Open platform to collect and prioritize product feedback
Open platform to collect and prioritize product feedback

Fider A platform to collect and organize customer feedback. Let your customers share, vote and discuss on suggestions they have to make your product e

Jan 1, 2023
Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.
Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.

Teal.Finance/Server Opinionated boilerplate HTTP server with CORS, OPA, Prometheus, rate-limiter… for API and static website. Origin This library was

Nov 3, 2022
Heart 💜A high performance Lua web server with a simple, powerful API
Heart 💜A high performance Lua web server with a simple, powerful API

Heart ?? A high performance Lua web server with a simple, powerful API. See the full documentation here. Overview Heart combines Go's fasthttp with Lu

Aug 31, 2022
Simple Golang Product API Server

Simple Golang Product API Server Layanan API untuk menambah, merubah informasi, mengambil data dan menghapus produk. Implementasi kode terinspirasi ol

Nov 20, 2022
A simple server with REST API to keep track of your TODOs (with html interface).
A simple server with REST API to keep track of your TODOs (with html interface).

TODOserver A simple server written in GO using gin and gorm. Getting started Download the repository docker build -t todoserver . docker run -p 8888:8

Nov 10, 2021
ready-to-use RTSP / RTMP server and proxy that allows to read, publish and proxy video and audio streams
ready-to-use RTSP / RTMP server and proxy that allows to read, publish and proxy video and audio streams

rtsp-simple-server is a simple, ready-to-use and zero-dependency RTSP / RTMP server and proxy, a software that allows users to publish, read and proxy live video and audio streams. RTSP is a specification that describes how to perform these operations with the help of a server, that is contacted by both publishers and readers and relays the publisher's streams to the readers.

Dec 31, 2022
Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support - S3, Google Cloud Storage, Azure Blob

SFTPGo Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support, written in Go. Several storage backends are supporte

Jan 9, 2023
RBTI Golang Server uses PostgreSQL and for its main database and uses Elasticsearch

RBTI Golang Server This server is used for my thesis project, it uses PostgreSQL and for its main database and uses Elasticsearch for faster query spe

Jan 17, 2022