Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/askaroe/social-media-api
The Social Media API provides endpoints for managing users, posts, and comments in a social media platform.
To get started with using the Social Media API, follow the steps below:
Clone the repository:
git clone <repository-url>
Install dependencies:
go mod tidy
Build the project:
go build
The API can be configured using environment variables or command-line flags. Available configurations are:
PORT
: Port on which the server will listen. Default is 8081
.ENV
: Environment mode (development
, staging
, or production
). Default is development
.DB_DSN
: PostgreSQL database connection string.Run the server using the following command:
go run .
The following endpoints are available in the API:
POST /api/v1/register
: Register a new user.GET /api/v1/users
: Get all users.GET /api/v1/users/{userId}
: Get a user by ID.PUT /api/v1/users/{userId}
: Update a user by ID.DELETE /api/v1/users/{userId}
: Delete a user by ID.POST /api/v1/posts
: Create a new post.GET /api/v1/posts/{postId}
: Get a post by ID.PUT /api/v1/posts/{postId}
: Update a post by ID.DELETE /api/v1/posts/{postId}
: Delete a post by ID.POST /api/v1/comments
: Create a new comment.GET /api/v1/comments/{commentId}
: Get a comment by ID.PUT /api/v1/comments/{commentId}
: Update a comment by ID.DELETE /api/v1/comments/{commentId}
: Delete a comment by ID.The API follows standard HTTP status codes for indicating the success or failure of a request. Error responses include appropriate error messages to help troubleshoot issues.
Authentication is not implemented in this version of the API. All endpoints are accessible without authentication.
Password hashing
Table user {
id bigserial [pk]
createdAt timestamp
updatedAt timestamp
profilePhoto text
name text
username text
description text
email text
password text
}
Table post {
id bigserial [pk]
createdAt timestamp
updatedAt timestamp
image text
caption text
userId bigserial
}
Table comment {
id bigserial [pk]
createdAt timestamp
updatedAt timestamp
message text
userId bigserial
postId bigserial
}
Ref: post.userId < user.id
Ref: comment.userId < user.id
Ref: comment.postId < post.id
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.