Skip to content

glsec

GitHub stars sarif GitHub release (latest SemVer) GitHub last commit GitHub commit activity GitHub contributors

Community plugin: Plugins are maintained by their community authors, not by the MegaLinter team. Using a plugin means trusting its author. This plugin is maintained by Nicolai Ehrhardt: report its problems on its repository, not to MegaLinter.

Static security linter for GitLab CI/CD configuration files (GITLAB_GLSEC)

⚠️ Required items are missing in this plugin (native mode): see MegaLinter checks.

glsec is a static security linter for GitLab CI/CD configuration. It finds script injection through user-controlled CI variables, unpinned images, includes and CI/CD Catalog components, leaked secrets, and other pipeline misconfigurations. Findings map to the OWASP Top 10 CI/CD Security Risks and CWE.

It runs offline and needs no GitLab API token.

glsec documentation

glsec - GitHub

Configuration in MegaLinter

Variable Description Default value
GITLAB_GLSEC_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
GITLAB_GLSEC_COMMAND_REMOVE_ARGUMENTS User custom arguments to remove from command line before calling the linter
Ex: -s --foo "bar"
GITLAB_GLSEC_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src\|lib)
Exclude no file
GITLAB_GLSEC_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test\|examples)
Exclude no file
GITLAB_GLSEC_CLI_LINT_MODE Override default CLI lint mode
- file: Calls the linter for each file
- list_of_files: Call the linter with the list of files as argument
list_of_files
GITLAB_GLSEC_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
Exclude every file
GITLAB_GLSEC_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files
Ex: ["Dockerfile(-.+)?", "Jenkinsfile"]
["\\.gitlab-ci\\.ya?ml", ".+\\.gitlab-ci\\.ya?ml"]
GITLAB_GLSEC_PRE_COMMANDS List of bash commands to run before the linter None
GITLAB_GLSEC_POST_COMMANDS List of bash commands to run after the linter None
GITLAB_GLSEC_UNSECURED_ENV_VARIABLES List of env variables explicitly not filtered before calling GITLAB_GLSEC and its pre/post commands None
GITLAB_GLSEC_DISABLE_ERRORS Run linter but consider errors as warnings false
GITLAB_GLSEC_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0
GITLAB_GLSEC_TIMEOUT_SECONDS Maximum duration in seconds of the linter run, after which the linter process and its child processes are killed and reported as an error (exit code 124). Overrides LINTER_TIMEOUT_SECONDS. 0 disables the timeout 300
GITLAB_GLSEC_CLI_EXECUTABLE Override CLI executable ['glsec']

Use this plugin

Add the descriptor URL of the plugin to PLUGINS in .mega-linter.yml. MegaLinter installs the plugin when it starts, whatever the flavor:

PLUGINS:
  - https://raw.githubusercontent.com/glsec/glsec/main/mega-linter-plugin-glsec/glsec.megalinter-descriptor.yml

Behind the scenes

How are identified applicable files

  • File names (regex): \.gitlab-ci\.ya?ml, .+\.gitlab-ci\.ya?ml

How the linting is performed

  • glsec is called once with the list of files as arguments (list_of_files CLI lint mode)

Example calls

glsec .gitlab-ci.yml
glsec .gitlab-ci.yml deploy.gitlab-ci.yml

Installation in Docker

MegaLinter runs these commands when it loads the plugin (only RUN instructions):

RUN GLSEC_VERSION=1.29.0 && \
    case "$(uname -m)" in x86_64|amd64) GLSEC_ARCH=amd64 ;; aarch64|arm64) GLSEC_ARCH=arm64 ;; *) echo "glsec: unsupported architecture $(uname -m)" >&2 && exit 1 ;; esac && \
    GLSEC_ASSET="glsec_${GLSEC_VERSION}_linux_${GLSEC_ARCH}.tar.gz" && \
    GLSEC_URL="https://github.com/glsec/glsec/releases/download/v${GLSEC_VERSION}" && \
    GLSEC_TMP="$(mktemp -d)" && \
    wget -qO "${GLSEC_TMP}/${GLSEC_ASSET}" "${GLSEC_URL}/${GLSEC_ASSET}" && \
    wget -qO "${GLSEC_TMP}/checksums.txt" "${GLSEC_URL}/checksums.txt" && \
    awk -v f="${GLSEC_ASSET}" '$2 == f' "${GLSEC_TMP}/checksums.txt" > "${GLSEC_TMP}/sum" && \
    test -s "${GLSEC_TMP}/sum" && \
    (cd "${GLSEC_TMP}" && sha256sum -c sum) && \
    tar -xzf "${GLSEC_TMP}/${GLSEC_ASSET}" -C "${GLSEC_TMP}" glsec && \
    install -m 0755 "${GLSEC_TMP}/glsec" /usr/local/bin/glsec && \
    rm -rf "${GLSEC_TMP}"

Installation without Docker (native mode)

Native mode does not run plugins yet: this section shows what the plugin declares for native mode.

Not available: see the MegaLinter checks of the plugin.

MegaLinter checks

These results last changed on 2026-11-28, and MegaLinter checks the plugins every day. The checks only look at the descriptor of the plugin: they do not review the plugin, nor the tool it runs.

Check Result
Descriptor ⚠️ Incomplete
Native mode ❌ Not supported
SARIF output ✅
Native lock ⚠️ No lock shipped by the plugin author

Required

Missing required items:

  • native_install declared and valid for the 5 native platforms (GITLAB_GLSEC): Native mode (MegaLinter without Docker) can not install the linter. Declare native_install, listing each of linux/amd64, linux/arm64, darwin/amd64, darwin/arm64 and windows/amd64 in platforms or in unsupported (with a reason)

Missing recommended items:

  • Native lock shipped next to the descriptor (<name>.megalinter-native-lock.json), for verified native installs
  • Ignore file documentation URL (linter_rules_ignore_config_url) (GITLAB_GLSEC)
  • Speed (linter_speed, 1 to 5) (GITLAB_GLSEC)
  • Icon (linter_icon_png_url) (GITLAB_GLSEC)
  • IDE extensions (ide) (GITLAB_GLSEC)
  • Default configuration file (config_file_name) (GITLAB_GLSEC)
  • Test fixtures (test_folder) (GITLAB_GLSEC)

Plugin authors

The requirements and how to fix them are described in Create your own plugin.

Comments