小编Chr*_*ris的帖子

可以将 GitHub Secrets 与公共存储库一起使用吗?

我有一个带有 GitHub Action 的私有存储库,当有新的推送到主分支时,它会将代码推送到 AWS S3 存储桶。我需要一对访问密钥才能推送内容,我将它们存储为 GitHub Secrets 并将它们作为构建脚本中的环境变量进行引用。现在我想在不久的将来公开这个 repo,我想知道这样做是否安全。操作的工作流 (.github/workflows/main.yml) 本身确实是公开可见的,它的作用是什么,但它只有一个命令aws s3 cp myfile s3://my-bucket,代码本身绝对没有访问密钥。

将 GitHub Secrets 用于公共存储库中的操作是否安全?我是唯一的所有者和唯一的贡献者,这在未来不会改变。稍后我可能会使用 webhook 切换到 CodePipeline,但想先尝试 GitHub Actions。谢谢。

git github amazon-web-services github-actions

12
推荐指数
1
解决办法
3385
查看次数

CloudFormation::APIGateway 中的 AWS 和 AWS_PROXY 有什么区别?

带有 AWS::ApiGateway::Method - Integration:Type 和 Lambda 后端的 CloudFormation 模板之间AWS和其中的区别是什么AWS_PROXY?刚才我不断收到 502 错误,并意识到我需要使用非常特殊格式的 JSON 响应进行响应。当我从控制台创建 API 网关时,我从未遇到过这个问题。它现在确实有效,但我想知道潜在的差异,以便我可以学习。

这是 CF 模板中的部分:

VisitorCounterAPIGatewayRootMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      AuthorizationType: NONE
      HttpMethod: GET
      Integration:
        IntegrationHttpMethod: POST
        Type: AWS_PROXY #THIS is my question. AWS or AWS_PROXY?
        Uri: !Sub
          - arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${lambdaArn}/invocations
          - lambdaArn: !GetAtt VisitorCountLambda.Arn
      ResourceId: !GetAtt VisitorCounterAPIGateway.RootResourceId
      RestApiId: !Ref VisitorCounterAPIGateway
Run Code Online (Sandbox Code Playgroud)

这是我的 Lambda 函数 (Python3.7) 的响应代码:

apiResponse = {
    "isBase64Encoded": False,
    "statusCode": 200,
    "body": json.dumps({
        "visitorCount": int(float(response["Attributes"]["amount"]))
    })
}
Run Code Online (Sandbox Code Playgroud)

谢谢你。

amazon-web-services aws-cloudformation aws-lambda aws-api-gateway

3
推荐指数
1
解决办法
952
查看次数