Can you Hide your API Key on GH-Pages? - github-pages

GitHub Pages requires your repository to be public. However, I have an .env variable that is using an API key to call my CMS, and I would not like that API key to be shown.
Does GitHub or GitHub Pages have a way to do that?
I have used a .gitignore, but it does not solve my problem.

GitHub Pages requires your repository to be public.
Your repository can be private, but the website will be published only in priced Github plans.
EDIT: Github has a functionality for secret values like those required in a continuous integration or Github workflow. This is explained in detail here: https://docs.github.com/en/actions/security-guides/encrypted-secrets
You can store up to 100 repository secrets, each one up to 64KB. On your repository main page, you will find the option under:
Settings > Secrets > Actions > New repository secret
Once added, you can use it in your website publishing workflow using proper shell quotations: https://docs.github.com/en/actions/security-guides/encrypted-secrets

Related

local gitlab Auth 2.0 and django

Hello We made our own Gitlab installation on our server. I installed Readthedocs Local in the link below. In order to connect our accounts on gitlab with readthedocs, I was asked to make the following settings from the gitlab section in the readthedocs document.
https://readthedocs.org/
https://dev.readthedocs.io/en/latest/install.html
But interestingly, even though I set the settings on our own server gitlab.local, by default django goes to gitlab.com when I connect to gitlab via devthedocs.org. However, it should connect to gitlab.local on my server, how can I fix this problem?
On page 34 of this document here
https://readthedocs.org/projects/django-allauth/downloads/pdf/latest/
"The GitLab provider works by default with https://gitlab.com. It allows you to connect to your private GitLab
server and use GitLab as an OAuth2 authentication provider as described in GitLab docs at http://doc.gitlab.com/
ce/integration/oauth_provider.html"
I need your support in this matter.
Thank you very much.
Configure the applications on GitHub, Bitbucket, and GitLab. For each of these, the callback URI is http://devthedocs.org/accounts//login/callback/ where is one of github, gitlab, or bitbucket_oauth2. When setup, you will be given a “Client ID” (also called an “Application ID” or just “Key”) and a “Secret”.
Take the “Client ID” and “Secret” for each service and enter it in your local Django admin at: http://devthedocs.org/admin/socialaccount/socialapp/. Make sure to apply it to the “Site”.

How can I hide an API key in a GitHub public repo?

I am doing a simple front-end project where I (or a user) make an API call to the openweathermap api, fetch weather info and display it on a website.
Simple HTML, CSS and vanilla JS
So I want to keep the repo public & host the site with GitHub Pages... but my js file contains the API key which is required at runtime.
Extra Info:
(all this I found when I searched)
I know there is a way to keep an API key in a GitHub secret, then reference it in a yml file as an environmental variable in GitHub Actions.
But how can I put that secret in js code at runtime for any user who access my website?
Please note that what you're attempting to do is not secure. Even if there was a way to get GH Pages to inject the secret API key into the js file at the time of the request, every web client would then have a copy of that js file with the cleartext key embedded.
You will need some sort of minimal backend which stores the API key securely and relays calls from your static web page to the openweathermap API.
There are many ways to set up such a backend. The older question linked in the comments discusses some approaches. Note that nowadays, you could use a serverless FaaS service such as AWS Lambda or Azure Functions.
This is a perfectly valid question by the way and you're certainly not "too dumb". Good luck!

AWS Amplify environment variables for pull requests?

Good evening,
I am new with AWS Amplify.
We have a setup - I didn't set it up - where pull requests to our private Github repository trigger a 'preview' in AWS Amplify.
My understanding is that every preview gets its own preview URL, which is provided by AWS.
Now we have an app where I need to configure a redirect URI. Since the URL cannot be hard-coded I would like to inject it as environment variable at build time.
How can I get access to the URL value?
Only docs I found were these: https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html#amplify-console-environment-variables.
EDIT: Opened a question on Github as well: https://github.com/aws-amplify/amplify-console/issues/1310.
You can use AWS_PULL_REQUEST_ID.
This way, you can get the URL for the PR environment like:
https://pr-${AWS_PULL_REQUEST_ID}.${AWS_APP_ID}.amplifyapp.com

How to hide specific environment when publishing postman collection

I publish a collection in a particular postman workspace successfully. The issue is that when I view the documentation using the public link, I am able to switch to other environments that are used by other workspace.
How can I publish the particular environment I want so that other environments are not seen publicly?
For instance in this image I want only the first staging to be seen and both local and the second staging not present.
Select the specific environment you would like to publish with.
Oh no! all environments are visible publicly :(
Don't worry! share the link with others, they will only able to see the environment you have selected while publishing the doc.
The list of environments visible to you because you have logged in with your account.

Connect to Google Cloud Source Repository from Antora

I am using Antora to generate a static site for our documentation. I have followed their guidance for private repository authentication but are being unsuccessful. It seems that they only support HTTPS Basic Auth for GIT over HTTPS. I have tried generating and using an Application Specific Password, GIT Cookie, OAuth token all without success. Do you have any guidance on how to provide authentication?
At the moment Cloud Source Repositories doesn't support this kind of user/password pair authentication. Here is a similar issue for eclipse.
The only supported ways to authenticate at the moment are described in the Public Documentation
If I understood your requirement correctly, you want to connect to GCP source code repository externally to push code. If so you need to use service account with source code repository access rights. Choose appropriate roles using below URL:
https://cloud.google.com/source-repositories/docs/reference/rest
Refer below mentioned URL for connecting to source code repository once you are authenticated and do git operations.
https://cloud.google.com/source-repositories/docs/authentication
Please let me know if this is what you are looking for.
Hope this helps.