Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore (merge) - dev to staging #174

Merged
merged 18 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
83fcf1b
fix(setup): remove S3 usage and download from URL
ctrlc03 Aug 18, 2023
03984b5
fix(imports): use adoby-node-fetch
ctrlc03 Aug 18, 2023
a3cbf07
fix(vm): stop vm even on verification failing
ctrlc03 Aug 18, 2023
9aac6f4
feat(contribute): cli flag for auth token (run on VM)
ctrlc03 Aug 19, 2023
1e5d894
fix(vm): fix VM setup
ctrlc03 Aug 19, 2023
4f2b2be
ci: update string literals in ts files for staging/dev environment
baumstern Aug 21, 2023
72b6713
Merge pull request #157 from privacy-scaling-explorations/fix/non-int…
ctrlc03 Aug 22, 2023
35c305a
Merge pull request #158 from privacy-scaling-explorations/fix/vm
ctrlc03 Aug 22, 2023
36caea1
Merge pull request #159 from privacy-scaling-explorations/feat/contri…
ctrlc03 Aug 22, 2023
b6d28a2
fix(ci): missing environment specifier in cli publish workflow
baumstern Aug 22, 2023
c87126b
Merge pull request #165 from privacy-scaling-explorations/fix-stagcli
ctrlc03 Aug 22, 2023
b2623f1
Merge branch 'staging' into dev
baumstern Aug 22, 2023
35c6088
fix(timeout): fix issue with timing out while in upload phase
ctrlc03 Aug 22, 2023
8b5a17f
Merge pull request #168 from privacy-scaling-explorations/fix/timeout
ctrlc03 Aug 22, 2023
a4931f4
fix(finalization): fix various bugs and add non interactive auth
ctrlc03 Aug 23, 2023
f3ea056
Merge pull request #172 from privacy-scaling-explorations/fix/finalize
ctrlc03 Aug 23, 2023
801d23c
build(cleanup): removed puppeteer and related tests
ctrlc03 Aug 23, 2023
4088679
Merge pull request #173 from privacy-scaling-explorations/chore/cleanup
ctrlc03 Aug 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/publish-staging-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ on:
- staging

jobs:
npm-publish:
npm-publish-staging:
runs-on: ubuntu-22.04
environment: staging

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 0 additions & 4 deletions packages/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@
"firebase": "^9.21.0",
"firebase-admin": "^11.8.0",
"googleapis": "^118.0.0",
"puppeteer": "^20.1.2",
"puppeteer-extra": "^3.3.6",
"puppeteer-extra-plugin-anonymize-ua": "^2.4.6",
"puppeteer-extra-plugin-stealth": "^2.11.2",
"rimraf": "^5.0.0",
"rollup": "^3.21.6",
"snarkjs": "^0.6.11",
Expand Down
91 changes: 0 additions & 91 deletions packages/actions/test/unit/security.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import {
signOut,
signInWithEmailAndPassword,
OAuthCredential,
GithubAuthProvider,
signInAnonymously
} from "firebase/auth"
import { where } from "firebase/firestore"
import { createOAuthDeviceAuth } from "@octokit/auth-oauth-device"
import { randomBytes } from "crypto"
import { fakeCeremoniesData, fakeCircuitsData, fakeParticipantsData, fakeUsersData } from "../data/samples"
import {
Expand Down Expand Up @@ -60,7 +58,6 @@ import {
mockCeremoniesCleanup,
deleteAdminApp
} from "../utils"
import { simulateOnVerification } from "../utils/authentication"

chai.use(chaiAsPromised)

Expand Down Expand Up @@ -861,66 +858,6 @@ describe("Security", () => {
"Firebase: Invalid IdP response/credential: http://localhost?&providerId=undefined (auth/invalid-credential-or-provider-id)."
)
})
/// @note If a token has been invalidated, this shuold not allow to access Firebase again
/// @todo might not be able to test this in code since it requires revoking access on GitHub
it.skip("should not be able to authenticate with a token after this is invalidated", async () => {
const auth = createOAuthDeviceAuth({
clientType,
clientId,
scopes: ["gist"],
onVerification: simulateOnVerification
})
const { token } = await auth({
type: tokenType
})
// Get and exchange credentials.
const userFirebaseCredentials = GithubAuthProvider.credential(token)
await signInToFirebaseWithCredentials(userApp, userFirebaseCredentials)
const user = getCurrentFirebaseAuthUser(userApp)
userId = user.uid

await signOut(userAuth)

// @todo how to revoke the token programmatically?
await signInToFirebaseWithCredentials(userApp, userFirebaseCredentials)
})
/// @note A malicious user should not be able to create multiple malicious accounts
/// to spam a ceremony
// @todo requires adding the checks to the cloud function
it("should prevent a user with a non reputable GitHub account from authenticating to the Firebase", async () => {})
/// @note If a coordinator disables an account, this should not be allowed to authenticate
/// @note test requires a working OAuth2 emulation (puppeteer)
it.skip("should prevent a disabled account from loggin in (OAuth2)", async () => {
const auth = createOAuthDeviceAuth({
clientType,
clientId,
scopes: ["gist"],
onVerification: simulateOnVerification
})
const { token } = await auth({
type: tokenType
})
// Get and exchange credentials.
const userFirebaseCredentials = GithubAuthProvider.credential(token)
await signInToFirebaseWithCredentials(userApp, userFirebaseCredentials)

const user = getCurrentFirebaseAuthUser(userApp)
userId = user.uid
// Disable user.
const disabledRecord = await adminAuth.updateUser(user.uid, { disabled: true })
expect(disabledRecord.disabled).to.be.true

await signOut(userAuth)

await expect(signInToFirebaseWithCredentials(userApp, userFirebaseCredentials)).to.be.rejectedWith(
"Firebase: Error (auth/user-disabled)."
)

// Re-enable user.
// Disable user.
const reEnabledRecord = await adminAuth.updateUser(user.uid, { disabled: false })
expect(reEnabledRecord.disabled).to.be.false
})
/// @note Firebase should lock out an account after a large number of failed authentication attempts
/// to prevent brute force attacks
it("should lock out an account after a large number of failed attempts", async () => {
Expand All @@ -939,34 +876,6 @@ describe("Security", () => {
"FirebaseError: Firebase: Access to this account has been temporarily disabled due to many failed login attempts. You can immediately restore it by resetting your password or you can try again later. (auth/too-many-requests)."
)
})
it.skip("should error out and prevent further authentication attempts after authenticating with the correct OAuth2 token many times (could prevent other users from authenticating)", async () => {
let err: any
const auth = createOAuthDeviceAuth({
clientType,
clientId,
scopes: ["gist"],
onVerification: simulateOnVerification
})
const { token } = await auth({
type: tokenType
})
// Get and exchange credentials.
const userFirebaseCredentials = GithubAuthProvider.credential(token)
for (let i = 0; i < 1000; i++) {
try {
await signInToFirebaseWithCredentials(userApp, userFirebaseCredentials)
} catch (error: any) {
err = error
break
}
}
expect(
err.toString() === "FirebaseError: Firebase: Error (auth/user-disabled)." ||
err.toString() === "FirebaseError: Firebase: Error (auth/network-request-failed)." ||
err.toString() ===
"FirebaseError: Firebase: Malformed response cannot be parsed from github.com for USER_INFO (auth/invalid-credential)."
).to.be.true
})
/// @note Firebase should enforce rate limiting to prevent denial of service or consumption of resources
/// scenario where one user tries to authenticate many times consecutively with the correct details
/// to try and block the authentication service for other users
Expand Down
Loading
Loading