Conceptos generales de seguridad
Por qu茅 Ciberseguridad para Desarrollo Web
No estamos seguros
Autorizaci贸n Autenticaci贸n y Accountability : AAA
Funciona en mi local
Empecemos por la l贸gica
SQL Injection
De local a producci贸n
Introducci贸n a DevSecOps
DevSecOps como cultura
Creando pipelines
Corriendo nuestras pruebas
Listas de control de privilegios
Seguridad en la arquitectura
Dise帽ando la arquitectura
Infraestructura como c贸digo
Creando la infraestructura
Creando roles y policies
Desplegando funciones lambda
El mundo de la Base de Datos
Conectando lambdas a una VPC
Single point of failure
Evitando vulnerabilidades en el c贸digo
Configurando Auth0
Creando un lambda Authorizer
Secretos y API Keys
Creando Endpoints
Evitando Cross Site Scripting o XSS
Validando la integridad de los datos con tokens
Controles de seguridad sobre datos
Conociendo la naturaleza de los datos
Protege tus datos con Key Management Services
Monitoring y alertas
Sistema de logs
Observabilidad
Alertas y Postmortems
CORS y cierre
Errores de CORS
You don't have access to this class
Keep learning! Join and start boosting your career
If you're looking to automate your tests and ensure the quality of your code on an ongoing basis, GitHub Actions is an ideal tool for integrating automated tests into your workflow. Here's how to incorporate GitHub Actions into a Go project, from initial setup to automatically running tests when you push.
When working with Go, it is common to face problems with dependencies, especially if you change branches or remove dependencies without updating the corresponding files. To solve these problems, ensure that dependencies are correctly synchronized by using certain commands:
Update dependency collection:
go mod tidy
This command updates the dependencies in go.mod
and go.sum
.
Update the vendor directory:
go mod vendor
Gathers dependencies and places them in the vendor
directory.
Resolve inconsistencies:
go mod verify
Verify dependency hashes to avoid inconsistencies.
To start running tests with GitHub Actions, first create a dummy test in Go. Follow these steps:
Create a test file:
Create a file called main_test.go
at the same level as your main package main
. Your test might look like this:
package main
import ( "testing" "github.com/stretchr/testify/require")
func TestDummy(t *testing.T) { result := 42 // expected value require.Equal(t, 42, result, "The result should be 42")}
Add test dependencies:
Install the require
dependency from the testify
package if you haven't already done so:
go get github.com/stretchr/testify/requirego mod tidy
Setting up GitHub Actions requires creating YAML files that define the workflows. Here's how to do it so that it runs every time you do a push:
Create required directories:
In the root of your repository, create a hidden directory called .github
, and inside it, another one called workflows
.
Create workflow configuration file:
Inside workflows
, create a validate-test.yaml
file with the following content:
name: Test Workflow
on: push: branches: - '*'
jobs: code-validation: runs-on: ubuntu-22.04
steps: - name: Checkout code uses: actions/checkout@v4
- name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.18
- name: Install dependencies run: go mod vendor working-directory: github-tracker
- name: Run tests run: go test ./... working-directory: github-tracker
Once the workflow is configured, upload it to your repository. GitHub Actions will start running the automated tests every time you push to any branch. This not only automates the testing process, but also helps ensure that every code change is automatically validated before merging with the rest of the project.
This guide has given you a basic approach to start automating tests in Go using GitHub Actions. Continuing to learn and experiment is key to mastering the full potential of automations in modern development.
Contributions 2
Questions 0
Want to see more contributions, questions and answers from the community?