Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/jordan-wright/unindexed

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/jordan-wright/unindexed

  • v0.0.0-20181209214434-78fa79113c0f
  • Source
  • Go
  • Socket score

Version published
Created
Source

unindexed

Go Report Card GoDoc TravisCI

A Golang HTTP FileSystem that disables directory indexing.

Motivation

By default, the http.Dir filesystem has directory indexing enabled. For example, let's say you have a .git/ folder at the root of the folder you're serving. If someone were to request your_url/.git/, the contents of the folder would be listed.

This package disables directory indexing, preventing the contents from being listed.

Installation

go get -u github.com/jordan-wright/unindexed

Usage

The easiest way to use unindexed is as a drop-in replacement for http.Dir, which is commonly used to serve static files.

Here's a simple example using the gorilla/mux router:

package main

import (
	"log"
	"net/http"

	"github.com/gorilla/mux"
	"github.com/jordan-wright/unindexed"
)

func main() {
	router := mux.NewRouter()
	router.PathPrefix("/").Handler(http.FileServer(unindexed.Dir("../static")))
	log.Fatal(http.ListenAndServe(":8080", router))
}

Other examples can be found in the examples/ directory.

FAQs

Package last updated on 09 Dec 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc