teleren/devto huggingface dataset:
Utilizar el menor privilegio en AWS IAM + Webs para validar tus políticas
Tags: aws, security, webdev, cloud
Published: 2023-05-17 21:39:22

TL;DR

**_Aplicando el menor privilegio en AWS IAM es fundamental para mantener la 🔑 seguridad de tu entorno de trabajo._**

---

_¿Qué es el principio de menor privilegio?_
> Dentro de AWS IAM (Identity and Access Management) se refiere a la práctica de otorgar a los usuarios y recursos solo los privilegios y permisos necesarios para realizar sus tareas específicas.

Es decir, dando permisos de lectura solamente a los usuarios/apps que lo necesiten, si otro usuario/app necesita un permiso de escritura debemos explícitamente indicarlo. 


En resumen ejecutando el principio de menor privilegio podrás:
✅ Reducir errores
✅ Cumplir con los requerimientos
✅ Tener un mayor control
✅ Facilitar la administración
✅ Escalar fácilmente 

---


## ¿No sabes como crear una condición basada en ARN?
Te dejo unas URL para que puedas ver como crear una condición basada en ARNs.
https://www.awsiamactions.io/

![Condiciones de policy basada en ARN](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pb9djxtw8ten79somj4j.png)



---


## ¿Qué ganamos al aplicar el menor principio de menor privilegio?

### 🔻 Seguridad: 
Reduces drásticamente las posibles violaciones a tu sistema, mitigando cualquier impacto posterior que pueda ocurrir. No debemos de confiar en la “buena fe” siempre debemos actuar con cautela ante usuarios malintencionados.


### 🔻 Normativas: 
Muchos estándares (cómo el PCI) requieren que otorgues la menor cantidad de privilegios en tus cargas de trabajo, por eso al hacerlo desde un principio ya estarás cumpliendo con ello.

### 🔻 Menos errores:
Bajas mucho la posibilidad que alguien haga algo que no tenía los permisos, como el caso de que escriban en una base de datos por ejemplo, así podríamos tener muchos casos. 


### 🔻 Control: 
Cuando damos los privilegios de forma segmentada, podemos saber en todo momento que/quien tiene acceso a qué, por lo que nos aseguramos de tener todo controlado.


### 🔻 Escalar:
En la nube todo es escalable, recordemos que puede ser hacía más o menos, por lo que podemos dar permisos o quitarlos de forma muy fácil. 

---

## Recuerda:
Cuando asignamos sólo los permisos necesarios para realizar tareas específicas, minimizas los riesgos y mantenemos un entorno seguro y protegido.

¿Qué herramienta utilizas en tu día a día?

---
¿Te gustaría que estemos en 📩 contacto?
Hector Fernandez, AWS Builder

![Hector Fernandez AWS Community Builder](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/akgtppo22zbrww2dcp0r.jpg)
Héctor Fernández
AWS Community Builder (Uruguay)
https://hector.builders/
Day 752 : Machine
Tags: hiphop, code, coding, lifelongdev
Published: 2023-05-17 21:31:39

_liner notes_:
- Professional : Whew! What a day. Spoke with the development team on the implementation details for a new feature. Helped out with a community question. Spent the rest of the day working on the slides for my next conference talk. I don't know why I make things more difficult for me. haha I'm getting there. I got a lot of the thoughts out of my brain and into a rough draft. Just need to build out the slides.

- Personal : Last night, I worked on the platform I made to use when I do talks. I think I got everything refactored to add the new functionality I want to use. It worked when I tried it out. haha It works on my machine. haha.

![View from top of a mountain in Himalaya, Nepal looking at other mountains at twilight.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5nsqga0yvn800erkub9m.jpg)

Going to continue knocking out these slides. I want to go through some tracks. Definitely want to take some time to watch some anime.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube EPYQISOcbWU %}
Problem 2:
Tags: projecteuler, beginners
Published: 2023-05-17 21:27:38

## Question:
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

## Solution 
function sumEvenFibonacci(limit) {
  let sum = 0;
  let fibPrev = 1;
  let fibCurr = 2;

  while (fibCurr <= limit) {
    if (fibCurr % 2 === 0) {
      sum += fibCurr;
    }
    let fibNext = fibPrev + fibCurr;
    fibPrev = fibCurr;
    fibCurr = fibNext;
  }

  return sum;
}

## Explanation
Define a function sumEvenFibonacci that takes a limit as an argument.initialize the variables sum to keep track of the sum, fibPrev to store the previous Fibonacci number, and fibCurr to store the current Fibonacci number.start the Fibonacci sequence with the initial values of 1 and 2.
Then use a while loop to generate Fibonacci numbers until the current Fibonacci number exceeds the given limit. Inside the loop, It checks the current Fibonacci number is even (fibCurr % 2 === 0). If it is, we add it to the sum.
Update the Fibonacci numbers by assigning fibCurr to fibPrev and fibNext (the sum of fibPrev and fibCurr) to fibCurr.
Return the sum.
Project Euler solution 1
Published: 2023-05-17 21:20:00

## **Problem 1**
 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.

## **solution**
function findMultiplesSum() {
  let sum = 0;

  for (let i = 1; i < 1000; i++) {
    if (i % 3 === 0 || i % 5 === 0) {
      sum += i;
    }
  }

  return sum;
}

## **Explanation:**
initialize a variable sum to keep track of the sum of multiples.then loop through the numbers from 1 to 999 (excluding 1000) using a for loop. For each number,check if it is divisible by 3 or 5 using the modulus operator (%). If it is divisible,add it to the sum variable. Finally,return the sum
Use Phone Camera with Python
Tags: webdev, python, beginners
Published: 2023-05-17 21:10:16


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ivt4dp8gklsjinjq0xk.png)[Use phone Camera with Python](https://link.medium.com/qfUxO0MRSzb)

Have you ever thought about the possibility of using your phone’s camera for computer vision task? Yes, you can! In this article, I will walk you through how to use your phone camera with Python for computer vision.
What is Infrastructure as Code (IaC).
Tags: devops, infrastructureascode
Published: 2023-05-17 20:53:00

Infrastructure as Code (IaC) can be summarized in the following points:

1. Definition: IaC is an approach to managing infrastructure resources using code and configuration files.

2. Automation: It involves automating the deployment, configuration, and management of infrastructure components.

3. Code-based: Infrastructure is defined and provisioned using 
   declarative or imperative code.

4. Version Control: Infrastructure code can be version-controlled, allowing for easy tracking and collaboration.

5. Consistency: IaC ensures consistent deployment and configuration of infrastructure resources.

6. Scalability: With IaC, infrastructure can be easily scaled up or down to meet changing demands.

7. Tooling: Tools like Terraform, CloudFormation, or Ansible are commonly used for implementing IaC.

8. Collaboration: IaC promotes collaboration between developers, operations teams, and other stakeholders.

9. Efficiency: Infrastructure provisioning and modifications can be done programmatically, reducing manual effort.

10. Alignment with DevOps: IaC aligns with DevOps principles, enabling agile and efficient infrastructure management.

For more post on this topic see my upcoming posts.
Como ocultar un archivo de texto dentro de una imagen
Tags: ubuntu, beginners, security, programming
Published: 2023-05-17 20:35:37


Hola de nuevo a este blog, en esta sección, empezaremos con la introducción a técnicas de esteganografía y cómo ocultar mensajes ocultos dentro de una imagen.

## Pero, para eso, ¿Qué es la Esteganografía?

La esteganografía, es una técnica de ocultar información dentro de otros archivos, dichos archivos pueden variar entre imagenes, vídeos, música e incluso texto.

![esteganografia-image](https://ayudaleyprotecciondatos.es/wp-content/uploads/2021/03/esteganografia.jpg)

Vamos a imaginar que tienes un dibujo, y para esto, quieres agregar un mensaje oculto para un amigo al que quieres le quieres dar un mensaje; pero quieres que este mensaje no sea visto por nadie más; y prefieres ocultarlo dentro del mensaje de tal manera que este mensaje parezca algo normal para cualquiera que vea el dibujo.

## Ejercicio práctico de esteganografía

Para este ejercicio se hizo el uso de la distribución de Linux llamada ubuntu, además como el software de código abierto **steghide**.

### ¿Qué es steghide?

Steghide es una herramienta de código libre que es utilizado para ocultar información que pueda ser considerada como confidencial y está funciona por medio de comandos.

### Pasos para ocultar un archivo de texto dentro de una imagen.

1. Descargar una imagen; en mi caso, esta será la imagen que utilizaré como ejemplo

![imagen-shrek](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTGyQ-wxbHC6Lr-S6GDTcu-6vNY_M98q0xdLQ&usqp=CAU)

2. Instalar **steghide** en ubuntu con el siguiente comando:
`sudo apt install steghide`
![ss-1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v9w6154qcrygavdxybsu.png)

3. Crear un mensaje en un archivo de texto oculto (puedes crear un archivo de texto o hacerlo con la terminal)

`echo "Esto es un mensaje oculto" >> secreto.txt`

4. Crear una nueva imagen con el archivo secreto oculto en ella, con el siguiente comando:

`steghide embed -ef secreto.txt -cf shrek_burro.jpg -sf imagen_secreto.jpg`

Para esto, tienes que agregar una palabra clave para desencriptar, de tal manera que la persona que reciba el mensaje pueda desencriptarla usando una palabra clave.

5. Para desencriptar el archivo de texto de la imagen se utiliza el siguiente comando:

`steghide extract -sf imagen_secreto.jpg`

Y para desbloquearla, es necesario utilizar la palabra clave.
FINDING MOUNTAIN ARRAY
Tags: java, leetcode, 1095, array
Published: 2023-05-17 20:25:00

The problem requires us to find the index of a given target element in a mountain array. A mountain array is an array that firstly increases and then decreases. We can approach this problem by first finding the index of the peak element in the mountain array. Then we can perform two binary searches - one on the left side of the peak and the other on the right side of the peak to find the target element.

Approach

We can solve this problem in the following steps:

Find the peak element in the mountain array using binary search.

We can start by initializing start = 0 and end = arr.length() - 1 and finding the middle index mid = start + (end - start) / 2.
Then we check if the element at index mid is less than the element at index mid+1.
If this is true, then we know that we are still on the increasing side of the mountain, so we set start = mid + 1.
If this is false, then we know that we are on the decreasing side of the mountain, so we set end = mid.
We continue this until start == end and return the value of start which is the index of the peak element in the mountain array.
Perform two binary searches on the left and right side of the peak to find the target element.

We can set firstTry = orderBinarySearch(mountainArr, target, 0, peak) to search for the target element on the left side of the peak.
If firstTry != -1, we found the target and can return firstTry.
If firstTry == -1, we can perform another binary search on the right side of the peak using orderBinarySearch(mountainArr, target, peak + 1, mountainArr.length() - 1).
We return the result of this binary search.
Implement the orderBinarySearch method to perform a binary search on a given range of the mountain array.

We can use a boolean variable asc to check if the array is in ascending order.
We start with start and end values and perform binary search until start <= end.
At each iteration, we calculate the middle index mid as mid = start + (end - start) / 2.
We check if the element at mid is the target element. If yes, return mid.
If the array is in ascending order, and the target element is less than the element at mid, we know that the target element must be on the left side of mid. So we set end = mid - 1.
If the array is in descending order, and the target element is greater than the element at mid, we know that the target element must be on the left side of mid. So we set end = mid - 1.
If the target element is not found, we return -1.

Complexity

Time complexity:

Time complexity: O(log n), where n is the length of the mountain array.
We use binary search to find the peak element, which takes O(log n) time.
We use two binary searches to find the target element, each taking O(log n) time.

Space complexity: O(1). We use constant extra space throughout the algorithm.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eu0eix5u1kff83tfu368.png)
Experience Effortless Security with Affirm's Passwordless Login System
Published: 2024-06-22 08:38:50

---
title: Experience Effortless Security with Affirm's Passwordless Login System
published: true
date: 2023-05-17 20:03:58 UTC
tags: 
canonical_url: https://mojoauth.com/blog/affirm-passwordless-login
---

In the world of online financing, providing a seamless and secure customer experience is crucial for building trust and fostering long-term relationships. Affirm, a leading provider of flexible payment solutions, has been dedicated to enhancing its platform to ensure a smooth and secure experience for its customers. One such innovation is Affirm’s passwordless login system that not only simplifies the login process but also improves security. In this article, we will explore how Affirm’s passwordless login and Single Sign-On (SSO) system streamline the onboarding process and help customers onboard faster without compromising security.
How to fix error:0308010C:digital envelope routines::unsupported
Published: 2023-05-17 20:02:09

CAUSES
1. NODE VERSION: Using Node version 17 and above,
2. Docker: Building with docker pulls the latest version of node.js by default {Node:LTS}.

The problem here is Node.js 17's push to use OPENSSL 3, changing the code required for the initialisation context of the md family.


HOW TO FIX
1. Downgrade Node.js

- You can use nvm (Node Version Manager) for your Os and run
`nvm install 16.15.1`
`nvm use 16.15.1`

- While for docker you can directly supply the version of Node.js to use.
`use Node:16.15.1`

2. Enable Legacy Support
Get passed the error by enabling support for legacy OpenSSL versions.
    
- Update ENV Variable
`export NODE_OPTIONS=--openssl-legacy-provider`
 Using your terminal Run this on macOs, Linux or Windows Git Bash.

- Updating the package.json file
`"start": "react-scripts start"`
Update to:
`"start": "react-scripts --openssl-legacy-provider start"`
Getting your email layout to automatically adjust for mobile screen sizes
Tags: design, email, code
Published: 2023-05-17 20:01:43

---
title: Getting your email layout to automatically adjust for mobile screen sizes
published: true
description: Simple code for globally adjusting any column in an email template for mobile when using columns as a standard layout practice.
tags: design, email, code
# cover_image: https://blocksedit.com/content-code/img/email-desktop-mobile-layout.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-05-17 19:58 +0000
---

Adjusting your email for mobile doesn't have to be difficult. It comes down to using columns as a standard layout practice. The columns can then be resized and stacked for mobile screen sizes.

Here's an example of what to add to your columns to do this, with CSS code that acts globally across your template.

###[View HTML/CSS code] (https://blocksedit.com/content-code/template-technique-mobile/)
Project: Get a Pet
Tags: javascript, programming, node, react
Published: 2023-05-17 20:00:28

**# Get a Pet**

**# Descrição do Projeto**

Get A Pet is a pet adoption system (SPA). In it, the user registers with a name, email, phone number, and password. The registered user can adopt pets and also put a pet up for adoption. The user can update their information by changing their name, email, phone number, and password. They can also upload a photo of themselves. When registering a pet, certain information is required, such as name, age, weight, color, and photo(s). The logged-in user can schedule a visit and adopt a pet. The user who registered the pet can approve the adoption, which changes the pet's status to "adopted." It is also possible to update the pet's information or delete the registration.

**# Funcionalidades**

- User registration;
- Editing and uploading user photos;
- Pet registration;
- Editing and uploading pet photos;
- Adopting a pet;
- Approving the adoption of a registered pet;
- Pet registration deletion.

**# Tecnologias Usadas**

- Node.js
- Express
- MongoDB
- Mongoose
- Bcrypt
- Cookie-parser
- Cors
- JWT
- Multer
- Validator
- Axios
- Events
- React
- React-Dom
- React-Icons
- React-Router-Dom

The system has protected routes, allowing only authenticated users to access them. Authentication is done using tokens. If the token in the web matches the user's token in the database, they can access the system. I had a problem uploading photos, I'll fix it

It was my first time building a FullStack application, but it was a great experience. As a good Back-End developer, I faced difficulties with React on the Front-End because of a lack of understanding in some areas. But, in the end, everything worked out fine.

Link Project: https://endearing-belekoy-8479b4.netlify.app
Dates validation with Formik and Yup in React & React Native
Tags: webdev, react, reactnative, javascript
Published: 2023-05-17 19:58:10

Hi there!
Sometimes you need to validate dates in your **React&React Native forms** created with **Formik** and **Yup**. Classic example will be some start date and end date, where the simple rule will be to check that the latter goes after the former.

It was quite hard to find something that worked well, basically because standard JavaScript _Date()_ object cannot parse all the string formats quite well.

So here is the solution that validates:
* date format MM/DD/YYY with regular expression
* that end date goes after the start date using moment and yup test function

## Validation demo


![Dates validation demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v87q60c7ppus3kzwgqmk.png)


![Dates validation demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w0wxch7nkdift14pu8uj.png)


## Validation schema code

Here is Yup validation schema that you can use in your projects:

```javascript
// form validation
import { Formik, Field } from "formik";
import * as yup from "yup";
import moment from "moment";

const datesValidationSchema = yup.object().shape({
  dateStart: yup
    .string()
    .required("Start date is required")
    .matches(
      /^((0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2})*$/,
      "Date must be in MM/DD/YYYY format"
    ),
  dateEnd: yup
    .string()
    .matches(
      /^((0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2})*$/,
      "Date must be in MM/DD/YYYY format"
    )
    .test(
      "dates-test",
      "End date should be after start date",
      (value, context) => {
        let startDate = moment(context.parent.dateStart, "MM/DD/YYYY").toDate();
        let endDate = moment(value, "MM/DD/YYYY").toDate();
        return endDate > startDate;
      }
    )
    .required("End date is required"),
});
```
WALL OF SHAME
Published: 2023-05-17 19:48:14

What is Wall of Shame?
Wall of Shame collects the user credentials, sensitive device information from unsecure devices around by creating multiple access points based on the device saved network broadcasts. Once a device connects to the access point created by the Hak5 device, one can get tricked by the portals with spoofed DNS

Install and Setup 

Connect one wireless adapter to your WI-FI pineapple and another to your internet network. Once you've connected to the Wi-Fi Pineapple and it has fully booted go to http://172.16.42.1:1471 . 
connect to your wi-fi pineapple set password. Go to Modules Install Evil portals. Now connect your Phone with the open access point.
Now go to some Github repo of Evil portal and download some cool portals.
Now open your terminal clone the directory now to get this to your wi-fi pineapple it has a ssh.so you can use scp to get portal on wi-fi pineapple  scp -r now use this command

```
ssh root172.16.42.1
```
 enter the password  now you can see the portals directory inside your wi-fi pineapple. select which portal you want eg:

```
scp -r google-login/root@172.16.42.1/root/portal
```
 (specify the directory).enter the password for your wi-fi pineapple. Now go to Evil portal page refresh the page you will be able to see the google login portal now activate it . Now from your phone go to 172.16.42.1 which is the address of wi-fi pineapple. now you can the see the login page of google from your phone and once you sign in with your id it will say you've not been authorized. now you will get the login details on your wi-fi pineapple.