openfds

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package openfds contains support code for the security.OpenFDs test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpFDs

func DumpFDs(ctx context.Context, path string) error

DumpFDs outputs the current file descriptor status into a file at path.

func Expect

func Expect(ctx context.Context, s *testing.State, allowDirs bool, p *process.Process, es []Expectation)

Expect tests the file types and file modes of the opened files for the given Chrome process p. allowDirs should be true if open directories are allowed. es is a list of expected file modes. Please see also the comment of Expectation for details.

Types

type Expectation

type Expectation struct {
	// Regex pattern to be matched with the opened file.
	// This is full-string match pattern.
	PathPattern string

	// List of possible permissions of the symlink under /proc/{PID}/fd/*
	// Note: The "mode" on the link tells us if the file is opened for
	// read/write. We are more interested in that than the permissions of
	// the file on the fs.
	Modes []uint32
	// contains filtered or unexported fields
}

Expectation represents expected path and file mode for file descriptors in a process. PathPattern is the string rather than regexp.Regexp, in order to avoid verbose expectation data list in the test.

Jump to

Keyboard shortcuts

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