Skip to content

feat: support # comments in allowed-endpoints input#668

Open
vincentayorinde wants to merge 1 commit into
step-security:mainfrom
vincentayorinde:feat/support-comments-in-allowed-endpoints
Open

feat: support # comments in allowed-endpoints input#668
vincentayorinde wants to merge 1 commit into
step-security:mainfrom
vincentayorinde:feat/support-comments-in-allowed-endpoints

Conversation

@vincentayorinde

Copy link
Copy Markdown

Fixes #199

What

Users can now add # comment lines in the allowed-endpoints input to document why each endpoint is needed.

Example

- uses: step-security/harden-runner@v2
  with:
    egress-policy: block
    allowed-endpoints: |
      api.github.com:443
      # needed for npm install
      registry.npmjs.org:443
      # needed for pip
      pypi.org:443

Changes

  • src/utils.ts — added stripEndpointComments() helper that filters # comment and blank lines
  • src/setup.ts — wraps allowed-endpoints input with stripEndpointComments()
  • src/utils.test.ts — 4 new tests covering comments, blank lines, empty input, all-comment input

Fixes step-security#199

Users can now add comment lines starting with # in the
allowed-endpoints input to document why each endpoint is needed.

Example:
  allowed-endpoints: |
    api.github.com:443
    # needed for npm install
    registry.npmjs.org:443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support comments in allowed endpoints

1 participant