Skip to content

Fix safeFilename function to hash input to prevent leaking sensitive data to filesystem #27

Open

Description

@panekj

Using uses: https://${{ secrets.USER }}:${{ secrets.PASS }}@host.tld/repo.git will leak credentials as plaintext to filesystem via actions cache

actionDir := fmt.Sprintf("%s/%s", sar.RunContext.ActionCacheDir(), safeFilename(sar.Step.Uses))

https://gitea.com/gitea/act/pulls/117/files
https://gitea.com/pj/act/commit/b6450c7f71210cf9988deae3a84d41efb28eae77

Activity

  1. ChristopherHX commented on Jan 28, 2025

    @ChristopherHX
    Contributor

    Yes I remember this gitea bug caused by a new feature, at the moment we are not expanding anything in uses and even throw an validation error here.

    Merging every gitea actions feature (like uses expansion) behind a feature-flag is ok for me as well.

    We can plan this in.

  2. panekj commented on Jan 28, 2025

    @panekj
    Author

    Yes I remember this gitea bug caused by a new feature, at the moment we are not expanding anything in uses and even throw an validation error here.

    Merging every gitea actions feature (like uses expansion) behind a feature-flag is ok for me as well.

    I've been absent for a very long time so I'm not exactly up to date with what is going in between gitea/forgejo/act. I'm fine with whatever is happening as long as it's fixed, both Gitea and Forgejo have implemented/are implementing my suggestion to hash the uses string and use that as name for cache.

  3. ChristopherHX commented on Jan 28, 2025

    @ChristopherHX
    Contributor

    BTW this is acts point of view, I will improve this error block later.

    Users of act requested schema validation, I implemented it.

    on: push
    jobs:
      _:
        runs-on: ubuntu-latest
        steps:
        - uses: https://${{ secrets.USER }}:${{ secrets.PASS }}@host.tld/repo.git
    INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock' 
    Error: workflow is not valid. 'w.yml': Line: 4 Column 5: Failed to match job-factory: Line: 6 Column 7: Failed to match run-step: Line: 6 Column 7: Unknown Property uses
    Line: 6 Column 7: Failed to match regular-step: Line: 6 Column 13: expressions are not allowed here
    Line: 6 Column 13: expressions are not allowed here
    Line: 4 Column 5: Failed to match workflow-job: Line: 4 Column 5: Unknown Property runs-on
    Line: 5 Column 5: Unknown Property steps
    

    while

    Line: 6 Column 13: expressions are not allowed here
    

    prevents this scenario.

    I'm not exactly up to date with what is going in between gitea/forgejo/act

    Yes this is true, gitea act being several months behind nektos/act as well.
    The error I posted above is included in a version past the last merge to gitea/act.

  4. ChristopherHX commented on Jan 28, 2025

    @ChristopherHX
    Contributor

    RE: https://gitea.com/gitea/act/issues/105#issuecomment-954905

    Possibility for forgejo context part of the proposal.

    Once the feature is enabled for this fork this field is going to be hashed, credentials stripped or valuemasker applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions