forked from jhaals/yopass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add a github action to sync upstream branch to staging (#34) * add a github action to sync upstream branch to staging * remove trailing space from github action * fix yamllint errors * fix yaml lint issues * relax yamllint config rules * fix yamllint rules config * lint App.tsx * restore hopper config * update yamllint rules config * add selenium docker image to test yopass secret retrieval (#35) * add selenium docker image to test yopass secret retrieval * fix typo in circle config * fix circle config * update docker-compose config for yopass container * add missing checkout step to docker compose task * add setup_remote_docker config for circleci * increase wait time and echo selenium result * use f-string to populate yopass test url in selenium test * debug docker compose ICC issue * attempt to connect to yopass container via ip * take out network debug lines from circleci config * remove custom bridged network to debug * remove old network config from docker compose * update url for selenium test * updated docker-compose config * re-add internal bridged network to docker * include no cache arg to docker compose * update circleci config and remove comment from selenium script * add newline to end of docker compose file * add newline to end of docker compose file * replace sleep with wait argument for docker compose and tear down containers when done * update docker to wait for healthy containers and re-added sleep and updated github action to raise a PR on sync * remove trailing space for github action * revert file perms for hopper config
- Loading branch information
Showing
7 changed files
with
217 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Sync Repo with Upstream and raise PR | ||
|
||
on: | ||
schedule: | ||
- cron: '35 9 * * *' # Runs daily at 9:35 AM UTC | ||
workflow_dispatch: # Allows manual triggering | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
- name: Add upstream remote https://github.com/jhaals/yopass.git | ||
run: git remote add upstream | ||
|
||
- name: Fetch upstream changes | ||
run: git fetch upstream | ||
|
||
- name: Checkout new branch | ||
id: checkout-new-branch | ||
run: | | ||
BRANCH_NAME="sync-upstream-$(date +%s)" | ||
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV | ||
git checkout -b $BRANCH_NAME | ||
- name: Merge upstream changes excluding Dockerfile | ||
run: | | ||
git merge upstream/main --no-commit --no-ff --allow-unrelated-histories || true | ||
git reset HEAD Dockerfile | ||
git checkout -- Dockerfile | ||
git add -A | ||
- name: Push changes to the new branch | ||
run: | | ||
git push origin $BRANCH_NAME | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
commit-message: 'Sync with upstream' | ||
branch: $BRANCH_NAME | ||
title: 'Sync with upstream Yopass repository' | ||
body: | | ||
This PR keeps the forked repository in sync with the upstream Yopass repository | ||
base: staging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
networks: | ||
internal: | ||
driver: bridge | ||
|
||
services: | ||
redis: | ||
image: redis:latest | ||
networks: | ||
- internal | ||
ports: | ||
- "6379:6379" | ||
|
||
yopass: | ||
build: | ||
dockerfile: Dockerfile | ||
ports: | ||
- "80:80" | ||
depends_on: | ||
- redis | ||
networks: | ||
- internal | ||
environment: | ||
- REDIS_CACHE_URL=redis://redis:6379 | ||
|
||
selenium_browser: | ||
build: | ||
context: ./selenium_browser | ||
dockerfile: Dockerfile | ||
container_name: selenium_browser | ||
depends_on: | ||
- redis | ||
- yopass | ||
networks: | ||
- internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM python:3.9-slim | ||
|
||
RUN apt-get update -qq -y && \ | ||
apt-get install -y \ | ||
libasound2 \ | ||
libatk-bridge2.0-0 \ | ||
libgtk-4-1 \ | ||
libnss3 \ | ||
xdg-utils \ | ||
unzip \ | ||
vim \ | ||
wget && \ | ||
wget -q -O chrome-linux64.zip https://bit.ly/chrome-linux64-121-0-6167-85 && \ | ||
unzip chrome-linux64.zip && \ | ||
rm chrome-linux64.zip && \ | ||
mv chrome-linux64 /opt/chrome/ && \ | ||
ln -s /opt/chrome/chrome /usr/local/bin/ && \ | ||
wget -q -O chromedriver-linux64.zip https://bit.ly/chromedriver-linux64-121-0-6167-85 && \ | ||
unzip -j chromedriver-linux64.zip chromedriver-linux64/chromedriver && \ | ||
rm chromedriver-linux64.zip && \ | ||
mv chromedriver /usr/local/bin/ | ||
|
||
RUN pip install selenium | ||
|
||
COPY yopass_secret_test.py . | ||
|
||
CMD ["python", "yopass_secret_test.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Automate generating and retrieving a test secret from Yopass | ||
# Simulates adding a secret in the form field, submitting the Encrypt Message button | ||
# Retrieve secret from Redis cache by browsing to one-time generated URL and compare input and output match | ||
|
||
from selenium import webdriver | ||
from selenium.webdriver.chrome.service import Service | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.common.keys import Keys | ||
from selenium.webdriver.chrome.options import Options | ||
from selenium.webdriver.support.ui import WebDriverWait | ||
from selenium.webdriver.support import expected_conditions as EC | ||
|
||
# Set up Chrome options | ||
chrome_options = Options() | ||
chrome_options.add_argument("start-maximized") # Run headless Chrome | ||
chrome_options.add_argument("disable-infobars") # Run headless Chrome | ||
chrome_options.add_argument("--disable-exensions") # Run headless Chrome | ||
chrome_options.add_argument("--disable-dev-shm-usage") # Run headless Chrome | ||
chrome_options.add_argument("--no-sandbox") # Run headless Chrome | ||
chrome_options.add_argument("--headless") # Run headless Chrome | ||
|
||
# Set up the ChromeDriver service | ||
service = Service('/usr/local/bin/chromedriver') | ||
|
||
# Initialize the WebDriver | ||
driver = webdriver.Chrome(service=service, options=chrome_options) | ||
|
||
# Set the URL | ||
url = 'http://yopass' | ||
|
||
# Set test secret | ||
test_secret = 'this is a Selenium test secret' | ||
|
||
# Open the URL | ||
driver.get(url) | ||
driver.implicitly_wait(30) | ||
|
||
# Submit the test secret | ||
testSecret = driver.find_element("name", "secret"); | ||
testSecret.send_keys(test_secret); | ||
button = driver.find_element("xpath", "//button[span[text()='Encrypt Message']]") | ||
button.click() | ||
|
||
# Get the response text | ||
wait = WebDriverWait(driver, 10) | ||
link_element = wait.until(EC.presence_of_element_located((By.ID, 'root'))) | ||
link_element = driver.find_element(By.XPATH, f'//td[contains(text(), "{url}/#/s/")]') | ||
complete_url = link_element.text | ||
|
||
# Retrieve the test secret | ||
driver.get(complete_url) | ||
driver.implicitly_wait(60) | ||
|
||
secret_element = wait.until(EC.presence_of_element_located((By.ID, 'pre'))) | ||
|
||
if secret_element.text == test_secret: | ||
print("PASS") | ||
else: | ||
print("FAIL") | ||
|
||
# Close the WebDriver | ||
driver.quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,4 @@ const App = () => { | |
); | ||
}; | ||
|
||
export default App; | ||
export default App; |