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

fix JWK expiry time parsing from header on startup behaviour (fix #3655) #3779

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions .circleci/test-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ wait_for_port 5001

cache_control_jwk_url='{"type": "RS256", "jwk_url": "http://localhost:5001/jwk-cache-control"}'
expires_jwk_url='{"type": "RS256", "jwk_url": "http://localhost:5001/jwk-expires"}'
cc_nomaxage_jwk_url='{"type": "RS256", "jwk_url": "http://localhost:5001/jwk-cache-control?nomaxage"}'
cc_nocache_jwk_url='{"type": "RS256", "jwk_url": "http://localhost:5001/jwk-cache-control?nocache"}'

# start HGE with cache control JWK URL
export HASURA_GRAPHQL_JWT_SECRET=$cache_control_jwk_url
Expand Down Expand Up @@ -596,6 +598,26 @@ pytest -n 1 -vv --hge-urls "$HGE_URL" --pg-urls "$HASURA_GRAPHQL_DATABASE_URL" -

kill_hge_servers

# start HGE with nomaxage JWK URL
export HASURA_GRAPHQL_JWT_SECRET=$cc_nomaxage_jwk_url
run_hge_with_args serve
wait_for_port 8080

pytest -n 1 -vv --hge-urls "$HGE_URL" --pg-urls "$HASURA_GRAPHQL_DATABASE_URL" --hge-key="$HASURA_GRAPHQL_ADMIN_SECRET" --test-jwk-url test_jwk.py -k 'test_cache_control_header'

kill_hge_servers
unset HASURA_GRAPHQL_JWT_SECRET

# start HGE with nocache JWK URL
export HASURA_GRAPHQL_JWT_SECRET=$cc_nocache_jwk_url
run_hge_with_args serve
wait_for_port 8080

pytest -n 1 -vv --hge-urls "$HGE_URL" --pg-urls "$HASURA_GRAPHQL_DATABASE_URL" --hge-key="$HASURA_GRAPHQL_ADMIN_SECRET" --test-jwk-url test_jwk.py -k 'test_cache_control_header'

kill_hge_servers
unset HASURA_GRAPHQL_JWT_SECRET

kill $JWKS_PID

# end jwk url test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ export default class QueryAnalyser extends React.Component {
{this.state.activeNode >= 0 &&
this.state.analyseData.length > 0
? this.state.analyseData[
this.state.activeNode
].plan.join('\n')
this.state.activeNode
].plan.join('\n')
: ''}
</code>
</pre>
Expand Down Expand Up @@ -183,9 +183,9 @@ export default class QueryAnalyser extends React.Component {
if (type === 'sql') {
text = window.sqlFormatter
? window.sqlFormatter.format(
this.state.analyseData[this.state.activeNode].sql,
{ language: 'sql' }
)
this.state.analyseData[this.state.activeNode].sql,
{ language: 'sql' }
)
: this.state.analyseData[this.state.activeNode].sql;
} else {
text = this.state.analyseData[this.state.activeNode].plan.join('\n');
Expand Down
4 changes: 1 addition & 3 deletions console/src/components/Services/ApiExplorer/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export const getHeadersAsJSON = (headers = []) => {

export const isValidGraphQLOperation = operation => {
return (
operation.name &&
operation.name.value &&
operation.operation === 'query'
operation.name && operation.name.value && operation.operation === 'query'
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,9 @@ class PermissionsSummary extends Component {
const getTablesColumnTable = () => {
return (
<table
className={`table table-bordered ${styles.rolesTable} ${styles.remove_margin}`}
className={`table table-bordered ${styles.rolesTable} ${
styles.remove_margin
}`}
>
<thead>
<tr>{getBackBtn('currTable')}</tr>
Expand Down Expand Up @@ -626,7 +628,9 @@ class PermissionsSummary extends Component {

return (
<table
className={`table table-bordered ${styles.rolesTable} ${styles.remove_margin}`}
className={`table table-bordered ${styles.rolesTable} ${
styles.remove_margin
}`}
>
<thead>
<tr>
Expand Down Expand Up @@ -663,7 +667,9 @@ class PermissionsSummary extends Component {

return (
<table
className={`table table-bordered ${styles.rolesTable} ${styles.remove_margin}`}
className={`table table-bordered ${styles.rolesTable} ${
styles.remove_margin
}`}
>
<thead>{getRolesHeaderRow()}</thead>
</table>
Expand Down Expand Up @@ -694,7 +700,9 @@ class PermissionsSummary extends Component {

return (
<table
className={`table table-bordered ${styles.rolesTable} ${styles.remove_margin}`}
className={`table table-bordered ${styles.rolesTable} ${
styles.remove_margin
}`}
>
<thead>{getActionsHeaderRow()}</thead>
<tbody>{getRoleAllTablesAllActionsRows()}</tbody>
Expand Down Expand Up @@ -1037,7 +1045,9 @@ class PermissionsSummary extends Component {

return (
<div
className={`${styles.clear_fix} ${styles.padd_left} ${styles.fit_content}`}
className={`${styles.clear_fix} ${styles.padd_left} ${
styles.fit_content
}`}
>
<Helmet title="Permissions Summary | Hasura" />
<div className={styles.add_mar_bottom}>
Expand Down
8 changes: 6 additions & 2 deletions console/src/components/Services/Data/RawSQL/RawSQL.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ const RawSQL = ({
<h4 className={styles.subheading_text}>SQL Result:</h4>
<div className={styles.tableContainer}>
<table
className={`table table-bordered table-striped table-hover ${styles.table} `}
className={`table table-bordered table-striped table-hover ${
styles.table
} `}
>
<thead>
<tr>{getTableHeadings()}</tr>
Expand Down Expand Up @@ -506,7 +508,9 @@ const RawSQL = ({
</div>

<div
className={`${styles.padd_left_remove} ${styles.add_mar_bottom} col-xs-8`}
className={`${styles.padd_left_remove} ${
styles.add_mar_bottom
} col-xs-8`}
>
{getTrackThisSection()}
{getMetadataCascadeSection()}
Expand Down
12 changes: 9 additions & 3 deletions console/src/components/Services/Data/Schema/Schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,9 @@ class Schema extends Component {
<div className={styles.display_inline}>
<Button
data-test={`add-track-function-${p.function_name}`}
className={`${styles.display_inline} btn btn-xs btn-default`}
className={`${
styles.display_inline
} btn btn-xs btn-default`}
onClick={handleTrackFn}
>
Track
Expand All @@ -570,7 +572,9 @@ class Schema extends Component {
>
{getTrackBtn()}
<div
className={`${styles.display_inline} ${styles.add_mar_left_mid}`}
className={`${styles.display_inline} ${
styles.add_mar_left_mid
}`}
>
<RawSqlButton
dataTestId={`view-function-${p.function_name}`}
Expand Down Expand Up @@ -687,7 +691,9 @@ class Schema extends Component {

return (
<div
className={`container-fluid ${styles.padd_left_remove} ${styles.padd_top}`}
className={`container-fluid ${styles.padd_left_remove} ${
styles.padd_top
}`}
>
<div className={styles.padd_left}>
<Helmet title="Schema - Data | Hasura" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,17 @@ class FilterQuery extends Component {
>
<div>
<div
className={`${styles.queryBox} col-xs-6 ${styles.padd_left_remove}`}
className={`${styles.queryBox} col-xs-6 ${
styles.padd_left_remove
}`}
>
<span className={styles.subheading_text}>Filter</span>
{renderWheres(whereAnd, tableSchema, dispatch)}
</div>
<div
className={`${styles.queryBox} col-xs-6 ${styles.padd_left_remove}`}
className={`${styles.queryBox} col-xs-6 ${
styles.padd_left_remove
}`}
>
<b className={styles.subheading_text}>Sort</b>
{renderSorts(orderBy, tableSchema, dispatch)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ export const saveComputedField = (
);
}

const migrationName = `save_computed_field_${computedField.table_schema}_${computedField.table_name}_${computedFieldName}`;
const migrationName = `save_computed_field_${computedField.table_schema}_${
computedField.table_name
}_${computedFieldName}`;
const requestMsg = 'Saving computed field...';
const successMsg = 'Saving computed field successful';
const errorMsg = 'Saving computed field failed';
Expand Down Expand Up @@ -259,7 +261,9 @@ export const deleteComputedField = (computedField, table) => (
)
);

const migrationName = `delete_computed_field_${computedField.table_schema}_${computedField.table_name}_${computedFieldName}`;
const migrationName = `delete_computed_field_${computedField.table_schema}_${
computedField.table_name
}_${computedFieldName}`;
const requestMsg = 'Deleting computed field...';
const successMsg = 'Deleting computed field successful';
const errorMsg = 'Deleting computed field failed';
Expand Down Expand Up @@ -663,7 +667,9 @@ const removeForeignKey = (index, tableSchema) => {
const tableName = tableSchema.table_name;
const schemaName = tableSchema.table_schema;
const oldConstraint = tableSchema.foreign_key_constraints[index];
const upSql = `alter table "${schemaName}"."${tableName}" drop constraint "${oldConstraint.constraint_name}";`;
const upSql = `alter table "${schemaName}"."${tableName}" drop constraint "${
oldConstraint.constraint_name
}";`;
const downSql = `alter table "${schemaName}"."${tableName}" add foreign key (${Object.keys(
oldConstraint.column_mapping
)
Expand All @@ -677,7 +683,9 @@ const removeForeignKey = (index, tableSchema) => {
} on delete ${pgConfTypes[oldConstraint.on_delete]};`;
const migrationUp = [getRunSqlQuery(upSql)];
const migrationDown = [getRunSqlQuery(downSql)];
const migrationName = `delete_fk_${schemaName}_${tableName}_${oldConstraint.constraint_name}`;
const migrationName = `delete_fk_${schemaName}_${tableName}_${
oldConstraint.constraint_name
}`;
const requestMsg = 'Deleting foreign key...';
const successMsg = 'Foreign key deleted';
const errorMsg = 'Deleting foreign key failed';
Expand Down Expand Up @@ -792,7 +800,9 @@ const deleteTrigger = (trigger, table) => {
let downMigrationSql = '';

downMigrationSql += `CREATE TRIGGER "${triggerName}"
${trigger.action_timing} ${trigger.event_manipulation} ON "${tableSchema}"."${tableName}"
${trigger.action_timing} ${
trigger.event_manipulation
} ON "${tableSchema}"."${tableName}"
FOR EACH ${trigger.action_orientation} ${trigger.action_statement};`;

if (trigger.comment) {
Expand Down Expand Up @@ -1964,7 +1974,9 @@ const removeUniqueKey = (index, tableName, existingConstraints, callback) => {
// Up migration: Drop the constraint
const sqlUp = [
getRunSqlQuery(
`alter table "${currentSchema}"."${tableName}" drop constraint "${existingConstraint.constraint_name}";`
`alter table "${currentSchema}"."${tableName}" drop constraint "${
existingConstraint.constraint_name
}";`
),
];

Expand Down Expand Up @@ -2263,7 +2275,9 @@ const saveUniqueKey = (
if (index < numUniqueKeys - 1) {
upMigration.push(
getRunSqlQuery(
`alter table "${currentSchema}"."${tableName}" drop constraint "${existingConstraint.constraint_name}";`
`alter table "${currentSchema}"."${tableName}" drop constraint "${
existingConstraint.constraint_name
}";`
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ const AddRelationship = ({
</div>
<div className={tableStyles.tableContainer}>
<table
className={`${tableStyles.table} table table-bordered table-striped table-hover`}
className={`${
tableStyles.table
} table table-bordered table-striped table-hover`}
>
<thead>
<tr>
Expand Down Expand Up @@ -365,7 +367,9 @@ class Relationships extends Component {
addedRelationshipsView = (
<div className={tableStyles.tableContainer}>
<table
className={`${tableStyles.table} table table-bordered table-striped table-hover`}
className={`${
tableStyles.table
} table table-bordered table-striped table-hover`}
>
<thead>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ class RelationshipsView extends Component {
addedRelationshipsView = (
<div className={tableStyles.tableContainer}>
<table
className={`${tableStyles.table} table table-bordered table-striped table-hover`}
className={`${
tableStyles.table
} table table-bordered table-striped table-hover`}
>
<thead>
<tr>
Expand Down
4 changes: 3 additions & 1 deletion console/src/components/Services/Data/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ const generateWhereClause = options => {
if (options.tables) {
options.tables.forEach(tableInfo => {
whereCondtions.push(
`(ist.table_schema='${tableInfo.table_schema}' and ist.table_name='${tableInfo.table_name}')`
`(ist.table_schema='${tableInfo.table_schema}' and ist.table_name='${
tableInfo.table_name
}')`
);
});
}
Expand Down
Loading